R/coerce_nans.R

Defines functions coerce_nans.matrix coerce_nans.list coerce_nans

coerce_nans <- function(x, to){
 UseMethod('coerce_nans')
}

coerce_nans.list <- function(x, to){

 lapply(x, coerce_nans, to = to)

}

coerce_nans.factor <-
 coerce_nans.integer <-
 coerce_nans.double <-
 coerce_nans.array <-
 coerce_nans.matrix <- function(x, to){

 if(any(is.nan(x))){
  x[is.nan(x)] <- to
 }

 x

}

Try the aorsf package in your browser

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

aorsf documentation built on June 22, 2024, 10:31 a.m.