search for: learnfn

Displaying 1 result from an estimated 1 matches for "learnfn".

Did you mean: learn
2010 Dec 24
3
Passing a data frame or matrix and working with a column of the data frame or matrix
I am trying to learn more about how to write functions. I would like to pass a data frame (or matrix) and depending on the parameters passed to the function work with a given column of the data frame or matrix. My function, learnfn is given below as are two calls to the function. The first call is an attempt to print the x column from the data frame, the second call is an attempt to print the y column. I hope someone can modify my function so it works. Thank you, John # create data frame x<-1:10 y <- x+rnorm(10) z &l...