2.7 KiB
rorg — R and org-mode
- Objectives
- tasks
- buffer dictionary
Please feel free to change the layout of this file, I'm just putting this here to get things started.
Objectives
Import data into R from org
Org-mode includes orgtbl-mode, an extremely convenient way of using tabular data in a plain text file. Currently, spreadsheet functionality is available in org tables using the emacs package calc. It would be a boon both to org users and R users to allow org tables to be manipulated with the R programming language. Org tables give R users an easy way to enter and display data; R gives org users a powerful way to perform vector operations, statistical tests, and visualization on their tables.
Implementations
naive
Naive implementation would be to use (org-export-table "tmp.csv")
and (ess-exec "read.csv('tmp.csv')")
.
org-R
org-exp-blocks
RweaveOrg
NA
Editing R code using r-mode from an org buffer
Org has an extremely useful method of editing source code and examples in their native modes. In the case of R code, we want to be able to use the full functionality of ESS mode, including interactive evaluation of code.
Implementations
Org
#+BEGIN_SRC r
,## hit C-c ' within this block to enter a temporary buffer in r-mode.
,## while in the temporary buffer, hit C-c C-c on this comment to
,## evaluate this block
a <- 3
a
,## hit C-c ' to exit the temporary buffer
#+END_SRC
Org-R
NA
org-exp-blocks
NA
RweaveOrg
See org-sweave.el and export_testing.R
evaluate R code and make the output available for processing in an org buffer
evaluate R code and format the output for export
Special editing and evaluation of source code in R blocks. Unfortunately org-mode how two different block types. Source code blocks which look like the following allow for the special editing of code inside of the block through `org-edit-special'.
dblocks, which look like the following allow for evaluation of the
code inside of the block by calling \C-c\C-c
on the header of the
block. This is handy, as org-mode will automatically call
`org-dblock-write:dblock-type' where dblock-type is the string
following the #+BEGIN:
portion of the line.
Note that upper and lower case are not relevant in block headings.
I'm leaning towards using the #+begin_src
blocks, as that is really
what these blocks contain is source code.
tasks
buffer dictionary
LocalWords: DBlocks dblocks