getChartStatus: Check the status of a chart based on the current mapping

View source: R/getChartStatus.R

getChartStatusR Documentation

Check the status of a chart based on the current mapping

Description

Checks a chart's status when column-level chart specifications are provided in chart$dataSpec. Note that safetyGraphicsApp() does not allow a mapping value that is not found in domainData, so this function only needs to check that an expected parameter exists in mapping (not that the specified column is found in the loaded data).

Usage

getChartStatus(chart, mapping)

Arguments

chart

chart object

mapping

the current mapping data.frame

Details

Returns a list, with:

  • status (TRUE, FALSE)

  • domains a list specifying wheter all columns are specified in each domain

  • columns a list that matches the structure of chart$dataSpec and indicates which variables are available.

Value

a list with status, domains and columns properties

Examples

sample_chart <- list(
    domains=c("aes","dm"),
    dataSpec=list(
        aes=c("id_col","custom_col"),
        dm=c("id_col","test_col")
    )
)

sample_mapping <- data.frame(
    domain=c("aes","aes","dm","dm"),
    text_key=c("id_col","custom_col","id_col","test_col"),
    current=c("myID","AEcol","myID","dmCol")
)

check <- safetyGraphics:::getChartStatus(chart=sample_chart, mapping=sample_mapping) 
# check$status=TRUE


SafetyGraphics/safetyGraphics documentation built on Sept. 20, 2023, 2:31 p.m.