R/Integer2Binary.R

Defines functions Integer2Binary

Documented in Integer2Binary

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

Integer2Binary <- function(y, name="My_Factor") {
	tt = table(y)
	y = as.integer(as.factor(y))
	ncat = max(y)
	n = length(y)
	Z = matrix(0, n, ncat)
	for (i in 1:n) Z[i, y[i]] = 1
	Nam = names(tt)
	for (j in 1:ncat) Nam[j] = paste(name, "-", names(tt)[j], sep = "")
	colnames(Z) <- Nam
	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.