Skip to content

Commit

Permalink
minor refactor of ambiguous() using suggestion from @Bisaloo
Browse files Browse the repository at this point in the history
  • Loading branch information
bahadzie committed Oct 7, 2024
1 parent a3482f8 commit 58e8534
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion R/numberize.R
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ ambiguous <- function(digits) {
current_position <- digit_mappings[
match(digits, digit_mappings[["digit"]]), "position"
]
next_position <- c(utils::tail(current_position, -1), NA) # move forward by 1
next_position <- c(current_position[-1], NA) # move forward by 1

# returns true if consecutive positions are the same type e.g. unit, unit etc
uncertain <- any(current_position == next_position, na.rm = TRUE)
if (uncertain) {
Expand Down

0 comments on commit 58e8534

Please sign in to comment.