ARPALdf_Summary: Summary statistics for a data frame of class 'ARPALdf'

View source: R/ARPALdf_Summary.R

ARPALdf_SummaryR Documentation

Summary statistics for a data frame of class 'ARPALdf'

Description

'ARPALdf_Summary' returns many descriptive statistics summaring the data contained in a data frame of class ARPALdf. Statistics are calculated at overall level (full sample), by station ID and by year. For each variable are reported the basic positioning indices (min, max, mean, median, quantile) and variability indices (range, standard deviation). Other reported statistics are the Pearson's linear correlation by station and some graphical representation of the distribution (kernel density plot, histogram, boxplot). In addition, the function returns useful data-quality information, such as gap length statistics (i.e. number of missing observations for each variable by station and by year) and outlier detection tools (e.g., Hampel filter and boxplot rule)

Usage

ARPALdf_Summary(
  Data,
  by_IDStat = TRUE,
  by_Year = TRUE,
  gap_length = TRUE,
  correlation = TRUE,
  histogram = FALSE,
  density = FALSE,
  outlier = FALSE,
  verbose = TRUE
)

Arguments

Data

Dataset of class 'ARPALdf' containing the data to be summarised.

by_IDStat

Logic value (TRUE or FALSE). Use TRUE (default) to compute summary statistics by Station ID.

by_Year

Logic value (TRUE or FALSE). Use TRUE (default) to compute summary statistics by year.

gap_length

Logic value (TRUE or FALSE). Use TRUE (default) to compute summary statistics for the gap length of each variable.

correlation

Logic value (TRUE or FALSE). Use TRUE (default) to compute linear correlation of available variables.

histogram

Logic value (TRUE or FALSE). Use TRUE to plot the histogram of each variable. Default is FALSE.

density

Logic value (TRUE or FALSE). Use TRUE to plot the kernel density plot of each variable. Default is FALSE.

outlier

Logic value (TRUE or FALSE). Use TRUE to analyse extreme values of each variable (boxplot and Hampel filter). Default is FALSE.

verbose

Logic value (TRUE or FALSE). Toggle warnings and messages. If 'verbose = TRUE' (default) the function prints on the screen some messages describing the progress of the tasks. If 'verbose = FALSE' any message about the progression is suppressed.

Value

A list of data.frames containing summary descriptive statistics for a data frame of class 'ARPALdf'. Summary statistics are computed for the overall sample (Descr), by Station ID (Descr_by_IDStat) and by year (Descr_by_Year). Available statistics are: number of NAs, number of negative values, minimum, mean, maximum and standard deviation.

Examples


## Download daily air quality data from all the stations for year 2020
if (require("RSocrata")) {
  d <- get_ARPA_Lombardia_AQ_data(ID_station = NULL, Date_begin = "2020-01-01",
            Date_end = "2020-12-31", Frequency = "daily")
 }
## Summarising observed data
sum_stats <- ARPALdf_Summary(Data = d)



ARPALData documentation built on Sept. 26, 2023, 5:07 p.m.