R/assign.Pmat.R

Defines functions `[.Pmat`

#' @export
"[<-.Pmat" <- function(x,i,j,value){
  x <- as.matrix(x)
  x[i,j] <- value
  return(x)
}


#' @export
`[.Pmat` <- function(x,i,j,drop = FALSE){
  if(drop){warning("drop is set to TRUE")}
  mc <- match.call()
  attr <- attributes(x)
  x <- as.matrix(x)
  x <- x[i,j,drop = FALSE]
  if(is.null(mc$i)){
    attr(x,"type") <- attr$type
    attr(x,"counting") <- attr$counting
    attr(x,"np") <- ncol(x)
    attr(x,"n") <- attr$n
    attr(x,"class") <- attr$class}
  return(x)
}

Try the permuco package in your browser

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

permuco documentation built on June 30, 2022, 9:05 a.m.