-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcheck_named_list.Rd
28 lines (26 loc) · 1.19 KB
/
check_named_list.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/utils.R
\name{check_named_list}
\alias{check_named_list}
\title{Check that a list is named}
\source{
This function is taken from the `utils.add' package (https://github.com/edwardlavender/utils.add). It is defined separately in \code{\link[flapper]{flapper}} to reduce reliance on non-default packages.
}
\usage{
check_named_list(arg = deparse(substitute(input)), input, ignore_empty = TRUE)
}
\arguments{
\item{arg}{(optional) A character string which defines the argument of a parent function.}
\item{input}{A list.}
\item{ignore_empty}{A logical input which defines whether or not to ignore empty lists.}
}
\value{
The function returns a helpful error message for unnamed lists (ignoring empty lists if requested) or the inputted list unchanged.
}
\description{
This function checks that the top level of a list is named (ignoring empty lists if requested). If the list is not named, the function returns a helpful error message. Otherwise, the list is returned unchanged. This is particularly useful within functions that use \code{\link[base]{do.call}} to evaluate lists of arguments.
}
\author{
Edward Lavender
}
\keyword{internal}