% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/def.arg.pars.R
\name{def.arg.pars}
\alias{def.arg.pars}
\title{Parse input argument strings into list of named parameters}
\usage{
def.arg.pars(
  arg,
  NameParaReqd = NULL,
  NameParaOptn = NULL,
  ValuParaOptn = NULL,
  TypePara = NULL,
  log = NULL
)
}
\arguments{
\item{arg}{Character vector of argument strings, each in the format "Para=value", where "Para" 
is the intended parameter name and "value" is the value of the parameter. If the value string contains
pipes (|), the value string will be split into a character vector with | and/or : used as the delimiter. 
If a value string begins with a $ (e.g. "$DIR_IN"), the value of the parameter will be assigned from 
the system environment variable matching the value string.  Note that the value string is first 
split into a character vector based on the delimiters, then each relevant string of the resultant
character vector is evaluated as an environment variable.}

\item{NameParaReqd}{character vector of required parameter names as a check on the output parameter 
list. Defaults to NULL, in which case there are no required parameters.}

\item{NameParaOptn}{character vector of optional parameter names as a check on the output parameter 
list. Defaults to NULL, in which case there are no optional parameters. If both NameParaReqd and
NameParaOptn are NULL, no check is performed on the output parameter list.}

\item{ValuParaOptn}{Named list of default values (in desired class) for the optional parameter arguments 
in NameParaOptn. Defaults to NULL. Any optional arguments missing from this list will not be included
in the output parameter list if they are not provided by the user.}

\item{TypePara}{Named list of R classes to convert the corresponding parameter to. For example, 
TypePara=list(Para1="numeric") will attempt to convert the value of Para1 to numeric. Defaults to
NULL, in which case no type conversion will be attempted.}

\item{log}{A logger object as produced by NEONprocIS.base::def.log.init to produce structured log
output in addition to standard R error messaging. Defaults to NULL, in which the logger will be
created and used within the function.}
}
\value{
A named list of parameters.
}
\description{
Definition function. Parse the input arguments as read from the command line into a named
parameter list. Each input argument must be a character string in the format "Para=value", 
where "Para" is the intended parameter name and "value" is the value of the parameter. Options 
include: checking for expected parameter names, parsing of each parameter value into a vector, 
reading the parameter value(s) from environment variables, conversion of each paramater from the 
default class of character to any other recognized class, and logging via the lgr package.
}
\examples{
arg <- c("DirIn=/scratch/test","DirOut=$DIR_OUT","Freq=10|20")
NameParaReqd <- c("DirIn","DirOut")
NameParaOptn <- "Freq"
TypePara<-list(DirIn="character",DirOut="character",Freq="numeric")
Para <- NEONprocIS.base::def.arg.pars(arg=arg,NameParaReqd=NameParaReqd,NameParaOptn=NameParaOptn,TypePara=TypePara)
# Result
# > Para
# $DirIn
# [1] "/scratch/test" 

# $DirOut
[1] "/scratch/test/out" # Read of environment variable $DIR_OUT

# $Freq
# [1] 10 20
}
\references{
License: (example) GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
}
\seealso{
\code{\link[NEONprocIS.base]{def.vect.pars.pair}}

\code{\link[NEONprocIS.base]{def.log.init}}
}
\author{
Cove Sturtevant \email{csturtevant@battelleecology.org}
}
\keyword{Currently}
\keyword{none}
