Learn R Programming

mbgraphic (version 1.0.1)

groups_maxplot: Plots the variables with highest values in groups

Description

Plots the variables with highest values in groups within histograms.

Usage

groups_maxplot(data, classvar, m = 5, samebinsize = FALSE)

Arguments

data

A data frame.

classvar

A factor. The variable which is used to explain the numeric variables from x.

m

A positive integer. Number of plots to draw. Maximum is 10.

samebinsize

Logical. Whether or not bins are drawn with the same size. Default is FALSE.

Value

A ggplot object.

References

H. Wickham (2009) ggplot2: Elegant Graphics for Data Analysis New York: Springer

See Also

groups

Examples

Run this code
# NOT RUN {
data(Election2005)
# }
# NOT RUN {
# Define new variable which explains affiliation of the constituencies
# to east Germany, west Germany and Berlin 
OstWest <-  ifelse(Election2005$Land %in% 
    c("Thueringen","Sachsen","Sachsen-Anhalt",
    "Brandenburg","Mecklenburg-Vorpommern"),  "Ost", "West")
Election2005$OstWestBerlin <- 
  as.factor(ifelse(Election2005$Land == "Berlin","Berlin",OstWest))

# Plot 5 variables with highest values in groups 
groups_maxplot(Election2005,"OstWestBerlin")
# }

Run the code above in your browser using DataLab