Can i use "readLines" to extract only the linees with a specific word within? If yes, how? Tnx for help. -- View this message in context: http://r.789695.n4.nabble.com/Question-about-readLines-tp3044701p3044701.html Sent from the R help mailing list archive at Nabble.com.
On Nov 16, 2010, at 7:37 AM, romzero wrote:> > Can i use "readLines" to extract only the linees with a specific > word within? > > If yes, how?Just use: lines <- readLines( <appropriate-arguments> ) desired <- lines[grep("word", lines]> > Tnx for help. > -- > View this message in context: http://r.789695.n4.nabble.com/Question-about-readLines-tp3044701p3044701.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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
x <- readLines('yourFile') x <- x[grepl('myWord', x)] On Tue, Nov 16, 2010 at 7:37 AM, romzero <romzero at yahoo.it> wrote:> > Can i use "readLines" to extract only the linees with a specific word within? > > If yes, how? > > Tnx for help. > -- > View this message in context: http://r.789695.n4.nabble.com/Question-about-readLines-tp3044701p3044701.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > R-help at 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. >-- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve?