Learn R Programming

rAmCharts (version 1.1.3)

amBoxplot: Plotting boxplot using rAmCharts

Description

amBoxplot computes a boxplot of the given data values. Can be a vector, a data.frame, or a matrix

Usage

amBoxplot(object, ...)
"amBoxplot"(object, main = NULL, xlab = NULL, ylab = NULL, ylim = NULL, names = NULL, col = NULL, horizontal = FALSE, ...)
"amBoxplot"(object, main = NULL, id = NULL, xlab = NULL, ylab = NULL, ylim = NULL, col = NULL, horizontal = FALSE, ...)
"amBoxplot"(object, use.cols = TRUE, main = NULL, xlab = NULL, ylab = NULL, ylim = NULL, col = NULL, horizontal = FALSE, ...)
"amBoxplot"(object, data = NULL, id = NULL, main = NULL, xlab = NULL, ylab = NULL, ylim = NULL, col = NULL, horizontal = FALSE, ...)

Arguments

object
a vector, data.frame, a matrix, or a formula !
...
Don't use... For S3 Definition...
main
character, title of the graph.
xlab,ylab
character, labels of the axis.
ylim
the range of y values with sensible defaults.
names
in case of vector, name on x-axis
col
color(s) to be used to fill the boxplot
horizontal
Boolean. Rotate boxplot ?
id
in case of using a data.frame, column name of id for identify outliers
use.cols
for matrix only. Boxplot on columns or rows ?
data
a data.frame from which the variables in formula should be taken

Examples

Run this code
# formula
(obj <- amBoxplot(count ~ spray, data = InsectSprays))
print(obj)

# adding parameters
amBoxplot(count ~ spray, data = InsectSprays, ylim = c(0,50),
 main = "Boxplot", xlab = "spray", col = c("darkblue", "gray"))

# transpose
amBoxplot(count ~ spray, data = InsectSprays, ylim = c(0,50),
 main = "Boxplot", xlab = "spray", horizontal = TRUE)

# using a custom colum to identify outliers
InsectSprays$id <- paste0("ID : ", 1:nrow(InsectSprays))
amBoxplot(count ~ spray, data = InsectSprays, id = "id")

# data.frame
don <- data.frame(a = 1:10, b = 1:5)
amBoxplot(don, ylim = c(0,15))

# matrix
x = matrix(nrow = 10, ncol = 5, rnorm(50))

amBoxplot(x) # on columns
colnames(x) <- LETTERS[1:5]
amBoxplot(x) # with names
amBoxplot(x, use.cols = FALSE, col = c("blue", "red"))

# vector
amBoxplot(rnorm(100))

Run the code above in your browser using DataLab