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?
Asked
Active
Viewed 33 times
-1

Miss Swiss
- 89
- 1
- 9
-
See the documentation on the lp.object list returned by lp(). – Erwin Kalvelagen Jul 07 '19 at 16:36
1 Answers
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