R/brackets_R6.R

Defines functions length.ConceptSet as.list.ConceptSet `[.FormalContext` `[.Set` `[.ImplicationSet` `[.ConceptSet`

#' @export
#' @noRd
`[.ConceptSet` <- function(x, ...) x$`[`(...)
#' @export
#' @noRd
`[.ImplicationSet` <- function(x, ...) x$`[`(...)
#' @export
#' @noRd
`[.Set` <- function(x, ...) x$`[`(...)
#' @export
#' @noRd
`[.FormalContext` <- function(x, ...) x$`[`(...)

#' @export
#' @method as.list ConceptSet
#' @noRd
as.list.ConceptSet <- function(x, ...) {

  if ("to_list" %in% names(x)) {

    return(x$to_list())

  } else {

    stop("Cannot convert R6 class to list...")

  }

}

#' @export
#' @method length ConceptSet
#' @noRd
length.ConceptSet <- function(x, ...) {

  x$size()

}

Try the fcaR package in your browser

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

fcaR documentation built on April 28, 2023, 1:11 a.m.