Scoping in custom lattice functions (group argument)
问题 Please consider this function: tf <- function(formula = NULL, data = NULL, groups = NULL) { grv <- eval(substitute(groups), data, environment(formula)) # the values grn <- as.character(match.call()$groups) # the name gr <- match.call()$groups # unquoted name p <- xyplot(formula, data, # draws the data but not in groups # Try these options: # p <- xyplot(formula, data, groups, # can't find 'cat2' # p <- xyplot(formula, data, groups = data[,grn], # can't fine grn # p <- xyplot(formula, data,