% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/freqc.R
\name{freqc}
\alias{freqc}
\title{Frequency Distribution of Many Discrete Variables}
\usage{
freqc(..., useNA = "no", sortrow = 1, sortcol = 0, debug = 0)
}
\arguments{
\item{...}{Discrete/categorical variables to be tabulated}

\item{useNA}{= "ifany" if the frequency of NA is needed.}

\item{sortrow}{= 0  not to sort the rows of the result (category values)}

\item{sortcol}{= 1  to sort the column of the result (variable names)}

\item{debug}{= 1 to print intermediate result}
}
\value{
A values x variables matrix containing the frequencies. \cr
\code{F <- freqc( a, b )} returns a matrix \code{F}
whose i-j element contains the frequency of value \code{rownames(F)[i]}
in the variable \code{colnames(F)[j]}.
}
\description{
Frequency Distribution of Many Discrete Variables
}
\details{
If \code{X} is a matrix consisting of discrete variables, \cr
\code{freqc(X)} is equivaleet to
\preformatted{
  freq=lapply(as.list(X),table)
  res2=mapply( function(x,name){
    y=matrix(x,1); colnames(y)=names(x); rownames(y)=name;
    return(as.data.frame(y))  }
    ,  freq, names(freq) )
}

Space or Blank values will be denoted as V1.
}
\examples{
set.seed(1701)
a <- sample(1:9,20,replace=1)
b <- letters[sample(1:9,20,replace=1)]
c <- sample(3:5,20,replace=1)
d <- letters[sample(5:9,20,replace=1)]

a[9] <- NA
b[3:4] <- NA

data <- data.frame( a, b )

res1 <- freqc(a,b,c,d)
res2 <- freqc(data,c,d)
res3 <- freqc(c,d,a,b)
Print(res1,res2,res3)
res4 <- freqc(c,d,a,b, sortrow=0)
res5 <- freqc(c,d,a,b, sortcol=1)
Print(res1,res4,res5)

res11 <- freqc(a,b,c,d, useNA="ifany")
res21 <- freqc(data,c,d, useNA="ifany")
Print(res11,res21)

}
