Re: [R] Using a function with apply Error: undefined columns selected

2016-04-07 Thread David Winsemius
> On Apr 7, 2016, at 3:39 PM, John Sorkin wrote: > > I am trying to write a function that can be used to apply to process all the > columns of a data.frame. If you will run the code below, you will get the > error message undefined columns selected. I hope someone will be able to > teach me w

Re: [R] Using a function with apply Error: undefined columns selected

2016-04-07 Thread Jim Lemon
Hi John, First, apply isn't guaranteed to work on data frames. There are two easy ways to do something like this, but we had better have a data frame: guppy<-data.frame(taste=rnorm(10,5), crunch=rnorm(10,5),satiety=rnorm(10,5)) If you just want to apply a function to all or a subset of columns o