[R] Export Step Function Coefficients to Spreadsheet or Text File
Eric R
busorafn at juno.com
Thu Sep 13 23:21:10 CEST 2007
Hello,
After I use the lm() function to perform a multiple linear regression, and
then use the step function to eliminate variables that predict the weakest,
I need to export the final equation to a spreadsheet or a text file. Below
is some sample code. In the end I want to export the coefficients to a
spreadsheet. Will you please direct me to the appropriate syntax? Thanks for
your time, --Eric
x <- read.csv('C:/path/*.csv', comment.char = "", nrows = 99, header = TRUE,
row.names = 1)
w <- lm(d ~ x1 + x2 + x3 + x4 + 1)
step(w)
Coefficients:
(Intercept) x1 x2 x3 x4
4.834e-04 4.892e-01 4.698e-02 4.206e-05 -8.806e-03
write.csv(w, file = 'C:/path/*.csv', append = TRUE)
The error I get is:
Error in as.data.frame.default(x[[i]], optional = TRUE) :
cannot coerce class "lm" into a data.frame
--
View this message in context: http://www.nabble.com/Export-Step-Function-Coefficients-to-Spreadsheet-or-Text-File-tf4438516.html#a12663777
Sent from the R help mailing list archive at Nabble.com.
More information about the R-help
mailing list