On Oct 27, 2010, at 1:53 PM, smcguffee wrote:
Hi,
I have a data file with hundreds of rows, with every first, second,
third,
and fourth line representing a set of numbers for row names x, y,
fit, and
residuals, respectively. However, any given group of these lines
might be
from 10 to 20000 values long.
When I try
fits=read.delim2("test")
Try adding ...
, header=FALSE, quote="")
.....to the read arguments. (You have no header and the leading and
trailing double-quotes result in everything getting read in in one
column.)
Error in read.table(file = file, header = header, sep = sep, quote =
quote,
:
more columns than column names
When I try
fits=readLines("test")
it reads the data, but doesn't separate it into values:
head(fits)
[1] "1\t30049\t30204\tsegment_4\t35\t."
[2]
"bp
\t30049
\t30065
\t30071
\t30114
\t30119
\t30121
\t30126
\t30130\t30132\t30134\t30137\t30146\t30151\t30165\t30174\t30204\t"
[3] "origScore\t4\t1\t1\t2\t1\t1\t2\t2\t2\t6\t5\t2\t1\t2\t1\t2\t"
[4]
"fit
\t2.15669
\t2.20976
\t2.22514
\t2.25842
\t2.25336
\t2.25082
\t2.24318
\t2.23576
\t2.23161
\t2.22718\t2.21999\t2.19465\t2.17818\t2.12334\t2.08169\t1.91129\t"
[5]
"residuals
\t1.84331
\t
-1.20976
\t
-1.22514
\t
-0.258424
\t
-1.25336
\t
-1.25082
\t
-0.243182
\t
-0.235756
\t
-0.23161
\t3.77282
\t2.78001\t-0.194654\t-1.17818\t-0.123344\t-1.08169\t0.0887071\t"
Can anyone help me do this?
Thanks,
Sean
--
View this message in context:
http://r.789695.n4.nabble.com/How-do-I-read-multiple-rows-of-different-lengths-tp3015986p3015986.html
Sent from the R help mailing list archive at Nabble.com.
______________________________________________
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.
David Winsemius, MD
West Hartford, CT
______________________________________________
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.