setPrjOutputVariables: Sets the output variables in a CRHM model '.prj' file

View source: R/setPrjOutputVariables.R

setPrjOutputVariablesR Documentation

Sets the output variables in a CRHM model .prj file

Description

Sets the output variables in a CRHM model .prj file

Usage

setPrjOutputVariables(
  inputPrjFile = "",
  variables = "",
  outputPrjFile = "",
  logfile = ""
)

Arguments

inputPrjFile

Required. Name of the .prj file.

variables

Required. Variables to be written to output file. These may be either a character vector combining the variable module, variable name and HRUs or a dataframe with the same information in 3 separate columns. Either format can be returned by setOutputVariables. If the null is specified for variables, then all variables are removed.

outputPrjFile

Optional. If omitted, the input .prj file will be overwritten.

logfile

Optional. Name of the file to be used for logging the action. Normally not used.

Value

If successful, returns TRUE. If unsuccessful, returns FALSE.

Author(s)

Kevin Shook

See Also

readPrjOutputVariables setPrjDates

Examples

## Not run: 
# read in existing variables as a vector
variables <- readPrjOutputVariables('Bad_Lake_1974-1975.prj', asDataframe=FALSE)

# delete the first set of variables and write to a new file
variables <- variables[-1]
setPrjOutputVariables('Bad_Lake_1974-1975.prj', variables, 'Bad_Lake_1974-1975_revised.prj')

# read in existing variables as a dataframe and write to new file
variables <- readPrjOutputVariables('Bad_Lake_1974-1975.prj', asDataframe=TRUE)
newVariables <- c('evap', 'evapGrangerD', '1 2 3 4 5')
variables <- rbind(variables, newVariables)
setPrjOutputVariables('Bad_Lake_1974-1975.prj', variables, 'Bad_Lake_1974-1975_revised2.prj')

# deletes all output variables and overwrites the file
result <- setPrjOutputVariables('Bad_Lake_1974-1975.prj', 'null')
## End(Not run)

CentreForHydrology/CRHMr documentation built on April 6, 2024, 5:27 p.m.