R/set_id.R

Defines functions set_id

Documented in set_id

#' Sets the id attribute in JSON data
#'
#' @param identifier The id
#' @param data The JSON data
#' @return JSON ecoded data
#' @import rjson
#' @export
set_id <- function(identifier = NA, data) {
  if (!is.na(identifier)) {
    data <- rjson::fromJSON(data)
    data$id <- as.character(identifier)
    data <- rjson::toJSON(data)
  }
  return(data)
}

Try the simplegraphdb package in your browser

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

simplegraphdb documentation built on March 12, 2021, 5:05 p.m.