-1

I am using the lp() function, but would like to use the optimal parameter as an input for following functions. Is there a way to get them?

Miss Swiss
  • 89
  • 1
  • 9

1 Answers1

1

You could also use missing() to test whether or not the argument b was supplied:

myFunc <- function(a,b){
    if(missing(b)) {
        a
    } else {
        a + b
    }
}

myFunc(3,1.5)
# [1] 4.5
myFunc(3)
# [1] 3
Rishab
  • 1,484
  • 2
  • 11
  • 22