|
9 | 9 | #' @importFrom dplyr row_number arrange_at |
10 | 10 | #' @importFrom stringr str_remove_all str_extract_all coll |
11 | 11 | #' @importFrom tidyselect starts_with |
| 12 | +#' @noRd |
12 | 13 |
|
13 | 14 | .updateFormat <- function(input = NULL, schema = NULL){ |
14 | 15 |
|
|
152 | 153 | #' Convenience wrapper around tidyr::fill() |
153 | 154 | #' |
154 | 155 | #' @param x [\code{data.frame(1)}]\cr table in which to fill NA values. |
155 | | -#' @param direction [\code{character(3)}]\cr direction in which to fill missing values, |
156 | | -#' possible values are "down", "up" and "right"; if several directions are |
157 | | -#' required, provide them in the order required. |
| 156 | +#' @param direction [\code{character(1)}]\cr direction in which to fill missing |
| 157 | +#' values, possible values are "down", "up" and "right". |
| 158 | +#' @param cols tidyselect specification of columns to fill; defaults to |
| 159 | +#' \code{everything()}. Only honoured for directions "down" and "up"; for |
| 160 | +#' "right" all columns are pivoted. |
158 | 161 | #' @importFrom checkmate assertDataFrame assertCharacter |
159 | 162 | #' @importFrom tidyr pivot_longer pivot_wider fill |
160 | 163 | #' @importFrom dplyr group_by everything ungroup |
| 164 | +#' @noRd |
161 | 165 |
|
162 | | -.fill <- function(x = NULL, direction = TRUE){ |
| 166 | +.fill <- function(x = NULL, direction = TRUE, cols = everything()){ |
163 | 167 |
|
164 | 168 | assertDataFrame(x = x) |
165 | 169 | assertCharacter(x = direction, len = 1) |
166 | 170 |
|
167 | 171 | if(direction == "down"){ |
168 | 172 |
|
169 | 173 | out <- x |> |
170 | | - fill(everything(), .direction = "down") |
| 174 | + fill({{ cols }}, .direction = "down") |
171 | 175 |
|
172 | 176 | } else if(direction == "up"){ |
173 | 177 |
|
174 | 178 | out <- x |> |
175 | | - fill(everything(), .direction = "up") |
| 179 | + fill({{ cols }}, .direction = "up") |
176 | 180 |
|
177 | 181 | } else if(direction == "right"){ |
178 | 182 |
|
|
203 | 207 | #' @importFrom purrr map |
204 | 208 | #' @importFrom dplyr left_join pull |
205 | 209 | #' @importFrom stringr str_c |
| 210 | +#' @noRd |
206 | 211 |
|
207 | 212 | .getColTypes <- function(input = NULL, collapse = TRUE){ |
208 | 213 |
|
|
244 | 249 | #' @importFrom dplyr distinct select bind_cols if_any full_join |
245 | 250 | #' @importFrom tidyselect all_of everything |
246 | 251 | #' @importFrom rlang `:=` |
| 252 | +#' @noRd |
247 | 253 |
|
248 | 254 | .tidyVars <- function(ids = NULL, obs = NULL, clust = NULL, grp = NULL){ |
249 | 255 |
|
|
566 | 572 | #' @importFrom dplyr mutate row_number if_else group_by summarise n ungroup |
567 | 573 | #' left_join pull |
568 | 574 | #' @importFrom rlang eval_tidy |
| 575 | +#' @noRd |
569 | 576 |
|
570 | 577 | .eval_sum <- function(input = NULL, groups = NULL, data = NULL){ |
571 | 578 |
|
|
627 | 634 | #' @importFrom tidyr pivot_longer pivot_wider |
628 | 635 | #' @importFrom dplyr select mutate across pull if_else |
629 | 636 | #' @importFrom stringr str_count str_detect |
| 637 | +#' @noRd |
630 | 638 |
|
631 | 639 | .eval_find <- function(input = NULL, col = NULL, row = NULL, clusters = NULL){ |
632 | 640 |
|
|
870 | 878 | #' the last successful expectation. |
871 | 879 | #' @importFrom testthat expect_identical |
872 | 880 | #' @importFrom checkmate expect_names expect_tibble expect_list assertChoice |
| 881 | +#' @noRd |
873 | 882 |
|
874 | 883 | .expect_valid_table <- function(x = NULL, units = 1, variables = NULL, |
875 | 884 | groups = FALSE, flags = FALSE){ |
|
0 commit comments