On Nov 17, 2012, at 8:56 AM, FJ M wrote:

attach(attach(dat))

should be

attach(dat)

Is attach() broken? I've been using attach() successfully for months. I was surprised that header=TRUE did not map the headers to the data.

???. 'header=TRUE' changes how read.table() and derivatives handle the first line of a input file. You may be expressing surprise that the the names of list elements are not in the search path. (Dataframes are lists.)


But since attach() worked, I've never asked for an enhancement to the various read functions.

Thanks,

Frank


> CC: soniaam...@gmail.com; r-help@r-project.org
> From: dwinsem...@comcast.net
> To: chicagobrownb...@hotmail.com
> Subject: Re: [R] about lm
> Date: Sat, 17 Nov 2012 08:31:01 -0800
>
>
> On Nov 17, 2012, at 4:29 AM, FJ M wrote:
>
> >
> > dat=read.csv("c:\\ven.csv",header=TRUE,sep=";");
> > attach(attach(dat))
>
> It is generally less error prone to avoid attach (even once).
> > dat
> > lm.1<-lm(ve~ su)
>
> And instead use:
>
> lm.1<-lm(ve~ su, data=dat)
>
> > summary(lm.1)
> >
> > GL Frank
> >> Date: Fri, 16 Nov 2012 20:42:39 +0100
> >> From: soniaam...@gmail.com
> >> To: r-help@r-project.org
> >> Subject: [R] about lm
> >>
> >> Dear friends,
> >> I have a csv file entitled ven.csv located in C:\\, this file
> >> contains only
> >> two columns:"ve" and "su" I have written the following lines:
> >> data=read.csv("c:\\ven.csv",header=TRUE,sep=";");
> >>
> >> lm(ve~ su)
> >> I have obtained the following message:
> >>
> >> Error in eval(expr, envir, enclos) : object 've' does not exist.
> >> What's the
> >> problem? thank you for your help in advance
> >>
> >> [[alternative HTML version deleted]]
> >>
>
> When you do get around to reading the Posting Guide, please note the
> section where the request to NOT post in HTML is made.
>
> > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
>
> --
> David Winsemius, MD
> Alameda, CA, USA
>

David Winsemius, MD
Alameda, CA, USA

______________________________________________
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.

Reply via email to