You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Without format= specified, as.POSIXct() guesses the format based on the first element --> infers %F in the latter case, in error.
It's maybe not the best default for as.POSIXct(), but IIRC it's as documented. The user can still get the desired behavior by giving matched formats on the input:
lintr::lint(text='c(as.POSIXct(x), as.POSIXct(y))', linters=lintr::inner_combine_linter())
# <text>:1:1: warning: [inner_combine_linter] Combine inputs to vectorized functions first to take full advantage of vectorization, e.g., as.POSIXct(c(x, y)) only runs the more expensive as.POSIXct() once as compared to c(as.POSIXct(x), as.POSIXct(y)).# c(as.POSIXct(x), as.POSIXct(y))# ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
What's the best to do here? Just document the potential issue? Skip lints if there are non-CONST entries for timestamp converters? Then if there areCONST entries, try and run the comparison ourselves before throwing a lint?
The text was updated successfully, but these errors were encountered:
compare
Without
format=
specified,as.POSIXct()
guesses the format based on the first element --> infers%F
in the latter case, in error.It's maybe not the best default for
as.POSIXct()
, but IIRC it's as documented. The user can still get the desired behavior by giving matched formats on the input:But we also lint in dynamic cases:
What's the best to do here? Just document the potential issue? Skip lints if there are non-
CONST
entries for timestamp converters? Then if there areCONST
entries, try and run the comparison ourselves before throwing a lint?The text was updated successfully, but these errors were encountered: