[R] Re turning variable names with variables (in a function)

2008-05-08 Thread Stropharia
Dear R Users, I have written a function that returns 4 variables. I would like to have the variables returned with their variable names, is this possible? - R Code - mc.error - function(T, p=0.05){ se - sqrt((p)*(1-(p))/T) # standard

Re: [R] Re turning variable names with variables (in a function)

2008-05-08 Thread Shubha Vishwanath Karanth
-project.org Subject: [R] Re turning variable names with variables (in a function) Dear R Users, I have written a function that returns 4 variables. I would like to have the variables returned with their variable names, is this possible? - R Code

Re: [R] Re turning variable names with variables (in a function)

2008-05-08 Thread Ian Fiske
You want to set the names attribute of your results vector. You can do this with the names() function (see ?names). Specifically, you might use something like this: results - c(se, upper, lower, cv) names(results) - c(se, upper, lower, cv) Good luck, Ian Stropharia wrote: