R/Numeric2Binary.R

Defines functions Numeric2Binary

Documented in Numeric2Binary

# Autor: Jose Luis Vicente Villardon
# Dpto. de Estadistica
# Universidad de Salamanca
# Revisado: Noviembre/2013

Numeric2Binary <- function(y, name = "MyVar", cut = NULL) {
	n = length(y)
	if (is.null(cut)) 
		cut = median(y)
	Z = matrix(0, n, 1)
	for (i in 1:n) if (y[i] > cut) 
		Z[i] = 1
	colnames(Z) <- paste(name, " > ", round(cut, digits = 3), sep = "")
	return(Z)
}

Try the MultBiplotR package in your browser

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

MultBiplotR documentation built on Nov. 21, 2023, 5:08 p.m.