boxPlot: Produce a quick boxplot

Description Usage Arguments Value Author(s) See Also Examples

View source: R/boxPlot.R

Description

Produce a quick boxplot from a data frame or matrix and if wanted a vector with group membership.

Usage

1
boxPlot(df, group=NULL, out="default", missing=TRUE, color="#F4A460", labList=TRUE, legendLab="Group", title1="", xOrder=TRUE, numBreaks=10)

Arguments

df

vector, data frame or matrix

group

A vector of the same length as df (p.ex df$group) Default (NULL)

out

For groups. If "default" a boxplot with all groups is printed. If "rearranged" one graph with a plot for each group is printed

missing

If FALSE, na.omit is used before ploting for variable group. Default TRUE

labList

default NULL uses factor levels as group membership label.Else list (p.eg c("group1", "group2"))

color

color when group is NULL (default "#F4A460")

colorBox

boxplot color for group (default = "Spectral" from RColorBrewer)

alpha

transparency, defaults .3

legendLab

Legend title label (default="Group")

title1

Plot title (default="")

xOrder

x labels ordered alphabetically (default=TRUE)

numBreaks

when there are more than 15 response values breaks are modified for better visualization (default=10)

Value

plot

Single plot

pdf

One plot per each group (same=FALSE)

Author(s)

Ariadna Angulo-Brunet (ariadna.angulo@uab.cat), Carme Viladrich

See Also

violinPlot, ggplot2

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
#generate some random data
x<-1:5
y<-1:2
v1<-sample(x,80,replace=TRUE)
v2<-sample(x,80,replace=TRUE)
v3<-sample(x,80,replace=TRUE)
v4<-sample(x,80,replace=TRUE)
gender<- sample(y, 80, replace=TRUE)
df <- data.frame(v1, v2,v3,v4)


#Run boxplot
boxPlot(df)

#Run boxplot by group 
boxPlot(df, group=gender, labList=c("Male", "Female"), legendLab="Gender", title1="Boxplot by gender")

#Run a boxplot for each group
boxPlot(df, group=gender, out="rearrange")

AnguloB/SubscaleExplorer documentation built on Jan. 3, 2021, 2:57 p.m.