Skip to content
Related Articles

Related Articles

Improve Article

Coercing an Object of mode “list” to mode “call” in R Programming – as.call() Function

  • Last Updated : 19 Jun, 2020
Geek Week

as.call() function in R Language is used to coerce the object of mode “list” to mode “call”. The first element of the list becomes the function part of the call.

Syntax: as.call(x)

Parameters:
x: an arbitrary R object

Example 1:




# R program to illustrate
# as.call function
  
# Calling the as.call() function
as.call(list(list, 5, 10))
as.call(list(as.name("::"), as.name("list"), as.name("base")))

Output:

.Primitive("list")(5, 10)
list::base

Example 2:




# R program to illustrate
# as.call function
  
# Initializing a function round
f <- round
  
# Calling the as.call() function
as.call(list(f, quote(A)))

Output:

.Primitive("round")(A)
My Personal Notes arrow_drop_up
Recommended Articles
Page :