% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/freqfuncs.R
\name{plot_freqdist}
\alias{plot_freqdist}
\title{Plot Univariate Tables or Frequency Distributions of the form (score, freq)}
\usage{
plot_freqdist(
  fd,
  weight = NULL,
  main = "Frequency Distribution",
  numeric = 1,
  space = 0,
  las = 2,
  title = NULL,
  ...
)
}
\arguments{
\item{fd}{tables, matrices or data.frames containing
univariate frequency distribution (midpoint,freq).}

\item{weight}{A vector of weights associated with fd[,1] \cr}

\item{main}{A string to be used as the main title.}

\item{numeric}{= 0 to plot w/o filling in the missing value of fd[,1].}

\item{space}{an option to be passed to native barplot (default=0) \cr
the value of which specifies the width of the spaces between bars.}

\item{las}{an option to be passed to native to barplot (default=2) \cr
= 0 to rotate h, = 1 to rotate none, = 2 to rotate x, = 3 to rotate both.}

\item{title}{An alias for main.}

\item{...}{additional parameters to barplot.}
}
\value{
The object from native barplot.
}
\description{
Plot Univariate Tables or Frequency Distributions of the form (score, freq)
}
\details{
If tab is a class table object created by native table or xtabs function,
\code{plot_freqdist(tab)} and \code{plot(tab)} are similar. \cr

If weight is given, (fd, weight) or(fd[,1], weight) will be considered as
the frequency distribution table. \cr
Native barplot is used with  space=0 and las=2 and ... options as \cr
\code{barplot( height=fd[,2], names.arg=as.character(fd[,1])}
\code{, main=main, space=space, las=las, ... )}
\cr
When numeric=1 is given (default),  \code{ min(fd[,1]):max(fd[,1]) }
will be used as the horizontal names and 0 will be substituted for
the missing frequencis. \cr
}
\examples{

set.seed(1701)

score <- 0:10
freq <- c(0,5,10,20,30,40,30,20,10,5,0)
fd <- cbind(score,freq)
plot_freqdist( fd, main="no missing value" )

fd1 <- fd[-c(3,7),]
plot_freqdist( fd1, main="score=2, 6 are missing." )
plot_freqdist( fd1, numeric=0
, main="score=2, 6 are missing and numeric=0." )

tab=table(score)
tab=tab[-c(3,7)]
tab[]=freq[-c(3,7)]
plot( tab, main="using native plot function" )
plot_freqdist( tab, main="from class table object" )


}
