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.
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)
"Concentration"
."Number of samples"
.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.
genloq, genoutlier, genpastoact, genanaggr, genplot,
genstatistic, gentransform, genwhisker
## 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)
Run the code above in your browser using DataLab