I'm using org mode to write some R code. Somehow, the output I get inside my org file with C-c C-c differ from what I get when I run the same code from the command line. Consider for example the following excerpt:
#+begin_src R
month_no <- 1:12
attr(month_no, "names") <- month.name
month_no
#+end_src
The result in org-mode looks like
#+RESULTS:
| 1 |
| 2 |
| 3 |
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |
| 10 |
| 11 |
| 12 |
When run as a script from the command line (using Rscript.exe), the output is
January February March April May June July August
1 2 3 4 5 6 7 8
September October November December
9 10 11 12
The same happens when I use the interactive R command line (R.exe). So I get that org mode tries to format the result as a table, but it also omits the names. Is there a way to get the same output as from the command line, or at least preserve the names? I took a look at the Results of Evaluation documentation, but even :results value verbatim does omit the names, and just gives a list of values.
R, but I think this is (mostly) the difference of:results valueand:results output. Try the latter but you will have to change the last line of the script toprint(month_no)to get some output that Org Babel can display.month_noproduces the expanded form with:results output.:results outputworks, not sure why I didn't try this before... If you write it as an answer I'd be happy to accept :)