R/recodqual.R

#' @export
recodqual <-
function(X,rename.level=FALSE)
	{
		#X <- as.matrix(X)
		GNA <- tab.disjonctif.NA(X,rename.level)
		G <- replace(GNA,is.na(GNA),0)
		n <- nrow(GNA)
		if (n > 1)
		{
		  ns <- apply(G,2,sum)
		  nmiss <- apply((apply(GNA,2,is.na)),2,sum)
		  if(sum((n-nmiss)==ns)!=0) stop("There are columns in X.quali where all the categories are identical",call.=FALSE)
		}
		return(G)	
	}

Try the PCAmixdata package in your browser

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

PCAmixdata documentation built on May 2, 2019, 12:38 p.m.