r - Reading the non delimited file with no particular patterns in the data -


i want read ascii file r environment. however, ascii file non delimited , data not continuous (have blank spaces between variables) in order read data have used below syntax i.e

test <- read.fwf("d:/r_process/ascii.txt", width = c(10, 4, 1, 4, 9, 9, 1,1,1,1,1,1,1,3,8)) 

now able read data read wrong. actually, out put should have applicable variables data not blank data. below ascii data. please let me know how should write syntax read applicable data in file.

thanks in advance.

here data:

000000000120151  04 0.766696           1                         1000000000 010  000000000220151  04 1.458186           1                         1000100000 020  000000000320151  04 0.185492           1                         1000000000 015  000000000420151  04 0.961584           1                         1000000000 003  000000000520151  04 0.650091           2                         0001000000      000000000620151  04 0.430350           1                         1000000000 020  000000000720151  04 3.192895           2                         1011000000 000  000000000820151  04 0.617127           1                         1010100000 015  000000000920151  04 0.399207           1                         1000000000 010 

you can use strip.white parameter on read.fwf.

test <- read.fwf("d:/r_process/ascii.txt",   width = c(10, 4, 1, 4, 9, 9, rep(1, 8), 3, 8),   strip.white = true) 

Comments