emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
From: John Kitchin <jkitchin@andrew.cmu.edu>
To: Jude DaShiell <jdashiel@panix.com>
Cc: emacs-orgmode@gnu.org
Subject: Re: orgmode and R?
Date: Mon, 03 Aug 2015 13:58:58 -0400	[thread overview]
Message-ID: <m28u9s8d99.fsf@andrew.cmu.edu> (raw)
In-Reply-To: <alpine.NEB.2.11.1508031247410.20444@panix2.panix.com>

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: @2$3=@2$1 + @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	other threads:[~2015-08-03 17:59 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-03 16:51 orgmode and R? Jude DaShiell
2015-08-03 17:58 ` John Kitchin [this message]
2015-08-03 19:47 ` Allen S. Rout
2015-08-03 20:05   ` John Kitchin
2015-08-03 20:08     ` Cook, Malcolm
2015-08-03 20:29       ` Thomas S. Dye

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://www.orgmode.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m28u9s8d99.fsf@andrew.cmu.edu \
    --to=jkitchin@andrew.cmu.edu \
    --cc=emacs-orgmode@gnu.org \
    --cc=jdashiel@panix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).