Learn R Programming

rdwd (version 0.7.0)

readDWD: Process data from the DWD CDC FTP Server

Description

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.

Usage

readDWD(file, dir = "DWDdata", meta = substr(file, nchar(file) - 3, 10000)
  == ".txt", format = NA, tz = "GMT", progbar = TRUE)

Arguments

file

Char (vector): name(s) of the file(s) downloaded with dataDWD, e.g. "tageswerte_KL_02575_akt.zip" or "RR_Stundenwerte_Beschreibung_Stationen.txt"

dir

Char: directory name where to read the file. Use "." or "" if file already includes a (relative or absolute) path. DEFAULT: "DWDdata" at current getwd()

meta

Logical (vector): is the file a meta file? DEFAULT: TRUE for each file ending in ".txt"

format

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

tz

Char (vector): time zone for as.POSIXct. "" is the current time zone, and "GMT" is UTC (Universal Time, Coordinated). DEFAULT: "GMT"

progbar

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

Value

Invisible data.frame of the desired dataset, or a list of data.frames if length(file) > 1.

See Also

dataDWD, selectDWD

Examples

Run this code
# see dataDWD

Run the code above in your browser using DataLab