From 312333a07c739831adf7ecc2ea36d7760e8edb0d Mon Sep 17 00:00:00 2001 From: jimrothstein Date: Tue, 19 Nov 2024 20:26:41 -0800 Subject: [PATCH] # Please include a useful commit message! jr --- BASE/340_missing_getArg.R | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 BASE/340_missing_getArg.R diff --git a/BASE/340_missing_getArg.R b/BASE/340_missing_getArg.R new file mode 100644 index 0000000..12c8d8c --- /dev/null +++ b/BASE/340_missing_getArg.R @@ -0,0 +1,18 @@ +## file <- "340_missing_getArg_ +## Turn off Diagnostics in Global | Code | Diagnositcs + +# suppose +f = function(x,y) { + if (missing(y)) print("y has no value ") +} + +g = function(x,y, ...) { + if (missing(y)) print("y has no value ") +} + +## f, g same EXCEPT for +f(x=1, y=2, z=3) # R sees unused argument, throws error + + +# +g(x=1, y=2, z=3) # R allows