readPAR: Reads the value of a parameter in a MAESTRA/MAESPA input...

Description Usage Arguments Value Author(s) See Also Examples

View source: R/readPAR.R

Description

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

1
2
3
readPAR(datfile, parname, namelist = NA, fail = TRUE)

readNameList(datfile, namelist)

Arguments

datfile

Name of the input file.

parname

Name of the parameter.

namelist

The namelist to look in, otherwise looks in the whole file.

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

replacePAR(), readNameList()

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## 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)

RemkoDuursma/Maeswrap documentation built on Nov. 5, 2019, 1:30 p.m.