Skip to content

Commit

Permalink
Workaround R CMD check apparent false positive
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelChirico authored Aug 20, 2024
1 parent 4b968a4 commit 94e0226
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion R/utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit 94e0226

Please sign in to comment.