I found a way to save R output into spreadsheets like Excel/Calc etc. R creates output as in lists when we perform regression. For example
> summary(s.manova)
Df Pillai approx F num Df den Df Pr(>F)
sc$gender 1 0.055830 0.43363 3 22 0.7311
sc$age 1 0.157079 1.36657 3 22 0.2790
sc$emp_level 1 0.099559 0.81082 3 22 0.5015
sc$salary 1 0.048873 0.37682 3 22 0.7706
sc$family 1 0.032379 0.24539 3 22 0.8637
Residuals 24
> typeof(summary(s.manova))
[1] "list"
So if you observe the output it is a list. It might not be possible to export this chunk of output strait away as in the form of table in case if we are interested to use this output in reports. Usually in report we might have to put the results in the form of nice looking tables. But R could not create tables with vertical and horizontal lines separating cell wise values.
Do as below, in case if you are interested in converting such lists into nice looking tables with rows and columns for Word or Writer.
> write.csv(as.matrix(unlist(summary(s.manova)$stats)), "......./manova.ods")
In the above code "......./manova.ods" refers to your path to save the output with a name "manova.ods". Now it is possible to open the output file with the help of Libre Office Calc and edit the table as you like.
This method has one limitation that is we got to execute this step each time when we save table. That is next time if we are interested to save other table you got to repeat the same step but you may lose the previous table.
I will try to find solution as how to preserve all the output as in distinct tables in same spreadsheet next time.
> summary(s.manova)
Df Pillai approx F num Df den Df Pr(>F)
sc$gender 1 0.055830 0.43363 3 22 0.7311
sc$age 1 0.157079 1.36657 3 22 0.2790
sc$emp_level 1 0.099559 0.81082 3 22 0.5015
sc$salary 1 0.048873 0.37682 3 22 0.7706
sc$family 1 0.032379 0.24539 3 22 0.8637
Residuals 24
> typeof(summary(s.manova))
[1] "list"
So if you observe the output it is a list. It might not be possible to export this chunk of output strait away as in the form of table in case if we are interested to use this output in reports. Usually in report we might have to put the results in the form of nice looking tables. But R could not create tables with vertical and horizontal lines separating cell wise values.
Do as below, in case if you are interested in converting such lists into nice looking tables with rows and columns for Word or Writer.
> write.csv(as.matrix(unlist(summary(s.manova)$stats)), "......./manova.ods")
In the above code "......./manova.ods" refers to your path to save the output with a name "manova.ods". Now it is possible to open the output file with the help of Libre Office Calc and edit the table as you like.
This method has one limitation that is we got to execute this step each time when we save table. That is next time if we are interested to save other table you got to repeat the same step but you may lose the previous table.
I will try to find solution as how to preserve all the output as in distinct tables in same spreadsheet next time.
No comments:
Post a Comment