R/transform.R

Defines functions create_transform_functions create_transform

create_transform_functions <- function(schema) {
  transform_options <- purrr::map_chr(schema$definitions$Transform$anyOf, get_name_from_ref)
  c(
    purrr::map_chr(transform_options, create_transform, schema = schema),
    purrr::map_chr(transform_options, create_object, schema = schema)
  )
}



create_transform <- function(trans, schema) {
  
  short_trans <- tolower(stringr::str_remove(trans,"Transform"))

  make_function( glue("#/definitions/{trans}"), 
                 schema, 
                 short_trans, 
                 ".add_transform", 
                 description = glue("Add {trans} to a vega-lite spec."))

}
AliciaSchep/vlmetabuildr documentation built on Jan. 8, 2020, 7:30 a.m.