csv - Parsing variable column length in R -


i have text file comma separated , has 50 rows. first 10 lines have 6 columns , next 10 lines have 8 columns , on. in short different rows may have different columns. how read using r? tried using read.table() reading data wrong.

also there unique identifier column how many columns row have.

just read data using fill=true flag of read.table. automatically adds blanks in case of unequal columns

data

a,b c,d,e,g h,i,j  read.table(data,sep=",",fill=true) 

output

  v1 v2 v3 v4 1   b       2  c  d  e  g 3  h   j   

Comments