readNameList {Maeswrap} | R Documentation |
Read a namelist into a list
Description
Read a namelist into a list
The readPAR
function reads the value of any parameter in a namelist
in one of the MAESTRA/MAESPA input files. Also works for other text files
that have the FORTRAN namelist input structure. Optionally specifies in
which namelist to look for the parameter.
To read an entire namelist into a list, use the readNameList
function.
Usage
readNameList(datfile, namelist)
readPAR(datfile, parname, namelist = NA, fail = TRUE)
Arguments
datfile |
Name of the Maestra/Maespa input file (e.g. "trees.dat") |
namelist |
Name of the namelist (e.g. "plot") |
parname |
Name of the parameter. |
fail |
Logical. If TRUE, stops with an error when parameter is not found (if FALSE, returns NA) |
Value
For readPAR
, either one value, or a vector, depending on how
many values are specified for the parameter in the input file.
For readNameList
, a named list.
Author(s)
Remko Duursma. Thanks to Andreas Ibrom for reporting a bug.
See Also
Examples
## Not run:
# Read the number of trees in the plot:
readPAR("confile.dat", "notrees", "plot")
# Read the X and Y coordinates:
readPAR("confile.dat", "xycoords", "xy")
# Read entire namelist
readNameList("trees.dat", "plot")
## End(Not run)