Re: [R] Read text file

2015-06-17 Thread Olivier Crouzet
5 01:10:39 To: r-help Reply-To: sye...@gmail.com Subject: [R] Read text file How do I read a block of space-delimited numbers into a column vector using the read.table command? Thank you. -- Steven Yen __ R-help@r-project.org mailing list -- To UNSUB

Re: [R] Read text file

2015-06-17 Thread William Dunlap
I am not sure what you mean by "a block", but you can probably use scan() instead of read.table(): > txt <- "1 21 41 61 81" > d <- data.frame(Numbers=scan(text=txt, what="numeric", quiet=TRUE)) > d Numbers 1 1 2 21 3 41 4 61 5 81 Bill Dunlap TIBCO Sof

[R] Read text file

2015-06-17 Thread Steven Yen
How do I read a block of space-delimited numbers into a column vector using the read.table command? Thank you. -- Steven Yen __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do re

Re: [R] Read text file

2014-03-11 Thread arun
Hi, There is no GPGLL or GPGLA entries in the data.  You can use ?grep to read those lines. ##Modifying the input data lines1 <- readLines(textConnection("1377262633.948000    $GPRMC,125708.00,A,5047.66107,N,00603.65528,E,0.203,247.36,230813,,,A*60 1377262633.958000    $GPVTG,247.36,T,,M,0.203,N,

Re: [R] Read text file

2014-03-11 Thread jim holtman
Since you don't have a header on the first line, just use 'read.table'. > x <- read.table(text = "1377262633.948000 $GPRMC,125708.00,A,5047.66107,N,00603.65528,E,0.203,247.36,230813,,,A*60 + 1377262633.958000$GPVTG,247.36,T,,M,0.203,N,0.377,K,A*3B + 1377262633.968000 $GPGGA,125708.00,5047.66

Re: [R] Read text file

2014-03-11 Thread David Carlson
ent of Anthropology Texas A&M University College Station, TX 77840-4352 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Pascal Oettli Sent: Tuesday, March 11, 2014 7:08 AM To: Alaios Cc: R. Help Subject: Re: [R] Read text file

Re: [R] Read text file

2014-03-11 Thread Pascal Oettli
Hello, See the "fill" option of the "read.csv" function. But be careful, it might lead to erroneous results, as explained in the help page... And there is neither $GPGLL nor $GPGLA in your example. Regards, Pascal On Tue, Mar 11, 2014 at 9:00 PM, Alaios wrote: > Hi all > I am trying to read so

[R] Read text file

2014-03-11 Thread Alaios
Hi all I am trying to read some text files with the following format: 1377262633.948000    $GPRMC,125708.00,A,5047.66107,N,00603.65528,E,0.203,247.36,230813,,,A*60 1377262633.958000    $GPVTG,247.36,T,,M,0.203,N,0.377,K,A*3B 1377262633.968000    $GPGGA,125708.00,5047.66107,N,00603.65528,E,1,09,0

Re: [R] Read text file in R

2013-03-28 Thread arun
HI, Just a correction: indx<-rep(rep(c(TRUE,FALSE),each=2),23) A.K. - Original Message - From: arun To: Joanna Zhang Cc: R help Sent: Thursday, March 28, 2013 11:38 AM Subject: Re: [R] Read text file in R con<-file("RRoutall.txt")  Lines1<- readLines(con)  close

Re: [R] Read text file in R

2013-03-28 Thread arun
con<-file("RRoutall.txt")  Lines1<- readLines(con)  close(con) indx<-rep(rep(c(TRUE,FALSE),each=2),22) Lines2<-Lines1[!grepl("[A-Za-z]",Lines1)] res<-read.table(text=paste(gsub("^\\s+","",Lines2[indx]),gsub("^\\s+","",Lines2[!indx])),sep="",header=FALSE) nm1<-unlist(strsplit(gsub("^ +","",paste(L

Re: [R] Read text file in R

2013-03-25 Thread arun
res[res$EN==min(res$EN),] #   m1 n1  m  n cterm1_P0L cterm1_P0H  c11  c12   c1   c2 alpha beta   T_error #25  9  4 13 12  0.6302494  0.7565041 0.03 0.07 0.15 0.15   0.1  0.2 0.4403712 #27  9  4 13 12  0.6302494  0.7565041 0.03 0.07 0.15 0.20   0.1  0.2 0.4473437 #33  9  4 13 12  0.6302494  0.7565

Re: [R] Read text file in R

2013-03-25 Thread arun
Hi, Try this: con<-file("Routallnew.txt")  Lines1<- readLines(con)  close(con) indx<-rep(rep(c(TRUE,FALSE),each=2),24) Lines2<-Lines1[!grepl("[A-Za-z]",Lines1)] res<-read.table(text=paste(gsub("^\\s+","",Lines2[indx]),gsub("^\\s+","",Lines2[!indx])),sep="",header=FALSE) nm1<-unlist(strsplit(gsub("^

Re: [R] Read text file subsetting rows

2008-04-11 Thread Zev Ross
Chuck, Thanks so much, these both work like a charm. The first method, though, is very, very slow for a large dataset (<100,000) while the second is reasonable in terms of speed. If you or anyone have any ideas for speeding up the import send them my way otherwise the: con2 <- pipe( 'grep "^RD

Re: [R] Read text file subsetting rows

2008-04-11 Thread Charles C. Berry
On Fri, 11 Apr 2008, Zev Ross wrote: > Hi All, > > Can anyone direct me to a read function in R that will allow me to only > read in rows of a text file that begin with a particular value such as > the data below. I would read the entire file in and then limit, but the > files were constructed suc

[R] Read text file subsetting rows

2008-04-11 Thread Zev Ross
Hi All, Can anyone direct me to a read function in R that will allow me to only read in rows of a text file that begin with a particular value such as the data below. I would read the entire file in and then limit, but the files were constructed such that the first two letters determine how ma