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
The documentation of function dense_rank currently does not mention that NA values won't be accounted for when working with data frames, but will be counted in when working with DB tables. Note the value of column dr in the two examples below.
Data frame:
mtcars$vs[1] <- NA
mtcars$vs[3] <- NA
mtcars %>%
dplyr::slice(1:5) %>%
dplyr::mutate(dr = dplyr::dense_rank(vs)) %>%
dplyr::arrange(dr)
# mpg cyl disp hp drat wt qsec vs am gear carb dr
# Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4 1
# Hornet Sportabout 18.7 8 360 175 3.15 3.440 17.02 0 0 3 2 1
# Hornet 4 Drive 21.4 6 258 110 3.08 3.215 19.44 1 NA 3 1 2
# Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 NA NA 4 4 NA
# Datsun 710 22.8 4 108 93 3.85 2.320 18.61 NA 1 4 1 NA
The documentation of function
dense_rank
currently does not mention thatNA
values won't be accounted for when working with data frames, but will be counted in when working with DB tables. Note the value of columndr
in the two examples below.Data frame:
DB table:
This can be quite confusing when using the same code for different objects (data frames or DB tables).
The text was updated successfully, but these errors were encountered: