Displaying 2 results from an estimated 2 matches for "na_value".
Did you mean:
n_value
2023 Apr 14
0
sum(), min(), max(), prod() vs. named arguments in ...
...Do users normally name their arguments to sum()? If not, it could be
relatively safe to make it a warning to pass named arguments to sum()
that are not na.rm and later transition it to an error:
--- src/main/summary.c (revision 84252)
+++ src/main/summary.c (working copy)
@@ -419,6 +419,8 @@
na_value = CAR(a);
if(prev == R_NilValue) args = CDR(a);
else SETCDR(prev, CDR(a));
+ } else if (TAG(a) && TAG(a) != R_NilValue) {
+ warning("Named argument \"%s\" here is probably a mistake", CHAR(PRINTNAME(TAG(a))));
}
prev = a;
}
(Can TAG(a) ever be N...
2023 Apr 16
0
sum(), min(), max(), prod() vs. named arguments in ...
...>
Forbidding or warning against tagged arguments other than 'na.rm' would be
quite intrusive, since it is not uncommon to see do.call(sum, <named list>).
> --- src/main/summary.c (revision 84252)
> +++ src/main/summary.c (working copy)
> @@ -419,6 +419,8 @@
> na_value = CAR(a);
> if(prev == R_NilValue) args = CDR(a);
> else SETCDR(prev, CDR(a));
> + } else if (TAG(a) && TAG(a) != R_NilValue) {
> + warning("Named argument \"%s\" here is probably a mistake", CHAR(PRINTNAME(TAG(a))));
> }
> prev...