Here are two ways:
with(iris, Sepal.Length + Sepal.Width)
attach(iris)
Species
On 4/6/06, Brian Quinif <bquinif at gmail.com>
wrote:> I have a question about how to reference variables in a dataframe.
>
> Normally, after I have read in some Stata data using the following command
> all <- read.dta('all.dta')
>
> Whenever I want to use the variable "sat.vr1" in the
"all" data frame,
> I do so using
>
> all$sat.vr1
>
> However, I'd like to be able to use the sat.vr1 variable without the
> "all$" (as well as all of the other variables of the dataframe).
>
> Is there some way to make a particular dataframe the "active" or
> "default" one so that a can do this?
>
> Thanks,
>
> Brian
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide!
http://www.R-project.org/posting-guide.html
>