From: Sebastien Vauban <sva-news-D0wtAvR13HarG/iDocfnWg@public.gmane.org>
To: emacs-orgmode-mXXj517/zsQ@public.gmane.org
Subject: Re: Can't execute the introductory code: take table as input to produce mean
Date: Tue, 05 Aug 2014 11:52:48 +0200 [thread overview]
Message-ID: <86zjfj2rgv.fsf@somewhere.org> (raw)
In-Reply-To: CAJO5WKvfYyQ8ybU0NnWWM-gYt_uU+BFA-kunry8gPNfpt6N2cA@mail.gmail.com
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
next prev parent reply other threads:[~2014-08-05 9:52 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-08-05 6:48 Can't execute the introductory code: take table as input to produce mean jenia mtl
2014-08-05 9:52 ` Sebastien Vauban [this message]
-- strict thread matches above, loose matches on Subject: below --
2014-08-06 6:08 jenia.ivlev
2014-08-06 14:14 ` Sebastien Vauban
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=86zjfj2rgv.fsf@somewhere.org \
--to=sva-news-d0wtavr13harg/idocfnwg@public.gmane.org \
--cc=emacs-orgmode-mXXj517/zsQ@public.gmane.org \
/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).