The R Project SVN R

Rev

Rev 61433 | Rev 65147 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61433 Rev 61598
Line 1... Line 1...
1
% File src/library/base/man/lapply.Rd
1
% File src/library/base/man/lapply.Rd
2
% Part of the R package, http://www.R-project.org
2
% Part of the R package, http://www.R-project.org
3
% Copyright 1995-2011 R Core Team
3
% Copyright 1995-2013 R Core Team
4
% Distributed under GPL 2 or later
4
% Distributed under GPL 2 or later
5
 
5
 
6
\name{lapply}
6
\name{lapply}
7
\title{Apply a Function over a List or Vector}
7
\title{Apply a Function over a List or Vector}
8
\alias{lapply}
8
\alias{lapply}
Line 103... Line 103...
103
 
103
 
104
  Simplification is always done in \code{vapply}.  This function
104
  Simplification is always done in \code{vapply}.  This function
105
  checks that all values of \code{FUN} are compatible with the
105
  checks that all values of \code{FUN} are compatible with the
106
  \code{FUN.VALUE}, in that they must have the same length and type.
106
  \code{FUN.VALUE}, in that they must have the same length and type.
107
  (Types may be promoted to a higher type within the ordering logical
107
  (Types may be promoted to a higher type within the ordering logical
108
  < integer < real < complex, but not demoted.)
108
  < integer < double < complex, but not demoted.)
109
 
109
 
110
  Users of S4 classes should pass a list to \code{lapply} and
110
  Users of S4 classes should pass a list to \code{lapply} and
111
  \code{vapply}: the internal coercion is done by the \code{as.list} in
111
  \code{vapply}: the internal coercion is done by the \code{as.list} in
112
  the base namespace and not one defined by a user (e.g. by setting S4
112
  the base namespace and not one defined by a user (e.g. by setting S4
113
  methods on the base function).
113
  methods on the base function).
Line 122... Line 122...
122
  For \code{sapply(simplify = TRUE)} and \code{replicate(simplify =
122
  For \code{sapply(simplify = TRUE)} and \code{replicate(simplify =
123
  TRUE)}: if \code{X} has length zero or \code{n = 0}, an empty list.
123
  TRUE)}: if \code{X} has length zero or \code{n = 0}, an empty list.
124
  Otherwise an atomic vector or matrix or list of the same length as
124
  Otherwise an atomic vector or matrix or list of the same length as
125
  \code{X} (of length \code{n} for \code{replicate}).  If simplification
125
  \code{X} (of length \code{n} for \code{replicate}).  If simplification
126
  occurs, the output type is determined from the highest type of the
126
  occurs, the output type is determined from the highest type of the
127
  return values in the hierarchy NULL < raw < logical < integer < real <
127
  return values in the hierarchy NULL < raw < logical < integer < double <
128
  complex < character < list < expression, after coercion of pairlists
128
  complex < character < list < expression, after coercion of pairlists
129
  to lists.
129
  to lists.
130
 
130
 
131
  \code{vapply} returns a vector or array of type matching the
131
  \code{vapply} returns a vector or array of type matching the
132
  \code{FUN.VALUE}.  If \code{length(FUN.VALUE) == 1} a
132
  \code{FUN.VALUE}.  If \code{length(FUN.VALUE) == 1} a