50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

biometryassist (version 1.3.0)

summary_graph: Visualise a graphical summary of variables from a data frame

Description

Variables are plotted in different ways according to the number of explanatory variables provided as input.

Usage

summary_graph(data, response, exp_var, resp_units = "")

Value

A ggplot2 plot object

Arguments

data

A data frame containing the variables to be plotted.

response

The response variable to plot.

exp_var

The explanatory (or grouping) variable(s) to plot. Up to three can be provided.

resp_units

A string providing units to display on the response variable (y) axis. Will use the empty string by default so axes will have no units by default.

Details

With a single explanatory variable, a boxplot grouped by exp_var is produced. With two explanatory variables, a dot-plot with lines connecting the mean of each group is produced, with the first element of exp_var used as the x axis variable, and the second is used to colour the points. Three explanatory variables produces the same as two, but with the third used to facet the plot.

Examples

Run this code

summary_graph(iris, "Petal.Length", "Species", "mm")

# Multiple explanatory variables can be provided as a vector
summary_graph(npk, "yield", c("N", "P"), "lb/plot")

summary_graph(npk, "yield", c("N", "P", "K"), "lb/plot")

Run the code above in your browser using DataLab