parse_damage {noaastormevents} | R Documentation |
Parse damage values
Description
Take damage values that include letters for order of magnitude (e.g., "2K" for $2,000) and return a numeric value of damage.
Usage
parse_damage(damage_vector)
Arguments
damage_vector |
A character vector with damage values (e.g., the |
Details
This function parses the following abbreviations for order of magnitude:
"K": 1,000 (thousand)
"M": 1,000,000 (million)
"B": 1,000,000,000 (billion)
"T": 1,000,000,000,000 (trillion)
Value
The input vector, parsed to a numeric, with abbreviations for orders of magnitude appropriately interpreted (e.g., "2K" in the input vector becomes the numeric 2000 in the output vector).
Examples
damage_crops <- c("150", "2K", "3.5B", NA)
parse_damage(damage_crops)
[Package noaastormevents version 0.2.0 Index]