simApply(x, design, fun, ...)simSapply(x, design, fun, ..., simplify = TRUE)
data.frame
to be subsetted.fun
.simApply
a data.frame
.
For simSapply
, a list, vector or matrix (see sapply
).sapply
data(eusilcP)
eusilcP <- eusilcP[, c("region", "gender", "eqIncome")]
## returns data.frame
simApply(eusilcP, c("region", "gender"),
function(x) median(x$eqIncome))
## returns vector
simSapply(eusilcP, c("region", "gender"),
function(x) median(x$eqIncome))
Run the code above in your browser using DataLab