From mboxrd@z Thu Jan 1 00:00:00 1970 From: jenia mtl Subject: Can't execute the introductory code: take table as input to produce mean Date: Tue, 5 Aug 2014 02:48:50 -0400 Message-ID: Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=047d7b5d4f968b738a04ffdc3fb8 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:41420) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEYYH-0001ll-Ts for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 02:48:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEYYG-0002RO-MY for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 02:48:53 -0400 Received: from mail-wi0-x232.google.com ([2a00:1450:400c:c05::232]:40323) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEYYG-0002R6-Cy for emacs-orgmode@gnu.org; Tue, 05 Aug 2014 02:48:52 -0400 Received: by mail-wi0-f178.google.com with SMTP id hi2so702964wib.17 for ; Mon, 04 Aug 2014 23:48:50 -0700 (PDT) List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: emacs-orgmode@gnu.org --047d7b5d4f968b738a04ffdc3fb8 Content-Type: text/plain; charset=UTF-8 Hello: 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`. I tried to explicitly run the function R-mean(x) like so. #+call: R-mean(tbl-example-data) Unfortunately I get Reference 'R-mean' not found in this buffer How do I run the function R-mean using the vlaues from tbl-example-data? Thanks in advance. Jenia --047d7b5d4f968b738a04ffdc3fb8 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hello:

I want to learn babel-mode so I= 9;m going through http://orgmode.org/worg/org-contrib/babel/in= tro.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:

=C2=A0=C2=A0=C2=A0 #+name: tbl-exampl= e-data()
=C2=A0=C2=A0=C2=A0 #+begin_src R
=C2=A0=C2=A0=C2=A0 runif(n=3D5, min=3D= 0, max=3D1)
=C2=A0=C2=A0=C2=A0 #+end_src

=C2=A0=C2=A0=C2=A0 #+RES= ULTS: tbl-example-data
=C2=A0=C2=A0=C2=A0 |=C2=A0 0.607781215803698 | =C2=A0=C2=A0=C2=A0 |=C2=A0 0.157157169422135 |
=C2=A0=C2=A0=C2=A0 |=C2= =A0 0.675619817571715 |
=C2=A0=C2=A0=C2=A0 | 0.0488600700628012 |
=C2=A0=C2=A0=C2=A0 |=C2=A0 0.998780139256269 |

The next function is = the function to be executed:


=C2=A0=C2=A0=C2=A0 #+name: R-mean(x= )
=C2=A0=C2=A0=C2=A0 #+begin_src R
=C2=A0=C2=A0=C2=A0 mean(x)
=C2= =A0=C2=A0=C2=A0 #+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`.


I tried to explicitly run the function R-mean(= x) like so.

=C2=A0=C2=A0=C2=A0 #+call: R-mean(tbl-example-data)
<= br>Unfortunately I get

=C2=A0=C2=A0=C2=A0 Reference 'R-mean' not found in this buffer<= br>

How do I run the function R-mean using the vlaues from tbl-examp= le-data?

Thanks in advance.

Jenia
--047d7b5d4f968b738a04ffdc3fb8-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastien Vauban Subject: Re: Can't execute the introductory code: take table as input to produce mean Date: Tue, 05 Aug 2014 11:52:48 +0200 Message-ID: <86zjfj2rgv.fsf@somewhere.org> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org 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 From mboxrd@z Thu Jan 1 00:00:00 1970 From: jenia.ivlev@gmail.com (jenia.ivlev) Subject: Re: Can't execute the introductory code: take table as input to produce mean Date: Wed, 06 Aug 2014 02:08:58 -0400 Message-ID: <87d2cem9ol.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:40120) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEuVD-0004L3-3L for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 02:15:19 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1XEuV0-0005Vv-SO for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 02:15:11 -0400 Received: from plane.gmane.org ([80.91.229.3]:55051) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1XEuV0-0005Vj-KW for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 02:14:58 -0400 Received: from public by plane.gmane.org with local (Exim 4.69) (envelope-from ) id 1XEuUz-0006rX-2O for emacs-orgmode@gnu.org; Wed, 06 Aug 2014 08:14:57 +0200 List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: public-emacs-orgmode-mXXj517/zsQ@plane.gmane.org Its the first time I use this type of mail system. I connected here using gmane and gnus. I;m not sure how to answer the thread "Can't execute the introductory code: take table as input to produce mean". So i'll just try to answer the best way I can who means I'll answer to: emacs-orgmode-mXXj517/zsQ@public.gmane.org. Thanks Sebastien. Tell me though please, how do I define R-mean(x) to take any x? How do I run R-mean in the following form: R-mean(my-table1), R-mean(my-table2)... Cause here, it seems that R-mean is defined with the variable "x" hard-wired to a specific value, namely x=tbl-example-data. So again, how do I call R-mean with x=tbl-example-data2 lets say (without redefining R-mean)? Thanks in advance. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Sebastien Vauban Subject: Re: Can't execute the introductory code: take table as input to produce mean Date: Wed, 06 Aug 2014 16:14:14 +0200 Message-ID: <867g2logcp.fsf@somewhere.org> References: <87d2cem9ol.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain Return-path: List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org-mXXj517/zsQ@public.gmane.org To: emacs-orgmode-mXXj517/zsQ@public.gmane.org jenia.ivlev wrote: > Its the first time I use this type of mail system. I connected here > using gmane and gnus. I;m not sure how to answer the thread "Can't > execute the introductory code: take table as input to produce mean". > So i'll just try to answer the best way I can who means I'll answer to: > emacs-orgmode-0jIIvIziipk@public.gmane.org > > Thanks Sebastien. Tell me though please, how do I define R-mean(x) to > take any x? How do I run R-mean in the following form: > R-mean(my-table1), R-mean(my-table2)... > Cause here, it seems that R-mean is defined with the variable "x" > hard-wired to a specific value, namely x=tbl-example-data. Adding `:var x=something' serves 2 purposes: - Defining the `x' parameter (to the code block) - Setting its default value > So again, how do I call R-mean with x=tbl-example-data2 lets say > (without redefining R-mean)? #+call: R-mean(x=tbl-example-data2) Best regards, Seb -- Sebastien Vauban