1

I have a CSV file where the first row is more of a comment (see bottom for illustration) and i would like to ignore it in a read.csv.

using skip=2 for read.csv doesn't work either - wondering if anyone has figured out how this might be done?

Error for using skip message is: Error in read.table(file = file, header = header, sep = sep, quote = quote, : empty beginning of file In addition: Warning messages: 1: In readLines(file, skip) : line 1 appears to contain an embedded nul 2: In read.table(file = file, header = header, sep = sep, quote = quote, : line 1 appears to contain embedded nulls 3: In read.table(file = file, header = header, sep = sep, quote = quote, : line 2 appears to contain embedded nulls

My Report (Jan 1, 2016-Aug 27, 2016)

Header A Header B Header C

John Dole 20 100

Jia He Lim
  • 171
  • 1
  • 7
  • 1
    If the first row is a comment, `skip=1` can be used – akrun Aug 28 '16 at 12:17
  • Thank you for responding - Ive tried that but it throw and error where i can't figure out - Error in read.table(file = file, header = header, sep = sep, quote = quote, : empty beginning of file In addition: Warning messages: 1: In readLines(file, skip) : line 1 appears to contain an embedded nul – Jia He Lim Aug 28 '16 at 12:19
  • Perhaps you need the correct encoding as showed [here](http://stackoverflow.com/questions/23209464/get-embedded-nuls-found-in-input-when-reading-a-csv-using-read-csv) – akrun Aug 28 '16 at 12:22
  • Encoding is Unicode- the strange part is if I opened the file in Excel, and manually delete off the first line, everything works perfectly. – Jia He Lim Aug 28 '16 at 12:31
  • 1
    Thanky you! this is a duplicate - I should have Googled harder on the error. My apologies. – Jia He Lim Aug 31 '16 at 20:08

0 Answers0