% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/checkNamed.R
\name{checkNamed}
\alias{checkNamed}
\alias{check_named}
\alias{assertNamed}
\alias{assert_named}
\alias{testNamed}
\alias{test_named}
\title{Check if an argument is named}
\usage{
checkNamed(x, type = "named")

check_named(x, type = "named")

assertNamed(x, type = "named", .var.name = vname(x), add = NULL)

assert_named(x, type = "named", .var.name = vname(x), add = NULL)

testNamed(x, type = "named")

test_named(x, type = "named")
}
\arguments{
\item{x}{[any]\cr
Object to check.}

\item{type}{[character(1)]\cr
Select the check(s) to perform.
\dQuote{unnamed} checks \code{x} to be unnamed.
\dQuote{named} (default) checks \code{x} to be named which excludes names to be \code{NA} or empty (\code{""}).
\dQuote{unique} additionally tests for non-duplicated names.
\dQuote{strict} checks for unique names which comply to R's variable name restrictions.
Note that for zero-length \code{x} every name check evaluates to \code{TRUE}.}

\item{.var.name}{[\code{character(1)}]\cr
Name of the checked object to print in assertions. Defaults to
the heuristic implemented in \code{\link{vname}}.}

\item{add}{[\code{AssertCollection}]\cr
Collection to store assertion messages. See \code{\link{AssertCollection}}.}
}
\value{
Depending on the function prefix:
 If the check is successful, the functions 
 \code{assertNamed}/\code{assert_named} return 
 \code{x} invisibly, whereas
 \code{checkNamed}/\code{check_named} and 
 \code{testNamed}/\code{test_named} return 
 \code{TRUE}.
 If the check is not successful, 
 \code{assertNamed}/\code{assert_named}
 throws an error message, 
 \code{testNamed}/\code{test_named}
 returns \code{FALSE},
 and \code{checkNamed}/\code{check_named} 
 return a string with the error message.
 The function \code{expect_named} always returns an
 \code{\link[testthat]{expectation}}.
}
\description{
Check if an argument is named
}
\note{
These function are deprecated and will be removed in a future version.
Please use \code{\link{checkNames}} instead.
}
\examples{
x = 1:3
testNamed(x, "unnamed")
names(x) = letters[1:3]
testNamed(x, "unique")
}
\seealso{
Other attributes: 
\code{\link{checkClass}()},
\code{\link{checkMultiClass}()},
\code{\link{checkNames}()}
}
\concept{attributes}
