0

Suppose, I have a function called myfunction. How do I complete this function where if test2 is provided, I want to print "test2 is provided", if not, do nothing. I want to run the below function like myfunction(test1) without using test2 (an optional parameter).

myfunction <- function (test1, test2){

do something...

if exists(test2){ print("test2 is provided")}

}
MAPK
  • 5,635
  • 4
  • 37
  • 88

0 Answers0