[R] retrieve from function
Petr PIKAL
petr.pikal at precheza.cz
Mon Feb 22 07:59:30 CET 2010
Hi
r-help-bounces at r-project.org napsal dne 19.02.2010 19:06:52:
>
> Thank you for response. The problem is that using return(y1) in my
function
> formula always returns y1, but what I want is to return it only when I
wish,
> like p.value in
> t.test(rnorm(100),rnorm(100))$p.value
Put results in your function to list.
x=function(nbr){list(y<-rnorm(nbr), y1 <- mean(y);plot(y))}
x(whatever)$y
x(whatever)$y1
and when you do not want results immediately printed consult
?invisible
Regards
Petr
>
> robert
> --
> View this message in context:
http://n4.nabble.com/retrieve-from-function-
> tp1561972p1562012.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
More information about the R-help
mailing list