Le Vendredi 20 Avril 2007 11:23, vous avez écrit :
From: Vincent Goulet
Le Vendredi 20 Avril 2007 07:46, Julien Barnier a écrit :
Hi,
I have written a function which computes variance, sd,
r^2, R^2adj etc. But i am not able to return all of
them in return statement.
You
Dera R users,
I have written a function which computes variance, sd,
r^2, R^2adj etc. But i am not able to return all of
them in return statement.
So how to return more than one variable from
function. In C i used to return by pointers etc. is
there any way like that.
Thanks in advance.
use a 'list' as the return value containing the values you want returned.
x- function(){
.
list(val1=a, val2=b, val3=c)
}
On 4/20/07, vinod gullu [EMAIL PROTECTED] wrote:
Dera R users,
I have written a function which computes variance, sd,
r^2, R^2adj etc. But i am not able to return all
Hi,
I have written a function which computes variance, sd,
r^2, R^2adj etc. But i am not able to return all of
them in return statement.
You can return a vector, or a list.
For example :
func - function() {
...
result - list(variance=3, sd=sqrt(3))
return(result) # you can omit this
Le Vendredi 20 Avril 2007 07:46, Julien Barnier a écrit :
Hi,
I have written a function which computes variance, sd,
r^2, R^2adj etc. But i am not able to return all of
them in return statement.
You can return a vector, or a list.
For example :
func - function() {
...
result -
?list
- Original Message
From: vinod gullu [EMAIL PROTECTED]
To: r-help@stat.math.ethz.ch
Sent: Friday, April 20, 2007 5:00:45 PM
Subject: [R] How to return more than one variable from function
Dera R users,
I have written a function which computes variance, sd,
r^2, R^2adj etc. But i
From: Vincent Goulet
Le Vendredi 20 Avril 2007 07:46, Julien Barnier a écrit :
Hi,
I have written a function which computes variance, sd,
r^2, R^2adj etc. But i am not able to return all of
them in return statement.
You can return a vector, or a list.
For example :
func