[R] Help with functions - printing a variables name
Evan Kransdorf
evan.kransdorf at gmail.com
Tue Oct 14 20:12:48 CEST 2014
Hello Everyone,
I was wondering if someone could help me implement a function in R.
I want to pass a vector x to my function, peform some math, then output the
data. However, I want the output for x to be the *name of the vector
I am *using
as input.
For example, data<-c(1,5,10)
> func1<-function(x) {
y<-x^2
z<-x^3
out<-cbind(x,y,z)
return(out)
} #function
Desired output:
data, 1, 1
data, 25, 125
data, 100, 1000
Thanks very much for your help, Evan
[[alternative HTML version deleted]]
More information about the R-help
mailing list