开发者

Error when reading in data

I’ trying to read in a set of data tables. All of which is representing different parts of a larger Excel table, selected using ”filter” and saved individually as a .csv file. Most of my tables have 5 rows of data but two of them have 4 rows. The tables with 5 rows of data reads in to R as requested:

Y <- read.csv(file = "MyFile.csv", row.names = 1,header = T, sep = ";") 

No problem.

The tables with 4 rows of data gives following error meassage:

In read.csv("MyFile.csv", quote = "", : incomplete final line found by readTableHeader on ' MyFile.csv'

It’s the same p开发者_运维技巧roblem with

Z <- read.table("MyFile.csv", quote = "", sep = ';', header = TRUE)

There is no missing data in the file. When I print the Y or Z object in R no missing data is visible (or invisible as it were).

I know the problem is extremely simple, but as I’ve got frustration pouring out of my ears my officemates would really appreciate your help.


The final line of your CSV doesn't have a line feed or carriage return.

Plan A: open the files in a text editor, go to the end of the final line, hit enter and then save the modified file.

Plan B: if there are too many files for Plan A, you could simply ignore the warnings, since the files seem to be loaded fine (apart from that message).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜