[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [O] Can't execute the introductory code: take table as input to prod
From: |
Sebastien Vauban |
Subject: |
Re: [O] Can't execute the introductory code: take table as input to produce mean |
Date: |
Tue, 05 Aug 2014 11:52:48 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/24.3.92 (windows-nt) |
Hello jenia,
> I want to learn babel-mode so I'm going through
> http://orgmode.org/worg/org-contrib/babel/intro.html#source-code-blocks-org.
>
> I'm trying to execute the basic tutorial's script and for some reason can't
> do it.
>
> I'm suppose to feed a table as input to a function. This is the table:
>
> #+name: tbl-example-data()
> #+begin_src R
> runif(n=5, min=0, max=1)
> #+end_src
>
> #+RESULTS: tbl-example-data
> | 0.607781215803698 |
> | 0.157157169422135 |
> | 0.675619817571715 |
> | 0.0488600700628012 |
> | 0.998780139256269 |
>
> The next function is the function to be executed:
>
> #+name: R-mean(x)
> #+begin_src R
> mean(x)
> #+end_src
>
> When I try to run it by pressing `C-c C-c`
> I get `variable "x" in block "R-mean" must be assigned a default value`.
>
> How do I run the function R-mean using the vlaues from tbl-example-data?
Add a variable to your code block:
#+name: R-mean(x)
#+begin_src R :var x=tbl-example-data
mean(x)
#+end_src
Best regards,
Seb
--
Sebastien Vauban