plot_freqdist {lazy.tools} R Documentation

## Plot Univariate Tables or Frequency Distributions of the form (score, freq)

### Description

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

 `fd` tables, matrices or data.frames containing univariate frequency distribution (midpoint,freq). `weight` A vector of weights associated with fd[,1] `main` A string to be used as the main title. `numeric` = 0 to plot w/o filling in the missing value of fd[,1]. `space` an option to be passed to native barplot (default=0) the value of which specifies the width of the spaces between bars. `las` an option to be passed to native to barplot (default=2) = 0 to rotate h, = 1 to rotate none, = 2 to rotate x, = 3 to rotate both. `title` An alias for main. `...` additional parameters to barplot.

### Details

If tab is a class table object created by native table or xtabs function, `plot_freqdist(tab)` and `plot(tab)` are similar.

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

### Value

The object from native barplot.

### 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" )

```

[Package lazy.tools version 0.1.3 Index]