R/bin.vector.R

Defines functions bin.vector

Documented in bin.vector

bin.vector <-
function(vectorX, bins = seq(0,1,0.5)){
	
	dist.mat <- apply(matrix(bins, ncol = 1), 1, function(x) x - vectorX)	
	binned.vector <- apply(dist.mat, 1, function(x) bins[which(abs(x) == min(abs(x)))[1]])
	return(binned.vector)	
	
}

Try the cape package in your browser

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

cape documentation built on May 2, 2019, 3:27 a.m.