Re: [R] Using 'field names' of a data.frame in a function

2009-08-06 Thread Henrique Dallazuanna
Try this: myfunc <- function(...)table(...) with(mydataset, myfunc(ages, sex)) On Thu, Aug 6, 2009 at 4:50 PM, Polwart Calum (County Durham and Darlington NHS Foundation Trust) wrote: > I may be doing this wrong! but I have a function which I have simplified a > lot below. I want to pass some

[R] Using 'field names' of a data.frame in a function

2009-08-06 Thread Polwart Calum (County Durham and Darlington NHS Foundation Trust)
I may be doing this wrong! but I have a function which I have simplified a lot below. I want to pass some 'field names' of a data-frame to the function for it to then do some manipulation of. Here's my code: #build a simple dataset mydataset = data.frame ( ages=c('40-49','40-49','40-49','30-