read_smn_multiple: Reads a file from the SwissMetNet of MeteoSwiss containing...

View source: R/read-smn.R

read_smn_multipleR Documentation

Reads a file from the SwissMetNet of MeteoSwiss containing multiple Exports

Description

One peculiarity of MeteoSwiss is to provide multiple exports concatenated in one file, starting with a line containing a single space and seperated by two newlines. This function reads the whole file into the memory, splits the part and applies the read function to each part. Is the file too big for the available memory, the function split_smn() can split the file into multiple files each containing one part. On Linux the commandline tool csplit is another probably faster tool.

Usage

read_smn_multiple(fn, as_list = FALSE, encoding = "UTF-8", ...)

Arguments

fn

path to input file

as_list

return a list with each part as element rather than one concatenated tibble

encoding

encoding of the data file. Default = "UTF-8"

...

parameters passed to read_smn()

Value

tibble or list of tibbles in rOstluft long format structure

See Also

  • read_smn()

  • split_smn()

  • csplit - split a file into sections determined by context lines

Examples

fn <- system.file("extdata", "smn_multi.txt", package = "rOstluft.data", mustWork = TRUE)
read_smn_multiple(fn, as_list = TRUE)


Ostluft/rOstluft documentation built on Feb. 6, 2024, 1:26 a.m.