prepare_climdex: Prepare data in the format for RClimDex

View source: R/prepare_climdex.R

prepare_climdexR Documentation

Prepare data in the format for RClimDex

Description

prepare_climdex rearranges a data frame to a format suitable for use in RClimDex. This data frame can be rearranged and exported to a file or connection with export_climdex.

Usage

prepare_climdex(
  data,
  prcp,
  tmax,
  tmin,
  date = NULL,
  year = NULL,
  month = NULL,
  day = NULL,
  na = -99.9
)

Arguments

data

data.frame data.frame of daily climatic data in tidy format i.e. one row per day and one column per element.

prcp

character(1) Name of the precipitation/rainfall column in data.

tmax

character(1) Name of the maximum temperature column in data.

tmin

character(1) Name of the minimum temperature column in data.

date

character(1) Name of the date column in data. This is only needed if year, month, and day are not specified.

year

character(1) Name of the year column in data. If NULL it will be created using lubridate::year(data[[date]]).

month

character(1) Name of the month column in data. If NULL it will be created using lubridate::month(data[[date]]).

day

character(1) Name of the day of the month column in data. If NULL it will be created using lubridate::day(data[[date]]).

na

integer(1) The value to replace missing values with. The default (-99.9) should be used to comply with the RClimDex format requirements.

Value

A data.frame formatted for use in RClimDex

Examples

# Preparing the daily_niger data for export to ClimDex
prepare_climdex(data = daily_niger, date = "date", prcp = "rain", tmax = "tmax", tmin = "tmin")


IDEMSInternational/cdms.products documentation built on July 7, 2023, 10:13 a.m.