isd_transform: Transform ISD data variables

View source: R/isd_transform.R

isd_transformR Documentation

Transform ISD data variables

Description

Transform ISD data variables

Usage

isd_transform(x)

Arguments

x

(data.frame/tbl_df) data.frame/tbl from isd_parse or data.frame/tbl or list from isd_parse_line

Details

This function helps you clean your ISD data. isd_parse and isd_parse_line give back data without modifying the data. However, you'll likely want to transform some of the variables, in terms of the variable class (character to numeric), accounting for the scaling factor (variable X may need to be multiplied by 1000 according to the ISD docs), and missing values (unfortunately, missing value standards vary across ISD data).

Value

A tibble (data.frame) or list

operations performed

  • scale latitude by factor of 1000

  • scale longitude by factor of 1000

  • scale elevation by factor of 10

  • scale wind speed by factor of 10

  • scale temperature by factor of 10

  • scale temperature dewpoint by factor of 10

  • scale air pressure by factor of 10

  • scale precipitation by factor of 10

  • convert date to a Date class with as.Date

  • change wind direction to numeric

  • change total characters to numeric

See Also

isd_parse, isd_parse_line

Examples

path <- system.file('extdata/104270-99999-1928.gz', package = "isdparser")
(res <- isd_parse(path))
isd_transform(res)

lns <- readLines(path, encoding = "latin1")
# data.frame
(res <- isd_parse_line(lns[1]))
isd_transform(res)
# list
(res <- isd_parse_line(lns[1], as_data_frame = FALSE))
isd_transform(res)

ropensci/isdparser documentation built on Sept. 12, 2022, 8:01 a.m.