R/cluster2keys.R

"cluster2keys" <- 
function(c) {
if (inherits(c, "kmeans")) {c <- c$cluster
	p <- max(c)
	v <- length(c)
	keys <- matrix(rep(0,p*v),ncol=p)
	for (i in 1:v) {keys[i,c[i]] <- 1}  
	} else {if(length(class(c)) >1) {if (inherits(c,"iclust")) {keys <- factor2cluster(c)}
}}
return(keys) }

Try the psych package in your browser

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

psych documentation built on Sept. 26, 2023, 1:06 a.m.