iplot_abundance: Plot of the Relative Abundance of the Pollen Types

Description Usage Arguments Details Value References See Also Examples

Description

Generates a barplot based on the relative abundance (as percentage) in the air of the pollen types with respect to the total amounts

Usage

1
2
3
4
iplot_abundance(data, n.types = 15, y.start = NULL, y.end = NULL,
  interpolation = TRUE, int.method = "lineal", col.bar = "#E69F00",
  type.plot = "static", result = "plot", export.plot = FALSE,
  export.format = "pdf", exclude = NULL, ...)

Arguments

data

A data.frame object including the general database where calculation of the pollen season must be applied. This data.frame must include a first column in Date format and the rest of columns in numeric format belonging to each pollen type by column.

n.types

A numeric (integer) value specifying the number of the most abundant pollen types that must be represented in the plot of the relative abundance. A more detailed information about the selection of the considered pollen types may be consulted in Details. The n.types argument will be 15 types by default.

y.start, y.end

A numeric (integer) value specifying the period selected to calculate relative abundances of the pollen types (start year _ end year). If y.start and y.end are not specified (NULL), the entire database will be used to generate the pollen calendar. The y.start and y.end arguments will be NULL by default.

interpolation

A logical value. If FALSE the interpolation of the pollen data is not applicable. If TRUE an interpolation of the pollen series will be applied to complete the gaps with no data before the calculation of the pollen season. The interpolation argument will be TRUE by default. A more detailed information about the interpolation method may be consulted in Details.

int.method

A character string specifying the method selected to apply the interpolation method in order to complete the pollen series. The implemented methods that may be used are: "lineal", "movingmean", "spline" or "tseries". The int.method argument will be "lineal" by default.

col.bar

A character string specifying the color of the bars to generate the graph showing the relative abundances of the pollen types. The color argument will be #E69F00 by default, but any color may be selected.

type.plot

A character string specifying the type of plot selected to show the plot showing the relative abundance of the pollen types. The implemented types that may be used are: static generates a static ggplot object and dynamic generates a dynamic plotly object.

result

A character string specifying the output for the function. The implemented outputs that may be obtained are: "plot" and "table". The argument result will be "plot" by default.

export.plot

A logical value specifying if a plot saved in the working directory will be required or not. If FALSE graphical results will only be displayed in the active graphics window. If TRUE graphical results will be displayed in the active graphics window and also a pdf or png file (according to the export.format argument) will be saved within the plot_AeRobiology directory automatically created in the working directory. This argument is applicable only for "static" plots. The export.plot will be FALSE by default.

export.format

A character string specifying the format selected to save the plot showing the relative abundance of the pollen types. The implemented formats that may be used are: "pdf" and "png". This argument is applicable only for "static" plots. The export.format will be "pdf" by default.

exclude

A character string vector with the names of the pollen types to be excluded from the plot.

...

Other additional arguments may be used to customize the exportation of the plots using "pdf" or "png" files and therefore arguments from pdf and png functions (grDevices package) may be implemented. For example, for pdf files the user may custom the arguments: width, height, family, title, fonts, paper, bg, fg, pointsize...; and for png files the user may custom the arguments: width, height, units, pointsize, bg, res...

Details

This function allows to calculate the relative abundance of the pollen types in the air from a database and to display a barplot with the percentage representation of the main pollen types as the graph reported by Rojo et al. (2016). This plot will be generated only for the specified number of the most abundant pollen types using the n.types argument by the user.

Pollen time series frequently have different gaps with no data and this fact could be a problem for the calculation of specific methods for defining the pollen season even providing incorrect results. In this sense by default a linear interpolation will be carried out to complete these gaps before to define the pollen season (interpolation = TRUE). Additionally, the users may select other interpolation methods using the int.method argument, as "lineal", "movingmean", "spline" or "tseries". For more information to see the interpollen function.

Value

This function returns different results:

plot in the active graphics window displaying the pollen calendar generated by the user when result = "plot". This plot may be included in an object by assignment operators.

data.frame including the yearly average pollen amounts for each pollen types used to generate the pollen of the relative abundance when result = "table". This data.frame will be included in an object named annual.sum.data.

If export.plot = FALSE graphical results will only be displayed in the active graphics window as ggplot graph. Additional characteristics may be incorporated to the plot by ggplot syntax (see ggplot2 package).

If export.plot = TRUE and export.format = pdf a pdf file with the plot will be saved within the plot_AeRobiology directory created in the working directory. This option is applicable only for "static" plots. Additional characteristics may be incorporated to the exportation as pdf file (see grDevices package).

If export.plot = TRUE and export.format = png a png file with the plot will be saved within the plot_AeRobiology directory created in the working directory. This option is applicable only for "static" plots. Additional characteristics may be incorporated to the exportation as png file (see grDevices package).

If type.plot = dynamic graphical results will be displayed in the active Viewer window as plotly graph. Additional characteristics may be incorporated to the plot by plotly syntax (see plotly package).

References

Rojo, J., Rapp, A., Lara, B., Sabariego, S., Fernandez_Gonzalez, F. and Perez_Badia, R., 2016. Characterisation of the airborne pollen spectrum in Guadalajara (central Spain) and estimation of the potential allergy risk. Environmental Monitoring and Assessment, 188(3), p.130.

See Also

interpollen

Examples

1
2
data("munich_pollen")
iplot_abundance (munich_pollen, interpolation = FALSE, export.plot = FALSE)

Example output



AeRobiology documentation built on June 3, 2019, 9:03 a.m.