Learn R Programming

descriptr (version 0.1.0)

group_summary: Descriptive Statistics By Group

Description

group_summary returns descriptive statistics of a continuous variable for the different levels of a categorical variable. boxplot.group_summary creates boxplots of the continuous variable for the different levels of the categorical variable.

Usage

group_summary(fvar, cvar)

# S3 method for group_summary boxplot(x, ...)

Arguments

fvar

a factor variable

cvar

a continuous variable

x

an object of the class group_summary

...

further arguments to be passed to or from methods

Value

group_summary returns an object of class "group_summary". An object of class "group_summary" is a list containing the following components:

stats

a data frame containing descriptive statistics for the different levels of the factor variable

plotdata

data for boxplot method

xvar

name of the categorical variable

yvar

name of the continuous variable

See Also

link{summary_stats}

Examples

Run this code
# group summary
mt <- mtcars
mt$cyl <- as.factor(mt$cyl)
group_summary(mt$cyl, mt$mpg)

# boxplot
k <- group_summary(mt$cyl, mt$mpg)
boxplot(k)

Run the code above in your browser using DataLab