Open In App

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

Last Updated : 19 Jun, 2020
Improve
Improve
Like Article
Like
Save
Share
Report

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)

Like Article
Suggest improvement
Previous
Next
Share your thoughts in the comments

Similar Reads