mapMarkers: Map Markers data file

View source: R/class-plotdata-map-markers.R

mapMarkersR Documentation

Map Markers data file

Description

This function returns the name of a json file containing plot-ready data with one row per panel. Columns 'label' and 'value' contain the raw data for plotting. Column 'panel' specifies the facet panel the series data belongs to. There are two options to calculate y-values for plotting.
1) 'count' occurrences of values from data.table input
2) 'proportion' of occurrences of values from data.table input

Usage

mapMarkers(
  data,
  variables,
  value = c("count", "proportion"),
  viewport = NULL,
  xValues = NULL,
  sampleSizes = c(TRUE, FALSE),
  completeCases = c(TRUE, FALSE),
  evilMode = c("noVariables", "allVariables", "strataVariables"),
  verbose = c(TRUE, FALSE)
)

Arguments

data

data.frame to make plot-ready data for

variables

veupathUtils::VariableMetadataList

value

String indicating how to calculate y-values ('count', 'proportion')

viewport

List of values indicating the visible range of data

xValues

veupathUtils::BinList providing overlay values of interest

sampleSizes

boolean indicating if sample sizes should be computed

completeCases

boolean indicating if complete cases should be computed

evilMode

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

verbose

boolean indicating if timed logging is desired

Value

character name of json file containing plot-ready data

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

Geolocation Viewport Structure

This is a list of lists taking the form:
*latitude
**xMin = numeric
**xMax = numeric
*longitude
**left = numeric
**right = numeric

Examples

# Construct example data
df <- data.table('entity.xvar' = sample(c('a','b','c'), 100, replace=T),
                 'entity.facet' = sample(c('red','green','blue'), 100, replace=T))

# 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 = 'STRING'),
    dataShape = veupathUtils::DataShape(value = 'CATEGORICAL')
  ),
  veupathUtils::VariableMetadata(
    variableClass = veupathUtils::VariableClass(value = 'native'),
    variableSpec = veupathUtils::VariableSpec(variableId = 'facet', entityId = 'entity'),
    plotReference = veupathUtils::PlotReference(value = 'geo'),
    dataType = veupathUtils::DataType(value = 'STRING'),
    dataShape = veupathUtils::DataShape(value = 'CATEGORICAL')
  )
)

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

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