R/length.R

#' Length of Crunch objects
#' @param x a Crunch object (catalog, order, etc.)
#' @return Integer: the number of elements in the catalog, group, folder, etc.
#' @name length
#' @keywords internal
NULL

setGeneric("length")

#' @rdname length
#' @export
setMethod("length", "CrunchDeck", function(x) return(length(slides(x))))

#' @rdname length
#' @export
setMethod("length", "ShojiCatalog", function(x) length(index(x)))

#' @rdname length
#' @export
setMethod("length", "ShojiOrder", function(x) length(entities(x)))

#' @rdname length
#' @export
setMethod("length", "OrderGroup", function(x) length(entities(x)))

#' @rdname length
#' @export
setMethod("length", "TabBookResult", function(x) length(x$sheets))

#' @rdname length
#' @export
setMethod("length", "MultitableResult", function(x) length(x$result))

Try the crunch package in your browser

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

crunch documentation built on Aug. 31, 2023, 1:07 a.m.