| Line 1... |
Line 1... |
| 1 |
% File src/library/base/man/call.Rd
|
1 |
% File src/library/base/man/call.Rd
|
| 2 |
% Part of the R package, https://www.R-project.org
|
2 |
% Part of the R package, https://www.R-project.org
|
| 3 |
% Copyright 1995-2018 R Core Team
|
3 |
% Copyright 1995-2019 R Core Team
|
| 4 |
% Distributed under GPL 2 or later
|
4 |
% Distributed under GPL 2 or later
|
| 5 |
|
5 |
|
| 6 |
\name{call}
|
6 |
\name{call}
|
| - |
|
7 |
\title{Function Calls}
|
| 7 |
\alias{call}
|
8 |
\alias{call}
|
| 8 |
\alias{is.call}
|
9 |
\alias{is.call}
|
| 9 |
\alias{as.call}
|
10 |
\alias{as.call}
|
| 10 |
\title{Function Calls}
|
- |
|
| 11 |
\description{
|
11 |
\description{
|
| 12 |
Create or test for objects of \code{\link{mode}} \code{"call"} (or
|
12 |
Create or test for objects of \code{\link{mode}} \code{"call"} (or
|
| 13 |
\code{"("}, see Details).
|
13 |
\code{"("}, see Details).
|
| 14 |
}
|
14 |
}
|
| 15 |
\usage{
|
15 |
\usage{
|
| Line 21... |
Line 21... |
| 21 |
\item{name}{a non-empty character string naming the function to be called.}
|
21 |
\item{name}{a non-empty character string naming the function to be called.}
|
| 22 |
\item{\dots}{arguments to be part of the call.}
|
22 |
\item{\dots}{arguments to be part of the call.}
|
| 23 |
\item{x}{an arbitrary \R object.}
|
23 |
\item{x}{an arbitrary \R object.}
|
| 24 |
}
|
24 |
}
|
| 25 |
\details{
|
25 |
\details{
|
| - |
|
26 |
\describe{
|
| 26 |
\code{call} returns an unevaluated function call, that is, an
|
27 |
\item{\code{call} }{returns an unevaluated function call, that is, an
|
| 27 |
unevaluated expression which consists of the named function applied to
|
28 |
unevaluated expression which consists of the named function applied to
|
| 28 |
the given arguments (\code{name} must be a quoted string which gives
|
29 |
the given arguments (\code{name} must be a quoted string which gives
|
| 29 |
the name of a function to be called). Note that although the call is
|
30 |
the name of a function to be called). Note that although the call is
|
| 30 |
unevaluated, the arguments \code{\dots} are evaluated.
|
31 |
unevaluated, the arguments \code{\dots} are evaluated.
|
| 31 |
|
32 |
|
| 32 |
\code{call} is a primitive, so the first argument is
|
33 |
\code{call} is a primitive, so the first argument is
|
| 33 |
taken as \code{name} and the remaining arguments as arguments for the
|
34 |
taken as \code{name} and the remaining arguments as arguments for the
|
| 34 |
constructed call: if the first argument is named the name must
|
35 |
constructed call: if the first argument is named the name must
|
| 35 |
partially match \code{name}.
|
36 |
partially match \code{name}.
|
| - |
|
37 |
}
|
| - |
|
38 |
\item{\code{is.call} }{is used to determine whether \code{x} is a call (i.e.,
|
| - |
|
39 |
of mode \code{"call"} or \code{"("}). Note that
|
| - |
|
40 |
\itemize{
|
| - |
|
41 |
\item{\code{is.call(x)} is strictly equivalent to
|
| - |
|
42 |
\code{typeof(x) == "language"}.}
|
| - |
|
43 |
\item{\code{\link{is.language}()} is also true for calls (but also
|
| - |
|
44 |
for \code{\link{symbol}}s and \code{\link{expression}}s where
|
| - |
|
45 |
\code{is.call()} is false).}
|
| - |
|
46 |
}
|
| - |
|
47 |
}
|
| - |
|
48 |
\item{\code{as.call(x)}: }{Objects of mode \code{"list"} can be coerced to mode \code{"call"}.
|
| - |
|
49 |
The first element of the list becomes the function part of the call,
|
| - |
|
50 |
so should be a function or the name of one (as a symbol; a quoted
|
| - |
|
51 |
string will not do).
|
| 36 |
|
52 |
|
| 37 |
\code{is.call} is used to determine whether \code{x} is a call (i.e.,
|
- |
|
| 38 |
of mode \code{"call"} or \code{"("}). Note that
|
53 |
If you think of using \code{as.call(<string>)}, consider using
|
| 39 |
\itemize{
|
- |
|
| 40 |
\item{\code{is.call(x)} is strictly equivalent to
|
54 |
\code{\link{str2lang}(*)} which is an efficient version of
|
| 41 |
\code{typeof(x) == "language"}.}
|
55 |
\code{\link{parse}(text=*)}.
|
| 42 |
\item{\code{\link{is.language}()} is also true for calls (but also
|
56 |
Note that \code{\link{call}()} and \code{\link{as.call}()}, when
|
| 43 |
for \code{\link{symbol}}s and \code{\link{expression}}s where
|
57 |
applicable, are much preferable to these \code{\link{parse}()} based
|
| 44 |
\code{is.call()} is false).}
|
58 |
approaches.
|
| - |
|
59 |
}
|
| 45 |
}
|
60 |
}
|
| 46 |
Objects of mode \code{"list"} can be coerced to mode \code{"call"}.
|
- |
|
| 47 |
The first element of the list becomes the function part of the call,
|
- |
|
| 48 |
so should be a function or the name of one (as a symbol; a quoted
|
- |
|
| 49 |
string will not do).
|
- |
|
| 50 |
|
- |
|
| 51 |
All three are \link{primitive} functions.
|
61 |
All three are \link{primitive} functions.
|
| 52 |
}
|
62 |
}
|
| 53 |
\section{Warning}{
|
63 |
\section{Warning}{
|
| 54 |
\code{call} should not be used to attempt to evade restrictions on the
|
64 |
\code{call} should not be used to attempt to evade restrictions on the
|
| 55 |
use of \code{.Internal} and other non-API calls.
|
65 |
use of \code{.Internal} and other non-API calls.
|
| Line 60... |
Line 70... |
| 60 |
\code{\link{Recall}} for recursive calling of functions;
|
70 |
\code{\link{Recall}} for recursive calling of functions;
|
| 61 |
further
|
71 |
further
|
| 62 |
\code{\link{is.language}},
|
72 |
\code{\link{is.language}},
|
| 63 |
\code{\link{expression}},
|
73 |
\code{\link{expression}},
|
| 64 |
\code{\link{function}}.
|
74 |
\code{\link{function}}.
|
| - |
|
75 |
|
| - |
|
76 |
Producing \code{\link{call}}s etc from character: \code{\link{str2lang}} and
|
| - |
|
77 |
\code{\link{parse}}.
|
| 65 |
}
|
78 |
}
|
| 66 |
\references{
|
79 |
\references{
|
| 67 |
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
|
80 |
Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988)
|
| 68 |
\emph{The New S Language}.
|
81 |
\emph{The New S Language}.
|
| 69 |
Wadsworth & Brooks/Cole.
|
82 |
Wadsworth & Brooks/Cole.
|