Skip to content
Prev 260539 / 398503 Next

'apply' with additional class variable

Hi Mark,

Is there a reason you cannot simply include the make of the car along
with all the other data?  Using your example:

cbind(as.data.frame(t(x)), carmake)

then instead of applying across columns, apply across rows, and have
your custom function decide what to do based on the column named
"carmake".  Alternately, if you will be dealing with the same makes of
cars a lot and are willing to do something a bit more involved, you
could consider defining custom classes for each car make, make your
function generic, and then create methods for it to match the
different car makes.

Cheers,

Josh
On Sat, May 21, 2011 at 11:23 AM, Mark Ebbert <Mark.Ebbert at hci.utah.edu> wrote: