[R] Removing description from lm()

billy am wickedpuppy at gmail.com
Sun Oct 5 13:21:38 CEST 2014


Hi ,

When I run the following code , I get both the description and the value ,
eg : Intercept and 0.5714286.

Is there a way to extract just the value 0.5714286? Thanks!


> x <- c(1,5,3,1)> y <- c(5,8,2,3)> lm(x~y)
Call:
lm(formula = x ~ y)

Coefficients:
(Intercept)            y
     0.5714       0.4286
> lm(x~y)$coefficient[1](Intercept)
  0.5714286


>

Regards
Billy

	[[alternative HTML version deleted]]



More information about the R-help mailing list