Learn R Programming

metaplot (version 0.1.5)

metaplot: Metaplot

Description

Creates a metaplot.

Creates a metaplot from grouped_df. Folds x and calls the method for folded. Dots arguments are passed only to metaplot.

Creates a metaplot from data.frame. Folds x and calls the method for folded. Dots arguments are passed only to metaplot.

Creates a plot from folded, using metadata as available.

Usage

metaplot(x, ...)

# S3 method for grouped_df metaplot(x, ...)

# S3 method for data.frame metaplot(x, ...)

# S3 method for folded metaplot(x, ...)

Arguments

x

object

...

passed arguments

Methods (by class)

  • grouped_df: grouped_df method

  • data.frame: data.frame method

  • folded: folded method

Details

Metaplot creates univariate, bivariate, or multivariate plots depending on the number and type of items represented by ....

A single argument representing a continuous variable (numeric, not having encoded GUIDE) is forwarded to dens to give a density plot. Same for a single categorical, but this is unexpected.

Two arguments, types continuous and categorical, are forwarded to boxplot.folded to give a boxplot (vertical or horizontal, depending on order).

Two arguments representing continuous variables give a scatterplot by means of scatter.folded.

A third anonymous argument is unexpected if a preceding argument is categorical.

A third, categorical argument following two continuous arguments is treated as a grouping variable.

If there are three or more continuous arguments, a scatterplot matrix is created by means of corsplom.folded. Additional categoricals will be ignored.

Stratification, e.g. conditioning for trellis plots, is currently unimplemented.

See Also

Other generic functions: axislabel, continuous, corsplom, dens, guide, label, scatter

Other univariate plots: dens

Other bivariate plots: boxplot, scatter

Other multivariate plots: corsplom

Other univariate plots: dens

Other bivariate plots: boxplot, scatter

Other multivariate plots: corsplom

Other univariate plots: dens

Other bivariate plots: boxplot, scatter

Other multivariate plots: corsplom

Examples

Run this code
# NOT RUN {
# load some packages
library(spec)
library(csv)
library(magrittr)
library(tidyr)
library(dplyr)
library(fold)

# find paths to example data and specification
x <- system.file(package='metaplot','extdata','drug1001.csv')
spec <- system.file(package='metaplot','extdata','drug1001.spec')

# verify agreement at file level
x %matches% spec

# read and verify in memory
x %<>% as.csv
spec %<>% as.spec
x %matches% spec

# convert specifaction to folded format
spec %<>%  as.folded

# capture the most interesting parts of x
x %<>% filter(VISIBLE == 1) %>% filter(EVID == 0)

# identify keys
attr(x, 'groups') <- c('ID','TIME')

# fold x
x %<>% fold

# combine with metadata
x %<>% bind_rows(spec)
x %<>% sort

# Now we have a plotting dataset with embedded metadata.
# We call metaplot with various numbers of continuous and
# categorical arguments, given as unquoted values from the
#  VARIABLE column.

x %>% metaplot(AGE) # one continuous
x %>% metaplot(PRED,DV) # two continuous
x %>% metaplot(AGE,SEX) # continuous and categorical
x %>% metaplot(SEX,AGE) # categorical and continuous
x %>% metaplot(PRED,DV,SEX) # two continous and categorical
x %>% metaplot(ETA1,ETA2,ETA3) # three or more continuous
x %>% metaplot(CWRES,TAD) # metadata
x %>% filter(META %>% is.na) %>% metaplot(CWRES,TAD) # no metadata
x %>% metaplot(PRED,DV, xlog = TRUE, ylog = TRUE, iso=TRUE, xsmooth = TRUE) # log-log
x %>% metaplot(CWRES, TAD, yref = 0, ysmooth = TRUE)
x %>% metaplot(ETA1, SEX, ref = 0)
x %>% metaplot(AGE,WEIGHT, ysmooth = TRUE, xsmooth = TRUE)
# }

Run the code above in your browser using DataLab