[R] subset select within a function

juli g. pausas juli at ceam.es
Wed Jan 21 12:56:58 CET 2004


Dear all,
I'd like to subset a df within a function, and use select for choosing 
the variable. Something like (simplified example):

mydf <- data.frame(a= 0:9, b= 10:19)

ttt <- function(vv) {
  tmpdf <- subset(mydf, select= vv)
  mean(tmpdf$vv)
}

ttt(mydf$b)

But this is not the correct way. Any help?
Thanks in advance

Juli




More information about the R-help mailing list