Dear Oscar, You don't need grep() to do what you want:
> Data[Data$Category == "G(50)", c("Time", "QC")] Time QC 2 0.00 1.0000 6 0.01 1.0001 7 0.02 1.0003 8 0.03 1.0004 9 0.04 1.0005 10 0.05 1.0007 11 0.06 1.0008 12 0.07 1.0009 13 0.08 1.0011 14 0.09 1.0012 15 0.10 1.0013 I hope this helps, John ------------------------------ John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada web: socserv.mcmaster.ca/jfox > -----Original Message----- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of oscar linares > Sent: January-18-09 4:18 PM > To: r-help@r-project.org > Subject: [R] ?grep > > Dear Rxperts, > > I have the following data: > > Study Study.Name C Category TC Time QC QO SD FSD Theta > 1 NONE 0 P(22) 0 0.00 7.5596 0 0 8.0361e-03 0 > 1 NONE 6 G(50) 0 0.00 1.0000 0 0 0.0000e+00 0 > 1 NONE 2 F(02) 0 0.00 100.0000 0 0 0.0000e+00 0 > 1 NONE 3 F(03) 0 0.00 13.2280 0 0 1.6732e-02 0 > 1 NONE 2 F(02) 0 0.00 100.0000 100 1 0.0000e+00 0 > 1 NONE 6 G(50) 0 0.01 1.0001 0 0 5.6765e-07 0 > 1 NONE 6 G(50) 0 0.02 1.0003 0 0 7.5677e-07 0 > 1 NONE 6 G(50) 0 0.03 1.0004 0 0 1.5133e-06 0 > 1 NONE 6 G(50) 0 0.04 1.0005 0 0 1.8914e-06 0 > 1 NONE 6 G(50) 0 0.05 1.0007 0 0 2.2694e-06 0 > 1 NONE 6 G(50) 0 0.06 1.0008 0 0 2.6463e-06 0 > 1 NONE 6 G(50) 0 0.07 1.0009 0 0 3.2126e-06 0 > 1 NONE 6 G(50) 0 0.08 1.0011 0 0 3.5901e-06 0 > 1 NONE 6 G(50) 0 0.09 1.0012 0 0 4.1564e-06 0 > 1 NONE 6 G(50) 0 0.10 1.0013 0 0 4.5348e-06 0 > 1 NONE 2 F(02) 0 0.10 99.6310 0 0 1.2637e-05 0 > 1 NONE 3 F(03) 0 0.10 13.2090 0 0 1.6720e-02 0 > # END > > I need to extract the elements labelled G(50) under Category heading with > the corresponding col values in cols labeled Time and QC. > > Please help:-) > > Thank you in advance for excellent help! > -- > Oscar > Oscar A. Linares > Molecular Medicine Unit > Bolles Harbor > Monroe, Michigan > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@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. ______________________________________________ R-help@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.