check_values: Check a set of keys and their values

Description Usage Arguments Value Examples

View source: R/check-annotation-values.R

Description

Check a set of keys and their values

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
check_values(
  x,
  annotations,
  whitelist_keys = NULL,
  whitelist_values = NULL,
  success_msg = "All annotation values are valid",
  fail_msg = "Some annotation values are invalid",
  return_valid = FALSE,
  annots_link = "https://shinypro.synapse.org/users/nsanati/annotationUI/",
  syn
)

Arguments

x

A data frame of annotation data

annotations

A data frame of annotations to check against

whitelist_keys

A character vector of annotation keys to whitelist. If provided, all values for the given keys will be treated as valid.

whitelist_values

A named list of keys (as the names) and values (as vectors) to whitelist

success_msg

Message indicating the check succeeded.

fail_msg

Message indicating the check failed.

return_valid

Should the function return valid values? Defaults to FALSE (i.e. the function will return invalid values).

annots_link

Link to a definition of the annotations being used in the project

syn

Synapse client object

Value

If return_valid = FALSE: a condition object indicating whether all annotation values are valid. Invalid annotation values are included as data within the object: a named list where each element corresponds to a key that contains invalid values, and the contents of each element is a vector of invalid values. If return_valid = TRUE: a named list of the valid annotation keys and values.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
annots <- data.frame(
  key = c("fileFormat", "fileFormat"),
  value = c("txt", "csv"),
  columnType = c("STRING", "STRING"),
  stringsAsFactors = FALSE
)
dat <- data.frame(
  fileFormat = c("wrong", "txt", "csv", "wrong again"),
  stringsAsFactors = FALSE
)
check_values(dat, annots)

dccvalidator documentation built on July 2, 2020, 4:05 a.m.