Try this:

sapply(names(result), function(nm)assign(nm, result[[nm]], envir = globalenv()))


On Fri, Sep 26, 2008 at 10:57 AM, Stefan Fritsch
<[EMAIL PROTECTED]> wrote:
> Dear R Users,
>
> another problem for me is the output of a function.
>
> I have several output variables which I give back with the list command.
>
> test <- function        {return(list(a,b,c,d,e,f,g,...))}
>
> After the usage of the function I want to assign the variables to the output 
> variables.
>
> result <- test()
>
> a <- result$a
> b <- result$b
> c <- result$c
> d <- result$d
> ...
>
> is there a more elegant way to assign these variables, without writing them 
> all down?
>
> thank you very much for your help!
>
> Stefan Fritsch
>
> ______________________________________________
> R-help@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.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

______________________________________________
R-help@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.

Reply via email to