\name{ConfigMatchingVars}
\alias{ConfigMatchingVars}
%- Also NEED an '\alias' for EACH other topic documented here.
\title{
%%  ~~function to do ... ~~
}
\description{
%%  ~~ A concise (1-5 lines) description of what the function does. ~~
}
\usage{
ConfigMatchingVars(configuration, var, show = TRUE)
}
%- maybe also 'usage' for other objects documented here.
\arguments{
  \item{configuration}{
%%     ~~Describe \code{configuration} here~~
}
  \item{var}{
%%     ~~Describe \code{var} here~~
}
  \item{show}{
%%     ~~Describe \code{show} here~~
}
}
\details{
%%  ~~ If necessary, more details than the description above ~~
}
\value{
%%  ~Describe the value returned
%%  If it is a LIST, use
%%  \item{comp1 }{Description of 'comp1'}
%%  \item{comp2 }{Description of 'comp2'}
%% ...
}
\references{
%% ~put references to the literature/web site here ~
}
\author{
%%  ~~who you are~~
}
\note{
%%  ~~further notes~~
}

%% ~Make other sections like Warning with \section{Warning }{....} ~

\seealso{
%% ~~objects to See Also as \code{\link{help}}, ~~~
}
\examples{
##---- Should be DIRECTLY executable !! ----
##-- ==>  Define data, use random,
##--	or do  help(data=index)  for the standard data sets.

## The function is currently defined as
function (configuration, var, show = TRUE) 
{
    isFullMatch <- function(x, name) {
        ifelse(x > 0 && attributes(x)$match.length == nchar(name), 
            TRUE, FALSE)
    }
    if (length(configuration$two_d_vars) > 0) {
        entries_in_2d_vars <- which(unlist(lapply(lapply(as.list(configuration$two_d_vars), 
            regexpr, var), isFullMatch, var)))
        has_entries_in_2d_vars <- length(entries_in_2d_vars) > 
            0
    }
    else {
        has_entries_in_2d_vars <- FALSE
    }
    if (length(configuration$global_mean_vars) > 0) {
        entries_in_global_mean_vars <- which(unlist(lapply(lapply(as.list(configuration$global_mean_vars), 
            regexpr, var), isFullMatch, var)))
        has_entries_in_global_mean_vars <- length(entries_in_global_mean_vars) > 
            0
    }
    else {
        has_entries_in_global_mean_vars <- FALSE
    }
    if (has_entries_in_2d_vars) {
        is_2d_var <- TRUE
        if (show) {
            print(paste("* In list of 2-dimensional variables:", 
                configuration$two_d_vars[(entries_in_2d_vars)[1]]))
        }
    }
    else if (has_entries_in_global_mean_vars) {
        is_2d_var <- FALSE
        if (show) {
            print(paste("* In list of global mean variables:", 
                configuration$global_mean_vars[(entries_in_global_mean_vars)[1]]))
        }
    }
    else {
        stop("Error: The variable specified is not available. Please check the supported variables in the configuration file.")
    }
    invisible(is_2d_var)
  }
}
% Add one or more standard keywords, see file 'KEYWORDS' in the
% R documentation directory.
\keyword{ ~kwd1 }
\keyword{ ~kwd2 }% __ONLY ONE__ keyword per line
