I have data in which each row consists of a long string of number, letters, symbols, and blank spaces. I would like to simply scan in strings of length 426, but R takes the spaces that occur in the data as separators. Is there any way around this? Thanks, Jeff Steedle -- Jeffrey T. Steedle (jsteedle at stanford.edu) Psychological Studies in Education Stanford University School of Education
On 12-Jan-06 Jeffrey T. Steedle wrote:> I have data in which each row consists of a long string of number, > letters, symbols, and blank spaces. I would like to simply scan in > strings of length 426, but R takes the spaces that occur in the data as > separators. Is there any way around this? > > Thanks, > Jeff SteedleYou could use readLines(), perhaps? Data<-readLines("datafile") should give you a vector Data of which each element is a character string which is one line read from your datafile. Best wishes, Ted. -------------------------------------------------------------------- E-Mail: (Ted Harding) <Ted.Harding at nessie.mcc.ac.uk> Fax-to-email: +44 (0)870 094 0861 Date: 12-Jan-06 Time: 22:46:39 ------------------------------ XFMail ------------------------------
Perhaps read.fwf() can be of use... Andy From: Jeffrey T. Steedle> > I have data in which each row consists of a long string of number, > letters, symbols, and blank spaces. I would like to simply scan in > strings of length 426, but R takes the spaces that occur in > the data as > separators. Is there any way around this? > > Thanks, > Jeff Steedle > > -- > Jeffrey T. Steedle (jsteedle at stanford.edu) > Psychological Studies in Education > Stanford University School of Education > > ______________________________________________ > R-help at stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > >