这是我的代码:
imdb <- read.table(file = "/data.tsv", sep = "\t", header = TRUE, na.strings = "")
错误:
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 11 did not have 9 elements
文件,您可以在其中查看列的分隔方式,等等。
实际上,第11行有9个元素,那么可能是什么问题?
tt0000010 short Exiting the Factory La sortie de l'usine Lumière à Lyon 0 1895 \N 1 Documentary,Short
tt0000011 short Akrobatisches Potpourri Akrobatisches Potpourri 0 1895 \N 1 Documentary,Short
tt0000012 short The Arrival of a Train L'arrivée d'un train à La Ciotat 0 1896 \N 1 Action,Documentary,Short
当行中有更多元素时,将是一个问题。我们可以使用fill = TRUE
imdb <- read.table(file = "/data.tsv", sep = "\t",
header = TRUE, na.strings = "", fill = TRUE)