R/PruneCNA.EXTS.R

setMethodS3("nbrOfGenerations", "PruneCNA", function(this, ...) {
  length(this)
})

setMethodS3("extractGenerations", "PruneCNA", function(this, generations, ...) {
  # Argument 'generations':
  n <- nbrOfGenerations(this)
  if (any(generations < 0)) {
    generations <- setdiff(seq_len(n), -generations)
  }
  generations <- Arguments$getIndices(generations, max=n)

  res <- unclass(this)
  res <- res[generations]
  class(res) <- class(this)
  res
})

setMethodS3("[", "PruneCNA", function(x, i) {
  # To please R CMD check
  this <- x

  extractGenerations(this, generations=i)
})

Try the aroma.cn package in your browser

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

aroma.cn documentation built on July 21, 2022, 1:05 a.m.