extract.raw.tag | R Documentation |
Read raw Spectrum data from a given module
extract.raw.tag(mod.raw, tag, fmt)
mod.raw |
Raw module data returned by read.module.data or module-specific functions |
tag |
A module variable name |
fmt |
Format parameters. See "Details" |
A matrix storing the module variable values.
Spectrum module data uses either "modvar" or non-modvar formats.
modvar formats group data into blocks delimited by a starting tag (e.g. <FirstYear MV2>) and matching "<End>" tag. Starting tags have an embedded version number (e.g. "MV2"; "MV" for version 1) to accommodate the evolution of Spectrum file formats over time.
non-modvar formats also include a starting tag (e.g. "<Projection Name>") but no embedded version number, and no matching "<End>" tag.
The fmt
parameter is a named list that specifies the module data
format and variable layout that should contain the following:
fmt$is.modvar
is TRUE
for modvar format modules and
FALSE
otherwise.
fmt$offset
: the number of rows between the starting tag and the
first row of data.
fmt$nrow
: Number of rows of data, relative to the starting tag row
number + fmt$offset
fmt$offset_col
: (optional) the first row with data. If this is
omitted, the "Data" column is used. Since almost all tag data starts in
the "Data" column, offset_col
usually is not needed.
fmt$ncol
: Number of columns of data, relative to mod.raw$Data.
fmt$cast
is a function used to cast the data from a string to a
desired type. For example, set fmt$type=as.numeric
to return numeric
data.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.