ggstatsplot (version 0.0.2)

ggpiestats: Pie charts with statistical tests

Description

Pie charts for categorical data with statistical details included in the plot as a subtitle.

Arguments

data

The data as a data frame.

main

A string naming the variable to use as the rows in the contingency table.

condition

A string naming the variable to use as the columns in the contingency table.

factor.levels

A character vector with labels for factor levels of main variable.

stat.title

Title for the effect being investigated with the chi-square test.

title

The text for the plot title.

caption

The text for the plot caption.

k

Number of decimal places expected for results.

legend.title

Title of legend.

facet.wrap.name

The text for the facet_wrap variable label.

facet.proptest

Decides whether proprotion test for main variable is to be carried out for each level of condition (Default: TRUE).

messages

Decides whether messages references, notes, and warnings are to be displayed (Default: TRUE).

Examples

Run this code
# NOT RUN {
library(ggplot2)

# simple function call with the defaults
ggstatsplot::ggpiestats(
data = datasets::iris,
main = Species
)

# more detailed function call
ggstatsplot::ggpiestats(
data = datasets::mtcars,
main = am,
condition = cyl,
factor.levels = c("zero", "one"),
stat.title = "interaction",
title = "Dataset: mtcars",
caption = "This is a demo",
legend.title = "transmission",
facet.wrap.name = "No. of cylinders",
facet.proptest = TRUE
)

# }

Run the code above in your browser using DataCamp Workspace