Re: [R] Selecting rows based on contents of string

2010-04-28 Thread David Winsemius
On Apr 28, 2010, at 3:07 AM, Albert-Jan Roskam wrote: Hi, There's probably an easier or more readable way to do it, but: df <- data.frame(cbind(letters, var= runif(26, 2, 3))) df[df$letters[grep("[G]", df$letters, ignore.case=TRUE)],] To my eyes that appears a bit redundant. Wouldn't this ap

Re: [R] Selecting rows based on contents of string

2010-04-28 Thread Albert-Jan Roskam
Hi,   There's probably an easier or more readable way to do it, but: df <- data.frame(cbind(letters, var= runif(26, 2, 3))) df[df$letters[grep("[G]", df$letters, ignore.case=TRUE)],] Cheers!! Albert-Jan ~~ All right, but apart fr

Re: [R] Selecting rows based on contents of string

2010-04-27 Thread Peter Alspach
Tena koe Alexis ?regexpr yourDataFrame[regexpr('G', yourDataFrame$Flags)>0,] HTH ... Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Alexis Champsaur > Sent: Wednesday, 28 April 2010 11:49 a.m. > To: r-h...@s