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