[R] readLines with space-delimiter?

Seth sjmyers at syr.edu
Wed May 5 02:10:10 CEST 2010


Hi,
I am reading a large space-delimited text file into R (41 columns and many
rows) and need to do run each row's values through another R object and then
write to another text file.  So, far using readLines and writeLines seems to
be the best bet.  I've gotten the data exchange working except each row is
read in as one 'chunk', meaning the row has all values between two quotes
("41 numbers").  I need to split these based upon the spaces between them. 
What is the simplest means of doing this?

Code so far.

datin<-file("C:\\rforest\\data\\aoidry_predictors_85.txt", open="rt")
datout<-file("C:\\rforest\\prob85.txt",open="wt")
x<-readLines(datin,n=1)
writeLines(x,con=datout)

Thanks,
Seth
-- 
View this message in context: http://r.789695.n4.nabble.com/readLines-with-space-delimiter-tp2130255p2130255.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list