Re: [R] an extremely simple question

From: milton ruser <milton.ruser_at_gmail.com>
Date: Tue, 22 Jul 2008 23:10:59 -0300

Hi Edna,

I am not sure the completely right answer, but I suspect that you use data(df) to invoke a data.frame from the sample datasets provided from the packages available on your R system. By other side, if you have a data.frame loaded on your environent, you can use "attach" do turn the columns available on your environment as objects, like this.

my.df<-data.frame(cbind(x=runif(100), y=rnorm(100))) head(my.df)

plot(y~x)
  #you get error

attach(my.df)
 plot(y~x)
  #you get the plot

detach(my.df) # remove the x,y objects from your environment  plot(y~x)
  #you get error again.

I hope this help.

Cheers,

miltinho astronauta
brazil

On 7/22/08, Edna Bell <edna.bell01_at_gmail.com> wrote:
>
> Hi!
>
> What is the difference between using data(somedataset) vs.
> attach(somedataset), please?
>
> thanks,
> Edna Bell
>
> ______________________________________________
> 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.
>

        [[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. Received on Wed 23 Jul 2008 - 02:18:34 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Jul 2008 - 01:32:33 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive