I can'n solve one question. Want to write a function like this:
   f.describe <- function(.data, .var, .by)
   {
        require(plyr)
        res <- ddply(.data, .by, 
    summarize, 
    N = sum(!is.na(.var))
    `Mean (SD)`=sprintf("%5.2f (%5.2f)", 
                       mean(.var, na.rm=TRUE), sd=sd(.var, na.rm=TRUE)),
     Median = sprintf("%5.2f", median(.var))    
        )
    res
   }
But I can't find the way to pass a variable for processing (.var). Have this error:
Error eval(expr, envir, enclos) : object '.var' was not found (translated from other language, so it could be not verbatim for English users)
I tried eval, substitute but have no solution... Many thanks for help. Sometimes I do not understand the rules R uses for evaluation.
 
    