R/kbase.R

Defines functions kbase

Documented in kbase

### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
###
### kbase.R
###
### - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
###
### dependencies: library(sets)
###
### 2008-04-24: created
### 2017-12-13: Change return class
###

kbase <- function(x) {

   ### check x
   if (!inherits(x, "kstructure")) {
      stop(sprintf("%s must be of class %s.", dQuote("x"), dQuote("kstructure")))
   }
   if (!kstructure_is_kspace(x)) {
      stop("'x' must be a knowledge space.")
   }

   ### compute base
   atoms <- katoms(x, kdomain(x))
   names(atoms) <- NULL
   base <- as.set(unlist(atoms, recursive=FALSE))
   class(base) <- unique(c("kbase", "kfamset", class(base)))

   ### return base
   base
}

Try the kst package in your browser

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

kst documentation built on Oct. 24, 2022, 5:07 p.m.