R/Factor2Binary.R

Defines functions Factor2Binary

Documented in Factor2Binary

Factor2Binary <- function(y, Name=NULL){  
  if (is.null(Name)) Name="C-"
  ncat=length(levels(y))
  n=length(y)
  Z=matrix(0,n,ncat)
  for (i in 1:n)
    Z[i,as.numeric(y[i])]=1
  colnames(Z) <- paste(Name,levels(y),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.