r - read.csv - skip rows with different number of columns -


there 5 rows @ top of csv file serve information file, not need.

these information rows have 2 columns, while headers, , rows of data (from 6 on-wards) have 8. this appears cause of issue.

i have tried using skip function within read.csv skip these lines, , same read.table

df = read.csv("myfile.csv", skip=5) df = read.table("myfile.csv", skip=5) 

but still gives me same error message, is:

error in read.table("myfile.csv",  :empty beginning of file 

in addition: warning messages:

1: in readlines(file, skip) : line 1 appears contain embedded nul 2: in readlines(file, skip) : line 2 appears contain embedded nul ... 5: in readlines(file, skip) : line 5 appears contain embedded nul 

how can .csv read r without null values in first 5 rows causing issue?

you try:

read.csv(text=readlines('myfile.csv')[-(1:5)]) 

this store each line in own vector element, drop first 5 , treat rest csv.


Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -