Skip to contents

This function creates a line plot showing the monthly average of temperature measurements ("temperatura_abrigo_150cm") for multiple Argentine weather stations.

Usage

monthly_temperature_plot(..., colors = NULL, title = "Temperature")

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.

Value

A ggplot object representing the monthly average temperature plot.

Details

The function performs the following steps:

  1. Validates that all inputs are data frames and contain the required columns.

  2. Converts the "fecha" column to "Date" type if necessary.

  3. Extracts the month from the "fecha" column and orders it according to the calendar.

  4. Calculates the monthly average temperature for each station.

  5. 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.