[R] name scoping within dataframe index

Gabor Grothendieck ggrothendieck at gmail.com
Mon Jan 26 19:58:29 CET 2009


Try:

subset(df, colname == value)

On Mon, Jan 26, 2009 at 1:46 PM, Alexy Khrabrov <deliverable at gmail.com> wrote:
> Every time I have to prefix a dataframe column inside the indexing brackets
> with the dataframe name, e.g.
>
> df[df$colname==value,]
>
> -- I am wondering, why isn't there an R scoping rule that search starts with
> the dataframe names, as if we'd said
>
> with(df, df[colname==value,])
>
> -- wouldn't that be a reasonable default to prepend to the name search path?
>
> Cheers,
> Alexy
>
> ______________________________________________
> 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.
>




More information about the R-help mailing list