Generate a Monthly Average Temperature Plot for Multiple Stations
Source:R/montly_temperature_plot.R
monthly_temperature_plot.Rd
This function creates a line plot showing the monthly average of temperature measurements ("temperatura_abrigo_150cm") for multiple Argentine weather stations.
Arguments
- ...
One or more data frames, each containing data for a weather station. Each data frame must include the following columns:
fecha: Date column ("Date" or character) representing the date of the observation.
id: Character or factor column serving as a unique identifier for the weather station.
temperatura_abrigo_150cm: Numeric column representing the temperature measurement at 150 cm height.
You can pass multiple data frames separated by commas, e.g., "station1", "station2", "station3".
- colors
A named vector specifying the colors to use for each station in the plot. The names should correspond to station IDs. If
NULL
, a set of dark colors will be generated automatically.- title
The title of the plot. Defaults to "Temperature" if not specified.
Details
The function performs the following steps:
Validates that all inputs are data frames and contain the required columns.
Converts the "fecha" column to "Date" type if necessary.
Extracts the month from the "fecha" column and orders it according to the calendar.
Calculates the monthly average temperature for each station.
Generates a line plot with points, coloring each station differently.
RECOMMENDATION: Use this function in conjunction with other functions available at @seealso
See also
goatR::download_datasets
to download datasets from Argentine weather stations, and goatR::read_datasets
to read the downloaded datasets into R.