Hi, On Wed, Jul 13, 2011 at 7:03 AM, UriB <uribl...@gmail.com> wrote: > Greg Snow-2 wrote: > "You are suffering from the fact that the longest distance between 2 points > is a shortcut. > > The df$column notation is a shortcut for df[[column]] that has some nice > properties, but the shortcut gets in the way when you want to do something > more structured. Try qq1[[z]]==y and avoid all that pasting, parsing, and > evaluating. " > > > My response: > Unfortunately I find it to be not correct and unfortunately I see no way to > avoid pasting parsing and evaluating in order > to have functions that does simple things in R. > > temp<-qq1[qq1$PrimaryConditionGroup=="AMI",] > has no error when > temp<-qq1[qq1[[PrimaryConditionGroup]]=="AMI",] cause the following error > announcement > > "Error in (function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]] else > .subset2(x, : > object 'PrimaryConditionGroup' not found"
Because it should be: temp<-qq1[qq1[["PrimaryConditionGroup"]]=="AMI",] PrimaryConditionGroup is a column name, not an R object. -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@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.