From mboxrd@z Thu Jan 1 00:00:00 1970 From: Dan Davison Subject: Re: [babel] multiple result outputs from function Date: Tue, 16 Mar 2010 14:35:08 -0400 Message-ID: <87mxy8nmhv.fsf@stats.ox.ac.uk> References: <2c75873c1003161126r36c5e2c0kfa3f3540bf9ec7cf@mail.gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Nrbbu-00007y-Fg for emacs-orgmode@gnu.org; Tue, 16 Mar 2010 14:35:22 -0400 Received: from [140.186.70.92] (port=33615 helo=eggs.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Nrbbs-000068-0H for emacs-orgmode@gnu.org; Tue, 16 Mar 2010 14:35:21 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.69) (envelope-from ) id 1Nrbbo-0006H6-9P for emacs-orgmode@gnu.org; Tue, 16 Mar 2010 14:35:17 -0400 Received: from markov.stats.ox.ac.uk ([163.1.210.1]:45467) by eggs.gnu.org with esmtp (Exim 4.69) (envelope-from ) id 1Nrbbo-0006Gz-15 for emacs-orgmode@gnu.org; Tue, 16 Mar 2010 14:35:16 -0400 In-Reply-To: <2c75873c1003161126r36c5e2c0kfa3f3540bf9ec7cf@mail.gmail.com> (Graham Smith's message of "Tue, 16 Mar 2010 18:26:44 +0000") List-Id: "General discussions about Org-mode." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org Errors-To: emacs-orgmode-bounces+geo-emacs-orgmode=m.gmane.org@gnu.org To: Graham Smith Cc: emacs-orgmode@gnu.org Graham Smith writes: > Below is a function that I am trying to run in orgmode/babel. > > It seems to run OK, but instead of printing out three values, its only > printing the final result. > > Once again, i would appreciate some help with what I am missing. Hi Graham, Use ':results output' to get the printed output. The default mode is ':results value' which returns the value of the last expression in the block. #+srcname: CI_function #+begin_src R :session daf summary.ci<-function(x){ print ("value 1") print ("value 2") print ("value 3") } #+end_src #+begin_src R :session daf :results output summary.ci() #+end_src #+results: : [1] "value 1" : [1] "value 2" : [1] "value 3" #+begin_src R :session daf summary.ci() #+end_src #+results: : value 3 Dan > > Thanks, > > Graham > > > #+srcname: CI_function > #+begin_src R :session daf > summary.ci<-function(x){ > xbar<-mean(x) > sigma<-sd(x) > n<-length(x) > sem<-sigma/sqrt(n) > lower.ci<-xbar+sem*qnorm(0.025) > upper.ci<-xbar+sem*qnorm(0.975) > print (xbar) > print (lower.ci) > print (upper.ci) > } > #+end_src > > #+srcname: SumFlowering2005 > #+begin_src R :session daf > summary.ci(daf$Flower[daf$YEAR=="2005"]) > #+end_src > > #+results: SumFlowering2005 > : 1.97860201016947 > > > _______________________________________________ > 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