output_CPT: Outputs data in the format for the CPT software

View source: R/output_CPT.R

output_CPTR Documentation

Outputs data in the format for the CPT software

Description

output_CPT returns a data frame to a format suitable for use in the CPT software.

Usage

output_CPT(
  data,
  lat_lon_data,
  station_latlondata,
  latitude,
  longitude,
  station,
  year,
  element,
  long_data = TRUE,
  na_code = -999
)

Arguments

data

data.frame The data.frame to calculate from.

lat_lon_data

data.frame The name of the metadata to calculate from.

station_latlondata

character(1) The name of the station column in lat_lon_data, or data if long_data = FALSE.

latitude

character(1) The name of the latitude column in lat_lon_data, or data if long_data = FALSE.

longitude

character(1) The name of the longitude column in lat_lon_data, or data if long_data = FALSE.

station

character(1) The name of the station column in data, if the data are for multiple station.

year

character(1) The name of the year column in data.

element

character(1) The name of the element column in data to apply the function to.

long_data

logical(1) Whether all columns are in data. If all data is in one data frame then must have long_data = TRUE.

na_code

numeric(1) Indicator for NA values in data.

Value

A data.frame formatted for use in CPT.

Examples

# Create summary data
yearly_niger <- daily_niger %>% dplyr::group_by(station_name, year) %>%
    dplyr::summarise(mean_rain = mean(rain))
output_CPT(data = yearly_niger, lat_lon_data = stations_niger,
           station_latlondata = "station_name", latitude = "lat", longitude = "long",
           station = "station_name", year = "year", element = "mean_rain")

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