Rev 3279 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
\name{list}\title{Lists -- Generic and Dotted Pairs}\usage{list(\dots)pairlist(\dots)as.list(x)as.list.default(x)as.pairlist(x)is.list(x)is.pairlist(x)alist(\dots)}\alias{list}\alias{pairlist}\alias{alist}\alias{as.list}\alias{as.list.default}\alias{as.list.data.frame}\alias{as.pairlist}\alias{is.list}\alias{is.pairlist}\description{Functions to construct, coerce and check for all kinds of \R lists.}\details{Since version 0.63, most lists in \R internally are \emph{GenericVectors}, whereas traditional \emph{dotted pair} lists (as in LISP)are still available.The arguments to \code{list} or \code{pairlist} are of the form\code{value} or \code{tag=value}.The functions return a list composed of its argumentswith each value either tagged or untagged,depending on how the argument was specified.\code{alist} is like \code{list}, except in the handling of taggedarguments with no value. These are handled as if they describedfunction arguments with no default (cf. \code{\link{formals}}), whereas\code{list} simply ignores them.\code{as.list} attempts to coerce its argument to list type.For functions, this returns the concatenation of the list of formalsarguments and the function body. For expressions, the list ofconstituent calls is returned.\code{is.list} returns \code{TRUE} iff its argumentis a \code{list} \emph{or} a \code{pairlist} of \code{length}\eqn{> 0},whereas \code{is.pairlist} only returns \code{TRUE} in the latter case.An empty pairlist, \code{pairlist()} is the same as \code{NULL}. Thisis different from \code{list()}.}\seealso{\code{\link{vector}(., mode="list")}, \code{\link{c}}, for concatenation;\code{\link{formals}}.}\examples{data(cars)# create a plotting structurepts <- list(x=cars[,1], y=cars[,2])plot(pts)# Argument listsf <- function()x# Note the specification of a "..." argument:formals(f) <- al <- alist(x=, y=2, ...=)fstr(al)str(pl <- as.pairlist(ps.options()))## These are all TRUE:is.list(pl) && is.pairlist(pl)!is.null(list())is.null(pairlist())!is.list(NULL)is.pairlist(pairlist())is.null(as.pairlist(list()))is.null(as.pairlist(NULL))}\keyword{list}\keyword{manip}