Learn R Programming

isdparser (version 0.4.0)

isd_parse_line: Parse NOAA ISD/ISH data files - line by line

Description

Parse NOAA ISD/ISH data files - line by line

Usage

isd_parse_line(x, additional = TRUE, as_data_frame = TRUE)

Arguments

x

(character) a single ISD line

additional

(logical) include additional and remarks data sections in output. Default: TRUE

as_data_frame

(logical) output a tibble. Default: FALSE

Value

A tibble (data.frame)

References

ftp://ftp.ncdc.noaa.gov/pub/data/noaa

See Also

isd_parse

Examples

Run this code
# NOT RUN {
path <- system.file('extdata/024130-99999-2016.gz', package = "isdparser")
lns <- readLines(path, encoding = "latin1")
isd_parse_line(lns[1])
isd_parse_line(lns[1], FALSE)

res <- lapply(lns[1:1000], isd_parse_line)
library("data.table")
library("tibble")
as_tibble(
 rbindlist(res, use.names = TRUE, fill = TRUE)
)

# only control + mandatory sections
isd_parse_line(lns[10], additional = FALSE)
isd_parse_line(lns[10], additional = TRUE)
# }

Run the code above in your browser using DataLab