Message-ID: <CAAmySGP8yySW77sj6P35A7pXb33+ag=AMgo37wDO3xofRBprKA@mail.gmail.com>
Date: 2011-10-04T19:10:37Z
From: R. Michael Weylandt
Subject: How to subset() from data frame using specific rows
In-Reply-To: <alpine.LNX.2.00.1110041204130.12907@salmo.appl-ecosys.com>
No, that was just a typo on my end:
the correct order of arguments should have been
ff <- grepl("BC-", ff)
On Tue, Oct 4, 2011 at 3:07 PM, Rich Shepard <rshepard at appl-ecosys.com> wrote:
> On Tue, 4 Oct 2011, R. Michael Weylandt wrote:
>
>> This isn't going to be the most elegant, but it should work:
>> ## Get the factors as characters
>> ff <- as.character(chemdata$site)
>>>
>>> ## Identify those that match what you want
>>
>> ff <- grepl(ff, "BC-")
>
> Michael,
>
> ?Apparently grep works differently in R than it does on the command line:
>
> bf <- grep(ff, "BC-")
> Warning message:
> In grep(ff, "BC-") :
> ?argument 'pattern' has length > 1 and only the first element will be used
>
> ?I understand what you suggest but it does not appear to work for me.
>
> Thanks,
>
> Rich
>
> ______________________________________________
> 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.
>