% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/def.vect.pars.pair.R
\name{def.vect.pars.pair}
\alias{def.vect.pars.pair}
\title{Parse vector into key:value pairs}
\usage{
def.vect.pars.pair(
  vect,
  KeyExpc = NULL,
  ValuDflt = NA,
  NameCol = c("key", "value"),
  Type = rep(base::class(vect), 2),
  log = NULL
)
}
\arguments{
\item{vect}{Vector of class numeric or character. If length of vect is 1, all expected 
keys indicated in KeyExpc will be assigned this value. If length of vect is in multiples
of 2, the first value of each pair is assigned the key and the second value of each pair
is assigned the value.}

\item{KeyExpc}{A vector of expected keys. If these are missing in vect, they will be created.
Each missing key will be assigned the value of vect if it is length 1, otherwise the value in
ValuDflt.  Defaults to NULL, in which case no checking for missing keys will be done. Must not
be NULL if vect is a single value.}

\item{ValuDflt}{A single value (character or numeric) of the default value to assign any keys 
in KeyExpc that are not found in vect. Note that if vect is length 1, any missing keys will 
be assigned the value in vect rather than ValuDflt. Defaults to NA.}

\item{NameCol}{Character vector of length 2 indicating the names of the output columns.
Column names default to key and value.}

\item{Type}{A 2-element vector indicating the respective R data classes of the keys and 
values. Defaults to the class of vect.}

\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 data frame with parsed key:value pairs.
}
\description{
Definition function. Parse the elements of a vector into key:value pairs.
}
\examples{
# Vector input represents key:value pairs
vect <- c('key1','1.5')
KeyExpc <- c('key1','key2','key3')
ValuDflt <- 3
NameCol <- c('MyKey','MyValue')
Type <- c('character','numeric')
NEONprocIS.base::def.vect.pars.pair(vect=vect,KeyExp=KeyExpc,ValuDflt=ValuDflt,NameCol=NameCol,Type=Type)

# Single value input for vect
vect <- 5
KeyExpc <- c('key1','key2','key3')
NameCol <- c('MyKey','MyValue')
Type <- c('character','numeric')
NEONprocIS.base::def.vect.pars.pair(vect=vect,KeyExp=KeyExpc,NameCol=NameCol,Type=Type)
}
\references{
License: (example) GNU AFFERO GENERAL PUBLIC LICENSE Version 3, 19 November 2007
}
\seealso{
\code{\link[NEONprocIS.base]{def.arg.pars}}
}
\author{
Cove Sturtevant \email{csturtevant@battelleecology.org}
}
\keyword{Currently}
\keyword{none}
