Generates a summary table of temperature data from multiple stations.
Value
A data frame summarizing the temperature statistics for each station, including:
Average temperature ('average_temperature')
Maximum temperature ('max_temperature')
Minimum temperature ('min_temperature')
Standard deviation of temperature ('standard_deviation')
Total number of days with temperature data ('total_days')
Details
The function temperature_summary_table() takes one or more data frames as input, each containing temperature data from different weather stations, and returns a summary of the temperature statistics for each station. The required columns are: "id" for station identifiers and "temperatura_abrigo_150cm" for temperature measurements at 150 cm height.
The function combines the input data frames into a single data frame, validates that the required columns are present, and groups the data by station ID to compute the summary statistics. If any input data frame lacks the required columns "id" or "temperatura_abrigo_150cm", the function will stop with an error message.
WARNING: This function will stop if the required columns are not found in any of the data frames provided.
See also
goatR::read_datasets
to load and view the temperature datasets.
Examples
# Example of using temperature_summary_table with two data frames
df1 <- data.frame(id = c(1, 1, 2, 2), temperatura_abrigo_150cm = c(15, 18, 20, 22))
df2 <- data.frame(id = c(1, 3, 3, 3), temperatura_abrigo_150cm = c(17, 21, 19, 16))
temperature_summary_table(df1, df2)
#> # A tibble: 3 × 6
#> id average_temperature max_temperature min_temperature standard_deviation
#> <dbl> <dbl> <dbl> <dbl> <dbl>
#> 1 1 16.7 18 15 1.53
#> 2 2 21 22 20 1.41
#> 3 3 18.7 21 16 2.52
#> # ℹ 1 more variable: total_days <int>