Skip to content

Commit

Permalink
Create report_percent_missing.R
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonyokc committed Oct 4, 2023
1 parent 0e84427 commit d45513e
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions R/report_percent_missing.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
report_percent_missing <- function(data, column) {
na_data <- data |>
tably({{column}}) |>
dplyr::filter(is.na({{column}}))

print(na_data)

na_column_name <- na_data |>
names() |>
dplyr::nth(1)

na_data |>
dplyr::pull(percent) |>
percent(multiply_by_100 = FALSE, 2) |>
sprintf(fmt = "\n%s of '%s' are missing.", na_column_name) |>
cat()
}

0 comments on commit d45513e

Please sign in to comment.