Re: [R] Multi arguments - return

From: Gustave Lefou <gustave5000_at_gmail.com>
Date: Tue, 11 Mar 2008 18:57:59 +0100

Thank you for that quick responses

2008/3/11, markleeds_at_verizon.net <markleeds_at_verizon.net>:
>
> >From: Gustave Lefou <gustave5000_at_gmail.com>
> >Date: 2008/03/11 Tue PM 12:32:25 CDT
> >To: r-help_at_stat.math.ethz.ch
> >Subject: [R] Multi arguments - return
>
> if you're returning a list whose components
> are vectors, then to return the first one,
> you need to do result[[1]] and , to return
> the second one, you result[[2]].
>
> if you do result[1] or result[2] , you
> are returning the list itself rather
> than the components of that specific list. I find
> this very confusing myself but that's my
> interpretation. good luck
>
>
>
>
>
> >Hello,
> >
> >I wanted a function to have two vectors x,y as its output. I wrote
> >return(x,y) inside its definition. It worked but I got a warning : it is
> >obsolete to do like that.
> >
> >So I tried to put x,y in a list(x,y) and to return(list(x,y)). It worked.
> I
> >called the return of the function result. But result[1] is no longer a
> >vector and I need a vector. I tried as.numeric(result[1]) but it does not
> >work.
> >
> >How can I do ?
> >
> >Thank you very much.
> >
> > [[alternative HTML version deleted]]
> >
> >______________________________________________
> >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.
>
>

        [[alternative HTML version deleted]]



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. Received on Tue 11 Mar 2008 - 18:00:19 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 11 Mar 2008 - 18:30:21 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive