Related Articles

Related Articles

Coercing an Object of mode “list” to mode “call” in R Programming – as.call() Function
  • Last Updated : 19 Jun, 2020

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:

filter_none

edit
close

play_arrow

link
brightness_4
code

# 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")))

chevron_right


Output:

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

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

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

chevron_right


Output:

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