[R] Best way to export values from a function?

jim holtman jholtman at gmail.com
Thu Jul 9 02:50:14 CEST 2009


You can return a list, vector, or any other object:  The last value is
the return value unless you do an explicit return()

On Wed, Jul 8, 2009 at 8:34 PM, Jason Rupert<jasonkrupert at yahoo.com> wrote:
>
> Maybe there is a great website out there or white paper that discusses this but again my Google skills (or lack there of) let me down.
>
> I would like to know the best way to export several doubles from a function, where the doubles are not an array.
>
> Here is a contrived function similar to my needs:
>
> multipleoutput<-function(x)
> {
>        squared<-x^2
>        cubed<-x^3
>        exponentioal<-exp(x)
>        factorialVal<-factorial(x)
>
> }
>
> Thanks again for all your help.
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem that you are trying to solve?




More information about the R-help mailing list