[R] Howto convert Linear Regression data to text

B77S bps0002 at auburn.edu
Thu Aug 25 02:08:32 CEST 2011


If I understand you correctly, see ?paste

and the following to extract the values you require:

summary(res)[[4]][1] 

summary(res)[[4]][2]  

summary(res)[[8]]

HTH



ashz wrote:
> 
> Dear all,
> 
> How can I covert lm data to text in the form of "y=ax+b, r2" and how do I
> calculate R-squared(r2)?
> 
> Thanks. 
>  
> Code:
> x=18:29
> y=c(7.1,7,7.7,8.2,8.8,9.7,9.9,7.1,7.2,8.8,8.7,8.5)
> res=lm(y~x)
> 

--
View this message in context: http://r.789695.n4.nabble.com/Howto-convert-Linear-Regression-data-to-text-tp3766230p3767009.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list