From ottk at bms.com  Mon Aug  4 23:11:53 2003
From: ottk at bms.com (ottk@bms.com)
Date: Mon Aug  4 22:11:43 2003
Subject: [Rd] unexpected behaviour in lm() (PR#3657)
Message-ID: <200308042011.h74KBrJH006556@pubhealth.ku.dk>

Full_Name: karl-heinz ott
Version: 1.6
OS: wds
Submission from: (NULL) (165.89.84.90)



R : Copyright 2002, The R Development Core Team
Version 1.6.1  (2002-11-01)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type `license()' or `licence()' for distribution details.

R is a collaborative project with many contributors.
Type `contributors()' for more information.

Type `demo()' for some demos, `help()' for on-line help, or
`help.start()' for a HTML browser interface to help.
Type `q()' to quit R.

> lm(c(1:10) ~ c(1:10))

Call:
lm(formula = c(1:10) ~ c(1:10))

Coefficients:
(Intercept)  
        5.5  

> lm(c(1:10)+1 ~ c(1:10))

Call:
lm(formula = c(1:10) + 1 ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          1            1  

> lm(c(1:10)+1-1 ~ c(1:10))

Call:
lm(formula = c(1:10) + 1 - 1 ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          0            1  

> lm(c(1:10)+0 ~ c(1:10))

Call:
lm(formula = c(1:10) + 0 ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          0            1  

> lm(c(1:10)+0 ~ c(1:10))

Call:
lm(formula = c(1:10) + 0 ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          0            1  

> lm(numeric(c(1:10)) ~ c(1:10))
Error in model.frame(formula, rownames, variables, varnames, extras, extranames,
 : 
        variable lengths differ
> lm(as.numeric(c(1:10)) ~ c(1:10))

Call:
lm(formula = as.numeric(c(1:10)) ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          0            1  

> lm(c(2:11)) ~ c(1:10))
Error: syntax error
> lm(c(2:11) ~ c(1:10))

Call:
lm(formula = c(2:11) ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          1            1  

> lm(c(2:11) ~ c(1:10))

Call:
lm(formula = c(2:11) ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          1            1  

> plot(c(2:11) ~ c(1:10))
> lm(c(1:10) ~ c(1:10))

Call:
lm(formula = c(1:10) ~ c(1:10))

Coefficients:
(Intercept)  
        5.5  

> lm(c(1:10)+0 ~ c(1:10))

Call:
lm(formula = c(1:10) + 0 ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          0            1  

> lm(c(1:10)+0 ~ c(1:10))

Call:
lm(formula = c(1:10) + 0 ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          0            1  

> lm(as.numeric(c(1:10)) ~ c(1:10))

Call:
lm(formula = as.numeric(c(1:10)) ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          0            1  

> lm(as.numeric(c(1:10)) ~ c(1:10))

Call:
lm(formula = as.numeric(c(1:10)) ~ c(1:10))

Coefficients:
(Intercept)      c(1:10)  
          0            1  

>


[Rd] unexpected behaviour in lm() (PR#3657)
ottk@bms.com