#' @export
construct.classRepresentation <- function(data, defn, ...) {
data %>%
select(names(defn@slots)) %>%
pmap(list) %>%
map(~exec(new, defn, !!!.))
}
#' @export
deconstruct.classRepresentation <- function(objs, defn, ...) {
map_dfr(
objs,
function(obj, slots) {
map(slots, ~slot(obj, .)) %>%
set_names(slots) %>%
as_tibble_row()
},
slots = slotNames(defn)
)
}
#' @export
construct.classGeneratorFunction <- function(data, defn, ...) {
construct(data, getClass(defn@className), ...)
}
#' @export
deconstruct.classGeneratorFunction <- function(objs, defn, ...) {
deconstruct(objs, getClass(defn@className), ...)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.