[R] assign variables to function output

Sergio Fonda sergio.fonda99 at gmail.com
Thu Apr 16 17:31:11 CEST 2015


That's it ! Sorry for writing in a hurry, Merm!
Il 16/apr/2015 14:14, "Jim Lemon" <drjimlemon at gmail.com> ha scritto:

> Hi merm,
> In case Sergio's message is a little cryptic:
>
> return_a_list<-function() {
>  a<-"First item of list"
>  b<-c(2,4,6,8)
>  c<-matrix(1:9,nrow=3)
>  return(list(a,b,c))
> }
>
> x<-return_a_list()
> x
>
> Jim
>
> On Thu, Apr 16, 2015 at 7:21 PM, Sergio Fonda <sergio.fonda99 at gmail.com>
> wrote:
> > Collect in a vector or dataframe or list the variables of interest and
> > output it.
> > Il 16/apr/2015 10:57, "merm" <pionescu at student.unimelb.edu.au> ha
> scritto:
> >
> >> Hi!
> >>
> >> So I'm trying as the header suggests to assign the value(s) output by a
> >> function to a variable, say 'y'
> >>
> >> Problem is from what I gather any variables introduced within the
> function
> >> are contained and the only output I can get is "return(value)" which is
> >> awkward to work with. Any suggestions?
> >>
> >> Cheers!
> >>
> >>
> >>
> >> --
> >> View this message in context:
> >>
> http://r.789695.n4.nabble.com/assign-variables-to-function-output-tp4705920.html
> >> Sent from the R help mailing list archive at Nabble.com.
> >>
> >> ______________________________________________
> >> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> >> 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.
> >>
> >
> >         [[alternative HTML version deleted]]
> >
> > ______________________________________________
> > R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

	[[alternative HTML version deleted]]



More information about the R-help mailing list