Skip to content

about lm

10 messages · Sonia Amin, Rui Barradas, Bert Gunter +4 more

#
Hello,

1. Don't call your dataset 'data', it's the name of an R function.
2. Imagine it's called 'dat'. Then you must use the lm() argument data = 
dat. Like this:

lm(ve~ su, data = dat)


Hope this helps,

Rui Barradas
Em 16-11-2012 19:42, Sonia Amin escreveu:
#
I quote Rolf Turner:

"Learn something about R; don't just hammer and hope.  Read the
introductory manuals and scan the FAQ."

The answer is that your data are in "data," but until you make a
greater effort to learn R, I'm not sure this will be helpful to you.

Cheers,
Bert
On Fri, Nov 16, 2012 at 11:42 AM, Sonia Amin <soniaamin5 at gmail.com> wrote:

  
    
#
On 16-11-2012, at 20:42, Sonia Amin wrote:

            
Your ve and su are in the dataframe "data". (Don't use data as name for R objects; it is a builtin function).
They are not in the environment from which lm is called (in this case probably the  global environment).

You haven't specified that ve and su are in dataframe "data".
So 

?lm

and look at the description of the "data" argument in the section "Arguments".

lm(ve~su, data=data)

should work.

Berend
#
On Sat, Nov 17, 2012 at 12:29 PM, FJ M <chicagobrownblue at hotmail.com> wrote:
Ahh! Two at once! Why -- for the love of god, why!

:-P

M
#
On Nov 17, 2012, at 4:29 AM, FJ M wrote:

            
It is generally less error prone to avoid attach (even once).
And instead use:

lm.1<-lm(ve~ su, data=dat)
When you do get around to reading the Posting Guide, please note the  
section where the request to NOT post in HTML is made.

  
    
#
On Sat, Nov 17, 2012 at 4:56 PM, FJ M <chicagobrownblue at hotmail.com> wrote:
No -- it's not broken, but it is dangerous (or more properly,
confusing). It has non-local effects by creating a whole bunch of
variables in the search path all at once. Combine that with the fact
that those new variables can't be written to and an apparent
sub/re-assignment really only creates global-environment copies (also
somewhat magically) and you have a recipe for confusion.

It's of course actually very important to the workings of R -- it's
key to package loading, inter alia -- but in my alternate universe,
it'd be hidden away, or at least start with a dot so it looks scarier.

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

            
???. '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.)
David Winsemius, MD
Alameda, CA, USA