[ RDocumentation ](/)

Moon  [ ](https://github.com/datacamp/rdocumentation-2.0) [ Learn R
](https://www.datacamp.com/learn/r)

Search all packages and functions

[ base  (version  3.6.2  ) ](/packages/base/versions/3.6.2)

#  call: Function Calls

##  Description

Create or test for objects of ` [ mode
](/link/mode?package=base&version=3.6.2) ` ` "call" ` (or ` "(" ` , see
Details).

##  Usage

    
    
    call(name, …)
    is.call(x)
    as.call(x)

##  Arguments

name

a non-empty character string naming the function to be called.

…

arguments to be part of the call.

x

an arbitrary  R  object.

##  Warning

` call ` should not be used to attempt to evade restrictions on the use of `
.Internal ` and other non-API calls.

##  Details

` call `

    

returns an unevaluated function call, that is, an unevaluated expression which
consists of the named function applied to the given arguments ( ` name ` must
be a quoted string which gives the name of a function to be called). Note that
although the call is unevaluated, the arguments ` … ` are evaluated.

` call ` is a primitive, so the first argument is taken as ` name ` and the
remaining arguments as arguments for the constructed call: if the first
argument is named the name must partially match ` name ` .

` is.call `

    

is used to determine whether ` x ` is a call (i.e., of mode ` "call" ` or `
"(" ` ). Note that

  * ` is.call(x) ` is strictly equivalent to ` typeof(x) == "language" ` . 

  * ` [ is.language ](/link/is.language?package=base&version=3.6.2) () ` is also true for calls (but also for ` [ symbol ](/link/symbol?package=base&version=3.6.2) ` s and ` [ expression ](/link/expression?package=base&version=3.6.2) ` s where ` is.call() ` is false). 

` as.call(x) ` :

    

Objects of mode ` "list" ` can be coerced to mode ` "call" ` . The first
element of the list becomes the function part of the call, so should be a
function or the name of one (as a symbol; a quoted string will not do).

If you think of using ` as.call(<string>) ` , consider using ` [ str2lang
](/link/str2lang?package=base&version=3.6.2) (*) ` which is an efficient
version of ` [ parse ](/link/parse?package=base&version=3.6.2) (text=*) ` .
Note that ` [ call ](/link/call?package=base&version=3.6.2) () ` and ` [
as.call ](/link/as.call?package=base&version=3.6.2) () ` , when applicable,
are much preferable to these ` [ parse
](/link/parse?package=base&version=3.6.2) () ` based approaches.

All three are [ primitive ](/link/primitive?package=base&version=3.6.2)
functions.

##  References

Becker, R. A., Chambers, J. M. and Wilks, A. R. (1988) _The New S Language_ .
Wadsworth & Brooks/Cole.

##  See Also

` [ do.call ](/link/do.call?package=base&version=3.6.2) ` for calling a
function by name and argument list; ` [ Recall
](/link/Recall?package=base&version=3.6.2) ` for recursive calling of
functions; further ` [ is.language
](/link/is.language?package=base&version=3.6.2) ` , ` [ expression
](/link/expression?package=base&version=3.6.2) ` , ` [ function
](/link/function?package=base&version=3.6.2) ` .

Producing ` [ call ](/link/call?package=base&version=3.6.2) ` s etc from
character: ` [ str2lang ](/link/str2lang?package=base&version=3.6.2) ` and ` [
parse ](/link/parse?package=base&version=3.6.2) ` .

##  Examples

[ Run this code
](https://app.datacamp.com/workspace/preview?_tag=rdocs&rdocsPath=packages%2Fbase%2Fversions%2F3.6.2%2Ftopics%2Fcall&utm_source=r-docs&utm_medium=docs&utm_term=call&utm_content=run_example_in_workspace)

    
    
    # NOT RUN {
    is.call(call) #-> FALSE: Functions are NOT calls
    
    ## set up a function call to round with argument 10.5
    cl <- call("round", 10.5)
    is.call(cl) # TRUE
    cl
    identical(quote(round(10.5)), # <- less functional, but the same
              cl) # TRUE
    ## such a call can also be evaluated.
    eval(cl) # [1] 10
    
    class(cl) # "call"
    typeof(cl)# "language"
    is.call(cl) && is.language(cl) # always TRUE for "call