0

I calculate many statistical analyses, such as Anova. The summary tables, and the posthoc test results are displayed on the console in R studio. My problem is that how can I export/print results from the Console to tabular format (e.g. xls) into my working directory folder on my PC? On the console, all calculation data are displayed in tabular format(-like) arrangement.

I have tried the code:

str(theSCRIPTforMYRESULTSontheCONSOLE)
sink("theSCRIPTforMYRESULTSontheCONSOLE.xls")
print(theSCRIPTforMYRESULTSontheCONSOLE$"ANYpartINmyRESULTS")
sink()

which works , however, very accidentally...

May I define a dataframe first? And then export?

MrFlick
  • 195,160
  • 17
  • 277
  • 295
  • Perhaps you would be interested in the `broom::tidy()`. It depends on what exactly you need in the output. It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. – MrFlick Feb 12 '20 at 16:11
  • There are R packages like openxlsx that allow you to write R data.frames into excel files. – quarague Feb 12 '20 at 16:15
  • MrFlick and Quarague22: thank you for your answers. I heard about openxlsx. However, my problem, now I can more clearly define, is that how can I export console data (resulted by an analysis), which is NOT data.frame (can be seen only on the console). Eq. results an anova, or posthoc test displayed the console only. I know the easiest way is ctrl C and ctrl v, but I want to do it using a script. – Imre Majláth Feb 13 '20 at 14:35

0 Answers0