Package {climabr}


Title: Interface for Accessing Weather Data from Climatempo
Version: 0.1.0
Description: Provides functions for downloading meteorological data from the CLIMATEMPO (https://www.climatempo.com.br/) web platform through web scraping, designed for ecological and environmental analyses.
License: MIT + file LICENSE
Encoding: UTF-8
URL: https://github.com/jrz-s/climabr
BugReports: https://github.com/jrz-s/climabr/issues
Depends: R (≥ 3.5)
Imports: dplyr, stringr, stringi, purrr, rvest, magrittr, rlang
LazyData: true
Config/roxygen2/version: 8.0.0
NeedsCompilation: no
Packaged: 2026-10-08 16:56:45 UTC; USER
Author: Jhonatan Rafael Zárate-Salazar ORCID iD [aut, cre], Omar E. Benites-Alfaro ORCID iD [ctb], Eduardo V. da Silva Oliveira ORCID iD [ctb], Sidney F. Gouveia ORCID iD [ctb]
Maintainer: Jhonatan Rafael Zárate-Salazar <rzaratesalazar@gmail.com>
Repository: CRAN
Date/Publication: 2026-10-20 17:40:02 UTC

Build climatological dataset

Description

Combines and structures climatological data from multiple locations into a single tidy dataset.

Usage

build_climate_table(
  climate_list,
  n_char_site = 3,
  add_site = TRUE,
  add_avg = TRUE
)

Arguments

climate_list

A list of tibbles containing climatological data.

n_char_site

Numeric. Number of characters used to construct the site identifier.

add_site

Logical. If TRUE, adds a site identifier column.

add_avg

Logical. If TRUE, computes monthly averages across locations.

Details

Main function to retrieve build_climate_table

Value

A tibble containing structured climatological data.


Retrieve climatological data

Description

Retrieves monthly climatological data from Climatempo using flexible location inputs and automated web scraping.

Usage

climate_data(
  region = NULL,
  state = NULL,
  city = NULL,
  max_cities = 5,
  delay = 1,
  add_site = TRUE,
  add_avg = TRUE
)

Arguments

region

Character. Optional region name (e.g., "north", "northeast").

state

Character. State abbreviation or full name (e.g., "se", "sergipe").

city

Character. City name (partial or full; accent-insensitive).

max_cities

Numeric. Maximum number of locations allowed to prevent excessive requests. Default is 5.

delay

Numeric. Time delay in seconds between successive web requests. Default is 1.

add_site

Logical. If TRUE, adds a site identifier column to the output.

add_avg

Logical. If TRUE, computes monthly averages across locations (only when more than one location is selected).

Details

Main function to retrieve climate data

Value

A tibble containing monthly climatological variables, including minimum temperature (tmin), maximum temperature (tmax), and precipitation (precip).

Examples

climate_data(state = "se", city = "aracaju")

Description

Scrapes monthly climatological data from a single Climatempo webpage.

Usage

climate_link(climatologia_link)

Arguments

climatologia_link

Character. URL of the climatology webpage.

Details

Main function to retrieve climate link

Value

A tibble containing monthly values of temperature and precipitation for the specified location.


Retrieve climate data for multiple locations

Description

Fetches climatological data for multiple locations using their associated data source links.

Usage

climate_list(data, ids = NULL, delay = 1)

Arguments

data

A tibble containing location metadata, including a 'links' column.

ids

Optional numeric vector of location identifiers used to filter the dataset.

delay

Numeric. Time delay in seconds between successive web requests.

Details

Main function to retrieve climate_list

Value

A list of tibbles, each containing monthly climatological data for a given location.

Examples

df <- search_locations(state = "se", city = "aracaju")
climate_list(df)

Climate links dataset

Description

A dataset containing links and metadata for Brazilian municipalities

Usage

linksdataset

Format

A data frame with 5 variables:

id

Location ID

region

Region name

state

State abbreviation

city_name

City name

links

Climatempo URL


Match region input

Description

Matches user-provided input to valid Brazilian regions using flexible and approximate string matching.

Usage

match_region(region)

Arguments

region

Character vector containing user-provided region names.

Details

Main function to retrieve match_region

Value

A character vector of matched region names.


Match state input

Description

Matches user-provided input to valid Brazilian state abbreviations using flexible and approximate string matching.

Usage

match_state(state)

Arguments

state

Character vector containing user-provided state names or abbreviations.

Details

Main function to retrieve match_state

Value

A character vector of matched state abbreviations.


Search locations

Description

Searches the internal location database using flexible matching for region, state, and city names.

Usage

search_locations(region = NULL, state = NULL, city = NULL)

Arguments

region

Character. Optional region name.

state

Character. State abbreviation or full name.

city

Character. City name (partial or full).

Details

Main function to retrieve search_locations

Value

A tibble containing matching locations and associated metadata, including region, state, city name, and data source links.

Examples

search_locations(state = "se", city = "arac")

Normalize text

Description

Normalizes text by converting to lowercase, removing diacritics, and eliminating whitespace.

Usage

utils_normalize_slug(x)

Arguments

x

Character vector.

Details

Main function to retrieve utils_normalize_compact

Value

A normalized character vector.


Normalize text

Description

Normalizes text by converting to lowercase, removing diacritics, and eliminating whitespace.

Usage

utils_normalize_text(x)

Arguments

x

Character vector.

Details

Main function to retrieve utils_normalize_text

Value

A normalized character vector.

mirror server hosted at Truenetwork, Russian Federation.