genhistogram: genhistogram

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/genhistogram.R

Description

Function genhistogram creates a histogram of (usually) concentrations with equidistant breaks placed in "good-looking" numbers. If plot=TRUE, the resulting histogram is plotted with several possibilities of graphical options.

Usage

1
2
3
4
genhistogram(x, breaks=7, input="openair", pollutant=NA, 
             delta=0, plot=TRUE, distr="norm", gap=0.05, 
             columns=2, col="#A52375", emboss=0, xlab="Concentration", 
             ylab="Number of samples", main=NA)

Arguments

x

vector of concentration values or data frame of genasis/openair type. See 'Details' for more detailed description of both data types.

breaks

a number of breaks between individualhistogram cells.

input

type of data.frame in the case of data.frame input. The allowed values are "openair" (default) and "genasis". In case of vector input, this argument is meaningless.

pollutant

name of the pollutant, for which the plot is plotted. Not necessary if only data for one pollutant is available in x. If not specified, plots for all pollutants are drawn in a multi-plot arrangement.

delta

a delta value before the lowest and after the highest value of x. Positive number or 0.

plot

logical. Should the result be plotted?

distr

a name of distribution to interlace. Values "norm" and "lnorm" are possible.

gap

the size of a gap between columns in a relative width of the column (number between 0 and 1).

columns

number of columns in the multi-plot arrangement.

col

a specification for the default plotting color. See section 'Color Specification' in par.

emboss

0,1,2 or 3 for differnet emboss efect of genhistogram columns.

xlab

a label for the x axis, defaults to "Concentration".

ylab

a label for the x axis, defaults to "Number of samples".

main

overall title for the histogram.

Details

Function genhistogram creates a histogram, e.g. distribution of given data values into several cells with equidistant breaks placed in "good-looking" numbers. The function considers both the magnitude of the data values and their precision (number of decimals) and choose the breaks to be interpretable well (not to have a lot of decimals).Some empty range is add before the first and behind the last data value in order to smooth the breaks numbers. The minimal size of this range could be determined by the delta parameter.

The function recognises three different input formats: Option input="openair" uses openair format of data frame with first column of name 'date' and type Date, optional columns of names "date_end", "temp", "wind" and "note" and other columns of class "numeric"" containing concentration values and named by names of the compounds. input="genasis" is used for the data frame with six columns "valu", "comp", "date_start", "date_end", "temp" and "wind" where the first, fifth and sixth are of class "numeric"", second of type character and third and fourth columns could be both "character" or "Date" class. The names of columns in "genasis" type data frame are not rigid, only their order is assumed. There is also a possibility to specify x as a numeric vector.

If plot=TRUE, the resulting histogram is plotted with several graphical possibilities. There are two options for plotting a curve of idealised distribution of concentration values. distr="lnorm" (default) draws curve of lognormal distribution, while distr="norm" draws curve of normal distribution defined by central tendency and variance of concentration data.

The argument emboss allows to induce an impression of plasticity of the histogram colums by two different graphical effects or their combination. emboss=0 implies flat columns without any effect, emboss=1 makes an impression of shading, emboss=2 bevels edges of the columns and emboss=3 combines last two effect into one.

Value

a list containing:

borders

numerical vector of column cell borders

distr

numerical vector of counts of values in the individual column cells

Author(s)

Jiri Kalina
kalina@mail.muni.cz

See Also

genloq, genoutlier, genpastoact, genanaggr, genplot, genstatistic, gentransform, genwhisker

Examples

1
2
3
4
5
6
7
8
9
## Vector input.
genhistogram(rnorm(60))
  
## Use of example data from the package:
data(kosetice.pas.openair)
genhistogram(kosetice.pas.openair[,1:8],col="orange",emboss=3)
data(kosetice.pas.genasis)
genhistogram(kosetice.pas.genasis[1:208,],input="genasis",
             distr="lnorm",col="orange",emboss=2)

genasis documentation built on May 1, 2019, 10:16 p.m.