Create an Object of mode call in R Programming – call() Function
Last Updated :
19 Jun, 2020
call()
function in R Language is used to create or test for objects of mode “call”.
Syntax: call(name, …)
Parameters:
name: a non-empty character string naming the function to be called
…: arguments to be part of the call
Example 1:
x < - call( "sin" , 23 )
y < - call( "cos" , 0 )
x
y
eval (x)
eval (y)
|
Output:
sin(23)
cos(0)
[1] -0.8462204
[1] 1
Example 2:
x < - call( "round" , 10.5 )
x
f < - "round"
call(f, quote(A))
|
Output:
round(10.5)
round(A)
Example 3:
f < - round
call(f, quote(A))
|
Output:
Error in call(f, quote(A)) : first argument must be a character string
Execution halted
Share your thoughts in the comments
Please Login to comment...