Skip to contents

Writes data returned by any of import_isd_hourly(), import_ghcn_hourly(), or import_ghcn_daily() to a file. Each station and year in the data is written to a separate file.

Usage

write_met(
  x,
  path = ".",
  ext = c("rds", "delim", "parquet"),
  delim = ",",
  suffix = "",
  progress = rlang::is_interactive()
)

Arguments

x

A data frame imported by import_isd_hourly(), import_ghcn_hourly(), or import_ghcn_daily().

path

The path to a directory to save each file. By default, this is the working directory.

ext

The file type to use when saving the data. Can be "rds", "delim" or "parquet". Note that "parquet" requires the arrow package.

delim

Delimiter used to separate values when ext = "delim". Must be a single character. Defaults to being comma-delimited (",").

suffix

An additional suffix to append to file names. Useful examples could be "_isd", "_hourly", "_lite", and so on.

progress

Show a progress bar when writing many stations/years? Defaults to TRUE in interactive R sessions. Passed to .progress in purrr::walk().

Value

write_met() returns path invisibly.

See also

Other Met writing functions: write_adms()

Examples

if (FALSE) { # \dontrun{
# import some data then export it
dat <- import_isd_hourly(year = 2012)
write_met(dat)
} # }