Learn R Programming

Renext (version 3.0-0)

readXML: Read data using an XML index file

Description

Read one or several dataset(s) using an XML index file specifying the data sets to read and the structure of each

Usage

readXML(name,
           dir,
           index = "index.xml",
           TZ = "GMT",
           trace = 0)

Arguments

name
Name for the dataset that will be matched against the name attribute of datasets as they are given in the index file.
dir
Path to the directory where the index file and all data files should be found.
index
Name (short) of the index file. This file must be in the directory given by dir.
TZ
A time zone as in strptime. The time zone "GMT" should be preferred, since it should work on all platforms and can cope with dates in the remote past.
trace
Level of verbosity (integer). Can be used to trace the successive steps by short indications.

Value

  • A list with the data read.
  • infoGeneral information about the data: varName, varShorlLab and varUnit give the variable name unit and short label.
  • OTinfoInformation for the Over the Threshold (OT).
  • OTdataOver the Threshold (OT) data.
  • OTmissingMissing periods within the OTdata period.
  • MAXinfoInformation for the MAX ($r$-largest) supplement data.
  • MAXdataMAX supplement data.
  • OTSinfoInformation for the Over the Threshold Supplement (OTS) data.
  • OTSdataOver the Threshold (OT) supplement data.

Details

The XML index file is parsed within R. Then according to the indications within the index file, other files are read (e.g. csv files). In this way, data returned as a list can contain heterogeneous data: Over Threshold (OT) data, missing periods, MAX data, etc. Various pieces of information are also stored in list elements with name containing the "info" string. This function requires the CRAN package XML.

See Also

See Brest for an example of such a list.

Examples

Run this code
## Examples of datasets that can be read
## Browse should work for browsers with xslt support
browseURL(file.path(system.file("Rendata", package = "Renext"), "index.xml"))
if (require(XML)) {
   ## use 'index.xml' file shiped with Renext
   dir1 <- system.file("Rendata", package = "Renext")
   BrestNew1 <- readXML(name = "Brest", dir = dir1)
   test1 <- readXML(name = "test1", dir = dir1)
}

Run the code above in your browser using DataLab