Closed njtierney closed 1 year ago
This is no longer an issue:
library(dplyr)
#>
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#>
#> filter, lag
#> The following objects are masked from 'package:base':
#>
#> intersect, setdiff, setequal, union
library(naniar)
aq_recoded <- airquality %>%
nabular() %>%
recode_shadow(Ozone = .where(Wind <= 5 ~ "broken_machine"))
aq_recoded %>%
arrange(Wind)
#> # A tibble: 153 × 12
#> Ozone Solar.R Wind Temp Month Day Ozone_NA Solar.R_NA Wind_NA Temp_NA
#> <int> <int> <dbl> <int> <int> <int> <fct> <fct> <fct> <fct>
#> 1 NA 59 1.7 76 6 22 NA_broken_m… !NA !NA !NA
#> 2 118 225 2.3 94 8 29 NA_broken_m… !NA !NA !NA
#> 3 73 183 2.8 93 9 3 NA_broken_m… !NA !NA !NA
#> 4 168 238 3.4 81 8 25 NA_broken_m… !NA !NA !NA
#> 5 122 255 4 89 8 7 NA_broken_m… !NA !NA !NA
#> 6 135 269 4.1 84 7 1 NA_broken_m… !NA !NA !NA
#> 7 NA 91 4.6 76 6 23 NA_broken_m… !NA !NA !NA
#> 8 64 175 4.6 83 7 5 NA_broken_m… !NA !NA !NA
#> 9 66 NA 4.6 87 8 6 NA_broken_m… NA !NA !NA
#> 10 91 189 4.6 93 9 4 NA_broken_m… !NA !NA !NA
#> # ℹ 143 more rows
#> # ℹ 2 more variables: Month_NA <fct>, Day_NA <fct>
aq_grouped_recoded <- airquality %>%
bind_shadow() %>%
dplyr::group_by(Month) %>%
recode_shadow(Ozone = .where(Wind <= 5 ~ "broken_machine"))
aq_grouped_recoded %>%
arrange(Wind,
Month)
#> # A tibble: 153 × 12
#> # Groups: Month [5]
#> Month Ozone Solar.R Wind Temp Day Ozone_NA Solar.R_NA Wind_NA Temp_NA
#> <int> <int> <int> <dbl> <int> <int> <fct> <fct> <fct> <fct>
#> 1 6 NA 59 1.7 76 22 NA_broken_m… !NA !NA !NA
#> 2 8 118 225 2.3 94 29 NA_broken_m… !NA !NA !NA
#> 3 9 73 183 2.8 93 3 NA_broken_m… !NA !NA !NA
#> 4 8 168 238 3.4 81 25 NA_broken_m… !NA !NA !NA
#> 5 8 122 255 4 89 7 NA_broken_m… !NA !NA !NA
#> 6 7 135 269 4.1 84 1 NA_broken_m… !NA !NA !NA
#> 7 6 NA 91 4.6 76 23 NA_broken_m… !NA !NA !NA
#> 8 7 64 175 4.6 83 5 NA_broken_m… !NA !NA !NA
#> 9 8 66 NA 4.6 87 6 NA_broken_m… NA !NA !NA
#> 10 9 91 189 4.6 93 4 NA_broken_m… !NA !NA !NA
#> # ℹ 143 more rows
#> # ℹ 2 more variables: Month_NA <fct>, Day_NA <fct>
Created on 2023-05-01 with reprex v2.0.2
Created on 2020-08-17 by the reprex package (v0.3.0)
Not sure if this is a problem due to not using
across
, or if this falls in the realm of helpful message to the user.