Re: [R] Extract from a text file

2016-05-31 Thread Bert Gunter
On Tue, May 31, 2016 at 7:05 PM, Jeff Newmiller wrote: > You need to go back and study how I made my solution reproducible and make > your problem reproducible. > > You probably also ought to spend some time comparing the regex pattern to > your actual data... the point of this list is to learn

Re: [R] Extract from a text file

2016-05-31 Thread Jeff Newmiller
You need to go back and study how I made my solution reproducible and make your problem reproducible. You probably also ought to spend some time comparing the regex pattern to your actual data... the point of this list is to learn how to construct these solutions yourself. -- Sent from my pho

Re: [R] Extract from a text file

2016-05-31 Thread Val
Thank you so much Jeff. It worked for this example. When I read it from a file (c:\data\test.txt) it did not work KLEM="c:\data" KR=paste(KLEM,"\test.txt",sep="") indta <- readLines(KR, skip=46) # not interested in the first 46 lines) pattern <- "^.*group (\\d+)[^:]*: *([-+0-9.eE]*).*$" firstli

Re: [R] Extract from a text file

2016-05-30 Thread Jeff Newmiller
Please learn to post in plain text (the setting is in your email client... somewhere), as HTML is "What We See Is Not What You Saw" on this mailing list. In conjunction with that, try reading some of the fine material mentioned in the Posting Guide about making reproducible examples like this

Re: [R] Extract from a text file

2016-05-30 Thread Ulrik Stervbo
Hi Val, Take a kook at read.table. If for some reason the file dosen't have the same separator between the columns you can use strsplit after loading the file. This might helpyou along getting data into R: http://www.statmethods.net/input/importingdata.html Best On Tue, 31 May 2016, 02:15 Val,

[R] Extract from a text file

2016-05-30 Thread Val
Hi all, I have a messy text file and from this text file I want extract some information here is the text file (out.txt). One record has tow lines. The mean comes in the first line and the SE of the mean is on the second line. Here is the sample of the data. Mean of weight group 1, SE of mean