emacs-orgmode
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [O] orgmode and R?


From: John Kitchin
Subject: Re: [O] orgmode and R?
Date: Mon, 03 Aug 2015 13:58:58 -0400

I don't know much about R, but here is a hack to do somthing like this
with python. I have not tested it beyond what you see here.

You can use emacs lisp in an org-mode spreadsheet as a formula. We will hack 
that to let us use Python. We will do that by making a lisp function that 
evaluates a python string and returns the results.

| x | y |    |
|---+---+----|
| 1 | 2 |  3 |
| 2 | 4 |  6 |
| 3 | 6 | 18 |
|---+---+----|
|   |   |    |
#+TBLFM: @address@hidden + @2$2
#+TBLFM: @3$3='(+ @3$1 @3$2);N
#+TBLFM: @4$3='(python "@4$1 * @4$2");N

#+BEGIN_SRC emacs-lisp
(defun python (string)
  "Send string to a python interpreter and return result."
  (python-shell-send-string-no-output
    string
    (or (python-shell-get-process)
        (run-python))))
#+END_SRC




Jude DaShiell writes:

> Can the orgmode spreadsheet access R either directly or indirectly through
> maybe babel?  If this is possible, do any tutorials exist with some worked
> examples?  I have R and emacs-R-mode installed so I can access R from
> emacs at least.

--
Professor John Kitchin
Doherty Hall A207F
Department of Chemical Engineering
Carnegie Mellon University
Pittsburgh, PA 15213
412-268-7803
@johnkitchin
http://kitchingroup.cheme.cmu.edu



reply via email to

[Prev in Thread] Current Thread [Next in Thread]