I would like to use grep to return all the lines of a data frame that do not contain the letters HD. I have tried the ^ inside brackets as well as !. The data frame is one column consisting of spaces,numbers, and letters with several thousand rows. Thank you! Colton [[alternative HTML version deleted]]
Colton -
Have you looked at the invert= argument of grep()?
(In regular expressions, ^ means "beginning of string",
and ! has no special meaning.)
- Phil Spector
Statistical Computing Facility
Department of Statistics
UC Berkeley
spector at stat.berkeley.edu
On Mon, 28 Jun 2010, Colton Hunt wrote:
> I would like to use grep to return all the lines of a data frame that do
not
> contain the letters HD. I have tried the ^ inside brackets as well as !.
The
> data frame is one column consisting of spaces,numbers, and letters with
> several thousand rows.
> Thank you!
> Colton
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> 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.
>
Giving a reproducible example would likely lead to a solution quickly. Colton Hunt wrote:> I would like to use grep to return all the lines of a data frame that do not > contain the letters HD. I have tried the ^ inside brackets as well as !. The > data frame is one column consisting of spaces,numbers, and letters with > several thousand rows. > Thank you! > Colton > > [[alternative HTML version deleted]] > > ______________________________________________ > 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.