R/formula-to-property.R

Defines functions formula_to_property

formula_to_property <- function(properties) {
  for (key in names(properties)) {
    value <- properties[[key]]
    if (inherits(value, "formula")) {
      x <- all.vars(value)
      if (length(x) > 1) {
        properties[[key]] <- sprintf("data => [%s]", paste0("data.", x, collapse = ", ")) %>%
          JS()
      } else {
        properties[[key]] <- get_property(x[1])
      }
    }
  }

  properties
}

Try the deckgl package in your browser

Any scripts or data that you put into this service are public.

deckgl documentation built on July 1, 2020, 7:36 p.m.