View source: R/class-plotdata-line.R
lineplot | R Documentation |
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)
)
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 \itemviewportList of min and max values to consider as the range of data \itemnumeratorValuescharacter vector of values from the y-axis variable to consider the numerator \itemdenominatorValuescharacter vector of values from the y-axis variable to consider the denominator \itemoverlayValuesveupathUtils::BinList providing overlay values of interest \itemsampleSizesboolean indicating if sample sizes should be computed \itemcompleteCasesboolean indicating if complete cases should be computed \itemevilModeString indicating how evil this plot is ('strataVariables', 'allVariables', 'noVariables') \itemcollectionVariablePlotRefstring 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. \itemcomputedVariableMetadatanamed 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. \itemverboseboolean 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')
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.