Read climate (meta) data that was downloaded with dataDWD
.
The file is read, processed and returned as a data.frame.
If meta=TRUE
: column widths for read.fwf
are computed internally.
file
can be a vector with several filenames. The arguments meta
and format
can also be a vecor and will be recycled to the length of file
.
readDWD(file, dir = "DWDdata", meta = substr(file, nchar(file) - 3, 10000)
== ".txt", format = NA, tz = "GMT", progbar = TRUE)
Char (vector): name(s) of the file(s) downloaded with dataDWD
,
e.g. "tageswerte_KL_02575_akt.zip" or
"RR_Stundenwerte_Beschreibung_Stationen.txt"
Char: directory name where to read the file. Use "."
or ""
if file
already includes a (relative or absolute) path.
DEFAULT: "DWDdata" at current getwd()
Logical (vector): is the file
a meta file?
DEFAULT: TRUE for each file ending in ".txt"
Char (vector): if meta=FALSE
: Format passed to
as.POSIXct
(see strptime
)
to convert the date/time column to POSIX time format.
If NULL, no conversion is performed (date stays a factor).
If NA, readDWD
tries to find suitable format based
on the number of characters. DEFAULT: NA
Char (vector): time zone for as.POSIXct
.
"" is the current time zone, and "GMT" is UTC (Universal Time,
Coordinated). DEFAULT: "GMT"
Logical: present a progress bar with estimated remaining time?
If missing and length(file)==1, progbar is internally set to FALSE.
Only works if the R package pbapply
is available. DEFAULT: TRUE
Invisible data.frame of the desired dataset, or a list of data.frames if length(file) > 1.