Skip to content

Commit 7cc949f

Browse files
committed
fix examples to pass r cmd check
1 parent 5bc2cc8 commit 7cc949f

File tree

2 files changed

+20
-20
lines changed

2 files changed

+20
-20
lines changed

R/data.R

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
#' x_source = "TGS00010",
3232
#' year = 2020,
3333
#' level = "2",
34-
#' x_filters = list(isced11 = "TOTAL", unit = "PC", age = "Y_GE15", freq = "A")
34+
#' x_filters = list(isced11 = "TOTAL", sex = "F")
3535
#' )
3636
#'
3737
#' # Bivariate example
@@ -40,8 +40,8 @@
4040
#' y_source = "DEMO_R_MLIFEXP",
4141
#' year = 2020,
4242
#' level = "2",
43-
#' x_filters = list(isced11 = "TOTAL", unit = "PC", age = "Y_GE15", freq = "A"),
44-
#' y_filters = list(unit = "YR", age = "Y_LT1", freq = "A")
43+
#' x_filters = list(isced11 = "TOTAL", sex = "F"),
44+
#' y_filters = list(age = "Y2", sex = "F")
4545
#' )
4646
#' }
4747
mi_data <- function(
@@ -133,11 +133,11 @@ mi_data <- function(
133133
tibble::as_tibble()
134134

135135
# Check for duplicate values within each geo for x and (if applicable) y.
136-
duplicate_issues <- response_data %>%
137-
dplyr::group_by(geo) %>%
136+
duplicate_issues <- response_data |>
137+
dplyr::group_by(.data$geo) |>
138138
dplyr::summarise(
139-
distinct_x = dplyr::n_distinct(x),
140-
distinct_y = if ("y" %in% names(response_data)) dplyr::n_distinct(y) else NA_integer_,
139+
distinct_x = dplyr::n_distinct(.data$x),
140+
distinct_y = if ("y" %in% names(response_data)) dplyr::n_distinct(.data$y) else NA_integer_,
141141
.groups = "drop"
142142
)
143143

@@ -151,11 +151,11 @@ mi_data <- function(
151151
if (x_issue) {
152152
available_filters <- mi_source_filters(source_name = x_source, year = year, level = level)
153153
# Determine which filter fields have more than one option
154-
multi_option_fields <- available_filters %>%
155-
dplyr::group_by(field) %>%
156-
dplyr::summarise(n_options = dplyr::n_distinct(value), .groups = "drop") %>%
157-
dplyr::filter(n_options > 1) %>%
158-
dplyr::pull(field)
154+
multi_option_fields <- available_filters |>
155+
dplyr::group_by(.data$field) |>
156+
dplyr::summarise(n_options = dplyr::n_distinct(.data$value), .groups = "drop") |>
157+
dplyr::filter(.data$n_options > 1) |>
158+
dplyr::pull(.data$field)
159159
# Only require filters for those fields with multiple options.
160160
missing_x_filters <- setdiff(multi_option_fields, names(x_filters))
161161
}
@@ -164,11 +164,11 @@ mi_data <- function(
164164
missing_y_filters <- character(0)
165165
if (y_issue) {
166166
available_y_filters <- mi_source_filters(source_name = y_source, year = year, level = level)
167-
multi_option_y_fields <- available_y_filters %>%
168-
dplyr::group_by(field) %>%
169-
dplyr::summarise(n_options = dplyr::n_distinct(value), .groups = "drop") %>%
170-
dplyr::filter(n_options > 1) %>%
171-
dplyr::pull(field)
167+
multi_option_y_fields <- available_y_filters |>
168+
dplyr::group_by(.data$field) |>
169+
dplyr::summarise(n_options = dplyr::n_distinct(.data$value), .groups = "drop") |>
170+
dplyr::filter(.data$n_options > 1) |>
171+
dplyr::pull(.data$field)
172172
missing_y_filters <- setdiff(multi_option_y_fields, names(y_filters))
173173
}
174174

man/mi_data.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)