R/converters.R

Defines functions as.data.frame.registry .labels

as.data.frame.registry <-
function(x, ...)
{
    .one_line <- function(entry) {
        entry <- lapply(.labels(entry), function(i) i[[1]])
        data.frame(unclass(entry), ...)
    }

    ret <- do.call(rbind, lapply(x$get_entries(), .one_line))
    row.names(ret) <- NULL
    ret
}

.labels <-
function(x)
{
    ## transform function entries
    x[sapply(x, inherits, "function")] <- "<<function>>"

    ## transform objects
    obj <- sapply(x, is.object)
    x[obj] <- paste("<<", sapply(x, class)[obj], ">>", sep = "")

    x
}

Try the registry package in your browser

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

registry documentation built on May 1, 2019, 8:23 p.m.