From 94e0226d1de7710381dfa04ab447c0277e9818ac Mon Sep 17 00:00:00 2001 From: Michael Chirico Date: Mon, 19 Aug 2024 23:30:31 -0700 Subject: [PATCH] Workaround R CMD check apparent false positive --- R/utils.R | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/utils.R b/R/utils.R index 4c9b02c78..baa62b679 100644 --- a/R/utils.R +++ b/R/utils.R @@ -23,7 +23,9 @@ nan_is_na = function(x) { # In R 3.3.0, rep_len() strips attributes --> breaks data.table()'s internal recycle() helper. if (inherits(rep_len(Sys.Date(), 1L), "Date")) { - safe_rep_len = rep_len + # NB: safe_rep_len=rep_len throws an R CMD check error because it _appears_ to the AST + # walker that we've used .Internal ourselves (which is not true, but codetools can't tell). + safe_rep_len = function(x, n) rep_len(x, n) } else { safe_rep_len = function(x, n) rep(x, length.out = n) }