lineplot: Line Plot data file

View source: R/class-plotdata-line.R

lineplotR Documentation

Line Plot data file

Usage

lineplot(
  data,
  variables,
  binWidth = NULL,
  value = c("mean", "median", "geometricMean", "proportion"),
  errorBars = c(TRUE, FALSE),
  viewport = NULL,
  numeratorValues = NULL,
  denominatorValues = NULL,
  overlayValues = NULL,
  sampleSizes = c(TRUE, FALSE),
  completeCases = c(TRUE, FALSE),
  evilMode = c("noVariables", "allVariables", "strataVariables"),
  collectionVariablePlotRef = NULL,
  computedVariableMetadata = NULL,
  verbose = c(TRUE, FALSE)
)

Arguments

data

data.frame to make plot-ready data for

variables

veupathUtils::VariableMetadataList and its position in the plot. Recognized plotRef values are 'xAxisVariable', 'yAxisVariable', 'overlayVariable', 'facetVariable1' and 'facetVariable2'

binWidth

numeric value indicating width of bins, character (ex: 'year') if xaxis is a date

value

character indicating whether to calculate 'mean', 'median', 'geometricMean', 'proportion' for y-axis

errorBars

boolean indicating if we want 95

\item

viewportList of min and max values to consider as the range of data

\item

numeratorValuescharacter vector of values from the y-axis variable to consider the numerator

\item

denominatorValuescharacter vector of values from the y-axis variable to consider the denominator

\item

overlayValuesveupathUtils::BinList providing overlay values of interest

\item

sampleSizesboolean indicating if sample sizes should be computed

\item

completeCasesboolean indicating if complete cases should be computed

\item

evilModeString indicating how evil this plot is ('strataVariables', 'allVariables', 'noVariables')

\item

collectionVariablePlotRefstring indicating the plotRef to be considered as a collectionVariable. Accepted values are 'overlayVariable' and 'facetVariable1'. Required whenever a set of variables should be interpreted as a collectionVariable.

\item

computedVariableMetadatanamed list containing metadata about a computed variable(s) involved in a plot. Metadata can include 'displayName', 'displayRangeMin', 'displayRangeMax', and 'collectionVariable'. Will be included as an attribute of the returned plot object.

\item

verboseboolean indicating if timed logging is desired

character name of json file containing plot-ready data This function returns the name of a json file containing plot-ready data with one row per group (per panel). Columns 'seriesX' and 'seriesY' contain the raw data for the line plot. Column 'group' and 'panel' specify the group the series data belongs to. Evil Mode

An 'evilMode' exists. It will do the following:
- when ‘strataVariables' it will return ’no data' as a regular value for strata vars but will discard such cases for the axes vars.
- when ‘allVariables' it will return ’no data' as a regular value for all variables.
- when 'noVariables' it will do the sensible thing and return complete cases only.
- not return statsTables
- allow smoothed means and agg values etc over axes values where we have no data for the strata vars
- return a total count of plotted incomplete cases
- represent missingness poorly, conflate the stories of completeness and missingness, mislead you and steal your soul

# Construct example data df <- data.table('entity.xvar' = sample(1:20, 100, replace=T), 'entity.yvar' = rnorm(100), stringsAsFactors = F)

# Create VariableMetadataList that specifies variable role in the plot and supplies variable metadata variables <- veupathUtils::VariableMetadataList( veupathUtils::VariableMetadata( variableClass = veupathUtils::VariableClass(value = 'native'), variableSpec = veupathUtils::VariableSpec(variableId = 'xvar', entityId = 'entity'), plotReference = veupathUtils::PlotReference(value = 'xAxis'), dataType = veupathUtils::DataType(value = 'NUMBER'), dataShape = veupathUtils::DataShape(value = 'CONTINUOUS') ), veupathUtils::VariableMetadata( variableClass = veupathUtils::VariableClass(value = 'native'), variableSpec = veupathUtils::VariableSpec(variableId = 'yvar', entityId = 'entity'), plotReference = veupathUtils::PlotReference(value = 'yAxis'), dataType = veupathUtils::DataType(value = 'NUMBER'), dataShape = veupathUtils::DataShape(value = 'CONTINUOUS') ) )

# Returns the name of a json file lineplot(df, map, value = 'median')


VEuPathDB/plot.data documentation built on Feb. 20, 2025, 6:33 p.m.