0
votes

I had troubles importing data I need from .csv files to R.
So to check, I created a simple .csv from excel with 2 columns and 3 rows - it reads like this in notepad

what,now
1,4
2,5
3,6

When I try import this data into R

d <- read.csv("D:/Book1.csv")

it gives a warning message,

Warning message: In read.table(file = file, header = header, sep = sep, quote = quote, : incomplete final line found by readTableHeader on 'D:/Book1.csv'

and then when I view the data, it's some gibberish.

What do I do?

1
Did you try to search the error message? First hit leads me to this stackoverflow.com/questions/5990654/… Did you try any of the method listed there?Ronak Shah
Open the file with Notepad++ or evem MS Notebook, go to the end of last line of you file and tap enter. And as it mentioned above sep=","Adamm
If you are saving the file using notepad then add newline(press enter) after last data (i.e. after 6) and save. If you are saving the file using excel then use save As and select option CSV (Comma delimeted) (*.csv) as file typeKushdesh
I am using excel and saving the file as .csvJRBatHolmes
@Ronak Yes, I tried leaving the last line empty and having the data in a new csv . none of these solutions workJRBatHolmes

1 Answers

0
votes

I was using a work PC, and the files were encrypted - which was the reason why importing data into R was not working. I bypassed it by copying data into a text document. Thanks everyone!