emacs-orgmode@gnu.org archives
 help / color / mirror / code / Atom feed
* orgmode and R?
@ 2015-08-03 16:51 Jude DaShiell
  2015-08-03 17:58 ` John Kitchin
  2015-08-03 19:47 ` Allen S. Rout
  0 siblings, 2 replies; 6+ messages in thread
From: Jude DaShiell @ 2015-08-03 16:51 UTC (permalink / raw)
  To: emacs-orgmode

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.



--

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: orgmode and R?
  2015-08-03 16:51 orgmode and R? Jude DaShiell
@ 2015-08-03 17:58 ` John Kitchin
  2015-08-03 19:47 ` Allen S. Rout
  1 sibling, 0 replies; 6+ messages in thread
From: John Kitchin @ 2015-08-03 17:58 UTC (permalink / raw)
  To: Jude DaShiell; +Cc: emacs-orgmode

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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: orgmode and R?
  2015-08-03 16:51 orgmode and R? Jude DaShiell
  2015-08-03 17:58 ` John Kitchin
@ 2015-08-03 19:47 ` Allen S. Rout
  2015-08-03 20:05   ` John Kitchin
  1 sibling, 1 reply; 6+ messages in thread
From: Allen S. Rout @ 2015-08-03 19:47 UTC (permalink / raw)
  To: emacs-orgmode

On 08/03/2015 12:51 PM, Jude DaShiell wrote:
> 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.
> 

Yes.

http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html

is the first hit on "org-mode R" from google.

There is extensive art on the topic.


- Allen S. Rout

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: orgmode and R?
  2015-08-03 19:47 ` Allen S. Rout
@ 2015-08-03 20:05   ` John Kitchin
  2015-08-03 20:08     ` Cook, Malcolm
  0 siblings, 1 reply; 6+ messages in thread
From: John Kitchin @ 2015-08-03 20:05 UTC (permalink / raw)
  To: Allen S. Rout; +Cc: emacs-orgmode

I think the question was about using R in table formulas, not just using
R in src-block.

As far as I know it is possible to use emacs-lisp pretty directly, but
not other languages in the table formulas.

Allen S. Rout writes:

> On 08/03/2015 12:51 PM, Jude DaShiell wrote:
>> 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.
>>
>
> Yes.
>
> http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html
>
> is the first hit on "org-mode R" from google.
>
> There is extensive art on the topic.
>
>
> - Allen S. Rout

--
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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: orgmode and R?
  2015-08-03 20:05   ` John Kitchin
@ 2015-08-03 20:08     ` Cook, Malcolm
  2015-08-03 20:29       ` Thomas S. Dye
  0 siblings, 1 reply; 6+ messages in thread
From: Cook, Malcolm @ 2015-08-03 20:08 UTC (permalink / raw)
  To: 'John Kitchin', Allen S. Rout; +Cc: emacs-orgmode@gnu.org

It is possible to send a org table to R as a data.frame, which could edit it, add columns, and produce a new data.frame which, with :results value, will be understood by org as an table.


> -----Original Message-----
> From: emacs-orgmode-bounces+mec=stowers.org@gnu.org [mailto:emacs-
> orgmode-bounces+mec=stowers.org@gnu.org] On Behalf Of John Kitchin
> Sent: Monday, August 03, 2015 3:06 PM
> To: Allen S. Rout <asr@ufl.edu>
> Cc: emacs-orgmode@gnu.org
> Subject: Re: [O] orgmode and R?
> 
> I think the question was about using R in table formulas, not just using R in
> src-block.
> 
> As far as I know it is possible to use emacs-lisp pretty directly, but not other
> languages in the table formulas.
> 
> Allen S. Rout writes:
> 
> > On 08/03/2015 12:51 PM, Jude DaShiell wrote:
> >> 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.
> >>
> >
> > Yes.
> >
> > http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html
> >
> > is the first hit on "org-mode R" from google.
> >
> > There is extensive art on the topic.
> >
> >
> > - Allen S. Rout
> 
> --
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: orgmode and R?
  2015-08-03 20:08     ` Cook, Malcolm
@ 2015-08-03 20:29       ` Thomas S. Dye
  0 siblings, 0 replies; 6+ messages in thread
From: Thomas S. Dye @ 2015-08-03 20:29 UTC (permalink / raw)
  To: Cook, Malcolm
  Cc: emacs-orgmode@gnu.org, Allen S. Rout, 'John Kitchin'

Yes, certainly.

#+name: eg
| a | b |
| c | d |

#+name: table-eg
#+begin_src R :var table=eg
print(table[,1])
#+end_src

#+results: table-eg
| a |
| c |

hth,
Tom

Cook, Malcolm <MEC@stowers.org> writes:

> It is possible to send a org table to R as a data.frame, which could edit it, add columns, and produce a new data.frame which, with :results value, will be understood by org as an table.
>
>
>> -----Original Message-----
>> From: emacs-orgmode-bounces+mec=stowers.org@gnu.org [mailto:emacs-
>> orgmode-bounces+mec=stowers.org@gnu.org] On Behalf Of John Kitchin
>> Sent: Monday, August 03, 2015 3:06 PM
>> To: Allen S. Rout <asr@ufl.edu>
>> Cc: emacs-orgmode@gnu.org
>> Subject: Re: [O] orgmode and R?
>> 
>> I think the question was about using R in table formulas, not just using R in
>> src-block.
>> 
>> As far as I know it is possible to use emacs-lisp pretty directly, but not other
>> languages in the table formulas.
>> 
>> Allen S. Rout writes:
>> 
>> > On 08/03/2015 12:51 PM, Jude DaShiell wrote:
>> >> 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.
>> >>
>> >
>> > Yes.
>> >
>> > http://orgmode.org/worg/org-contrib/babel/languages/ob-doc-R.html
>> >
>> > is the first hit on "org-mode R" from google.
>> >
>> > There is extensive art on the topic.
>> >
>> >
>> > - Allen S. Rout
>> 
>> --
>> 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

-- 
Thomas S. Dye
http://www.tsdye.com

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2015-08-03 20:30 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-03 16:51 orgmode and R? Jude DaShiell
2015-08-03 17:58 ` John Kitchin
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

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).