Try test.fn <- function(obj.name, var.name="q2"){
stopifnot( is.character(obj.name) & is.character(var.name) ) x <- subset( get(obj), select=var.name ) table(x) } On Fri, 2006-03-31 at 12:44 +0300, Adrian DUSA wrote: > Hello all, > > I'd like to create a function which would do some analysis on a particular > object, which should be specified in advance. Something like: > > > ls() > [1] "aa" "bb" "cc" > > Object <- "bb" > var.name <- "q2" > testfunction <- function(obj.name, var.name) { > temp <- give.me.the.object.called(Object) > table(temp[, var.name]) > } > > This should perfom the same thing as: > table(bb$q2) > > Is this possible? > TIA, > Adrian > ______________________________________________ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html