[R] Select a set of rows based on a condition

RaoulD raoul.t.dsouza at gmail.com
Wed Dec 7 12:23:18 CET 2011


I need help with selecting a set of rows from a column in a dataset, that
matches a string criteria - start and end. The dataset is :

<variable Name>   <Value>
   List|Index           10
   ABC                  20
   DEF                   10 
   GHI                   50
   JKL                    40
   MNO                  20
   PQR                   10
End = "MNO"

Ideally, I would like to select the data from DEF to MNO into a new data
set. My logic is
1) get the row number for DEF
2) get the row number for MNO
3) subset the rows from DEF to MNO

Can someone please help me with the R code for this as am a little rusty.
Please let me know if you have questions.

Thanks in advance!

View this message in context: http://r.789695.n4.nabble.com/Select-a-set-of-rows-based-on-a-condition-tp4168594p4168594.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list