convert_precip: Convert between precipitation metrics

Description Usage Arguments Value Author(s) Examples

Description

This function allows you to convert among the following precipitation metrics: inches, millimeters, and centimeters.

Usage

1
convert_precip(precip, old_metric, new_metric, round = 2)

Arguments

precip

A numerical vector of precipitation to be converted.

old_metric

The metric from which you want to convert. Possible options are:

  • inches: Inches

  • mm: Millimeters

  • cm: Centimeters

new_metric

The metric to which you want to convert. The same options are possible as for old_metric.

round

An integer indicating the number of decimal places to round the converted value.

Value

A numeric vector with precipitation converted to the metric specified by the argument new_metric.

Author(s)

Joshua Ferreri joshua.m.ferreri@gmail.com, Brooke Anderson brooke.anderson@colostate.edu

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
data(breck)
breck$Precip.mm <- convert_precip(breck$Precip.in,
   old_metric = "inches", new_metric = "mm", round = 2)
breck

data(loveland)
loveland$Precip.in <- convert_precip(loveland$Precip.mm,
   old_metric = "mm", new_metric = "inches", round = NULL)
loveland$Precip.cm <- convert_precip(loveland$Precip.mm,
   old_metric = "mm", new_metric = "cm", round = 3)
loveland

geanders/weathermetrics documentation built on May 17, 2019, 12:14 a.m.