rdwd (version 1.2.0)

createIndex: Create file and meta index of the DWD CDC FTP Server

Description

This is mainly an internal function. Create data.frames out of the vector index returned by indexFTP. For fileIndex (the first output element) createIndex tries to obtain res, var, per, file, id, start and end from the paths. If meta=TRUE, metaIndex and geoIndex are also created. They combine all Beschreibung files into a single data.frame. If you create your own index as suggested in selectDWD (argument findex), you can read the produced file as shown in the example section.

Usage

createIndex(paths, base = dwdbase, dir = "DWDdata",
  fname = "fileIndex.txt", meta = FALSE, metadir = "meta",
  mname = "metaIndex.txt", gname = "geoIndex.txt", overwrite = FALSE,
  checkwarn = TRUE, quiet = FALSE, ...)

Arguments

paths

Char: vector of DWD paths returned by indexFTP called with the same base value as this function

base

Main directory of DWD ftp server, defaulting to observed climatic records. DEFAULT: dwdbase

dir

Char: writeable directory name where to save the main output(s). Created if not existent. DEFAULT: "DWDdata" at current getwd()

fname

Char: Name of file in dir in which to write fileIndex. Use fname="" to suppress writing. DEFAULT: "fileIndex.txt"

meta

Logical: should metaIndex also be created from fileIndex? Uses dataDWD to download files if not present. DEFAULT: FALSE

metadir

Char: Directory (subfolder of dir) where original description files are downloaded to if meta=TRUE. Passed to dataDWD. "" to write in dir. DEFAULT: "meta"

mname

Char: Name of file in dir (not metadir) in which to write metaIndex. Use mname="" to suppress writing. DEFAULT: "metaIndex.txt"

gname

Filename for geoIndex. DEFAULT: "geoIndex.txt"

overwrite

Logical: Overwrite existing fname / mname / gname files? If not, "_n" is added to the filenames, see berryFunctions::newFilename. DEFAULT: FALSE

checkwarn

Logical: warn about checkIndex issues? DEFAULT: TRUE

quiet

Logical: Suppress messages about progress and filenames? DEFAULT: FALSE

Further arguments passed to dataDWD for the meta part.

Value

invisible data.frame (or if meta=TRUE, list with two data.frames) with a number of columns inferred from the paths. Each is also written to disc.

See Also

indexFTP, updateIndexes index, selectDWD

Examples

Run this code
# NOT RUN {
 # Not tested with R CMD check because of file writing
link <- "daily/kl/historical/tageswerte_00699_19490101_19580630_hist.zip"
ind <- createIndex(link, dir=tempdir())
ind
link2 <- "daily/kl/historical/KL_Tageswerte_Beschreibung_Stationen.txt"
link3 <- "daily/kl/recent/KL_Tageswerte_Beschreibung_Stationen.txt"
ind2 <- createIndex(c(link,link2,link3), dir=tempdir(), meta=TRUE)
lapply(ind2, head)
# }
# NOT RUN {
# }

Run the code above in your browser using DataCamp Workspace