Learn R Programming

PowRPriori (version 0.1.2)

.plot_data: Internal Data Plotting Engine

Description

An internal helper function containing the logic to "intelligently" create plots from simulated data. It automatically chooses between spaghetti plots and jitter/point-range plots depending on the specified design and model family.It derives sensible defaults for plot aesthetics from the design, if they are not supplied directly via the plot_sim_model function.

Usage

.plot_data(
  data,
  design,
  formula,
  family,
  x_var,
  group_var,
  color_var,
  facet_var,
  n_data_points
)

Value

A ggplot object.

Arguments

data

The data frame to plot.

design

The PowRPriori_design object.

formula

An lme4-style formula (e.g. outcome ~ predictor1 * predictor2 + (1 | subject))

family

The model family. Defaults to "gaussian", other possible values are "binomial" or "poisson".

x_var, group_var, color_var, facet_var

Strings specifying variables for plot aesthetics.

n_data_points

The maximum number of trajectories in spaghetti plots.