Skip to content
Prev 273336 / 398506 Next

How to subset() from data frame using specific rows

Hi Rich,
On Tue, Oct 4, 2011 at 2:58 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
You asked for pointers, and didn't provide a reproducible example, so
I offered a
pointer.

If you have a logical vector that specifies whether to include or omit
a row, you
can use that to subset your data frame.

sitesToUse <- grepl("firstsite", mydata$mysitenames)
dataframeForThatSite <- mydata[sitesToUse, ]

If you want real worked results, you'll need to provide a reproducible example
of your own.

Sarah