# easiOrigin
## Data Summaries and Box Plots
### Descriptives
.descFNS <- function(x, ...) {
UseMethod(".descFNS")
}
.descFNS.default <- function(frame, ...) {
data <- data.frame(frame)
results <- do.call(rbind, lapply(data, function(x) boxplot.stats(x)$stats))
colnames(results) <- c("Min", "LQ", "Mdn", "UQ", "Max")
results
}
.descFNS.formula <- function(formula, ...) {
results <- aggregate(formula, FUN = .descFNS.default, ...)
rn <- results[[1]]
results <- results[[2]]
rownames(results) <- rn
colnames(results) <- c("Min", "LQ", "Mdn", "UQ", "Max")
results
}
.descFNS.lm <- function(object, ...) {
formula <- object$terms
.descFNS(formula, ...)
}
descFNS <- function(..., main = NULL, digits = 3) {
results <- .descFNS(...)
if (is.null(main)) {
main <- "Five Number Summaries for the Data"
}
.formatList(list(results), main = main, digits = digits)
}
#### Box Plots
graphFNS <- function(x, ...) {
UseMethod("graphFNS")
}
graphFNS.default <- function(frame, main = NULL, ylab = "Outcome", xlab = "", ...) {
if (is.null(main)) {
main <- "Boxplots for the Data"
}
data <- data.frame(frame)
par(bty = "l")
boxplot(data, boxwex = .15, cex = 1.5, cex.lab = 1.3, xlab = xlab, ylab = ylab, main = main, ...)
}
graphFNS.formula <- function(formula, main = NULL, ylab = "Outcome", xlab = "", ...) {
if (is.null(main)) {
main <- "Boxplots for the Data"
}
par(bty = "l")
boxplot(formula, boxwex = .15, cex = 1.5, cex.lab = 1.3, xlab = xlab, ylab = ylab, main = main, ...)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.