R/random.R

Defines functions random

Documented in random

random <-
function(x, na.rm=TRUE){
if(na.rm) x=x[!is.na(x)]
lenx=length(x)
if(lenx==0) return(NA)
ifelse(lenx==1, x, sample(x, 1))
}
datapplab/pathview documentation built on March 30, 2024, 9:06 a.m.