Graham Smith <myotis...@gmail.com> writes:

> I know I must be missing the obvious here, but why can't I get babel+R
> to calculate a mean. See below


>
> Many thanks,
>
> Graham
>
> * test
> #+srcname:trial
> #+begin_src R
> x<-c(4,5,6,7,8,9)
> #+end_src
>
> #+resname: trial
> | 4 |
> | 5 |
> | 6 |
> | 7 |
> | 8 |
> | 9 |
>
>
> * meantest
> #+begin_src R
> mean(trial)
> #+end_src

Hi Graham,

Here's a version of your example that works.

Dan


* test
#+srcname:trial
#+begin_src R
c(4,5,6,7,8,9)
#+end_src

Note I deleted the 'x <-' there. Unless you're using :session there's
no point assigning to a variable which is not used.

#+results: trial
| 4 |
| 5 |
| 6 |
| 7 |
| 8 |
| 9 |

* meantest
#+srcname: calcmean(data=trial)
#+begin_src R
mean(data)
#+end_src

#+results: calcmean
: 6.5

or alternative syntax

#+begin_src R :var data=trial
mean(data)
#+end_src

#+results:
: 6.5



>
> #+resname:
>
> error in buffer "source block produced no output"
>
> * meantest2
> #+begin_src R
> mean(x)
> #+end_src
>
> #+resname:
>
> error in buffer "source block produced no output"
>
>
> _______________________________________________
> Emacs-orgmode mailing list
> Please use `Reply All' to send replies to the list.
> Emacs-orgmode@gnu.org
> http://lists.gnu.org/mailman/listinfo/emacs-orgmode


_______________________________________________
Emacs-orgmode mailing list
Please use `Reply All' to send replies to the list.
Emacs-orgmode@gnu.org
http://lists.gnu.org/mailman/listinfo/emacs-orgmode

Reply via email to