Hi R'sians
As the experts here suggested, I am using "scan" and "readLines" to read
text files. I notice that read.table takes a long time read and process
character vectors of 30000+ rows.

How do I separate out the columns in the resulting character vector? The
function "read.fwf" appears to be a bit cumbersome to use as number of
columns in the text files is not constant, and some preprocessing to obtain
number of columns is needed.

Would really appreciate your ideas!!

Below is the embedded data from the attached text file
"TABLE NO. 1: Gold"
" R1           T1           T2           T3           T4
T5          "
"            0  3.68000E+01  1.41000E+03  4.94000E+03  2.33000E+01
4.90000E+01"
"           43  3.77870E+01  2.46260E+03  4.44227E+03  2.31390E+01
4.84272E+01"
"           -1  3.67870E+01  1.46260E+03  4.44227E+03  2.31390E+01
4.84271E+01"
"TABLE NO. 2: Silver"
" R1           T1           T2           T3           T4
T5          "
"            0  3.68000E+01  1.41660E+03  4.54000E+03  2.89000E+01
4.90000E+01"
"           56  3.67870E+01  5.46260E+03  4.94227E+03  2.42390E+01
4.84272E+01"
"           -1  8.67870E+01  9.46260E+03  4.94227E+03  2.31390E+01
4.84271E+01"

Thanks,
Santosh
"TABLE NO. 1: Gold" 
" R1           T1           T2           T3           T4           T5          
" 
"            0  3.68000E+01  1.41000E+03  4.94000E+03  2.33000E+01  4.90000E+01"
"           43  3.77870E+01  2.46260E+03  4.44227E+03  2.31390E+01  4.84272E+01"
"           -1  3.67870E+01  1.46260E+03  4.44227E+03  2.31390E+01  4.84271E+01"
"TABLE NO. 2: Silver" 
" R1           T1           T2           T3           T4           T5          
" 
"            0  3.68000E+01  1.41660E+03  4.54000E+03  2.89000E+01  4.90000E+01"
"           56  3.67870E+01  5.46260E+03  4.94227E+03  2.42390E+01  4.84272E+01"
"           -1  8.67870E+01  9.46260E+03  4.94227E+03  2.31390E+01  4.84271E+01"
______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to