R/rarefy.R

Defines functions rarefy

Documented in rarefy

rarefy <-
function(raw, fraction)
{
	if (fraction > 1)
	{
		stop("fraction must be less than 1")	
	}
	
	nr <- nrow(raw)
	
	indices <- sample(nr, floor(fraction*nr))
	
	return(raw[indices,])	
}

Try the timeordered package in your browser

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

timeordered documentation built on Aug. 21, 2023, 1:06 a.m.