No flags found
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
6147117
... +47 ...
f079d9d
Use flags to group coverage reports by test type, project and/or folders.
Then setup custom commit statuses and notifications for each flag.
e.g., #unittest #integration
#production #enterprise
#frontend #backend
13 | 13 | #' @param perl Indicates if perl-compatible regexps should be used. |
|
14 | 14 | #' Default is `TRUE`. Optional. |
|
15 | 15 | #' |
|
16 | - | #' @return Currently, a [base::data.frame()] is returned a row for each match, |
|
16 | + | #' @return Currently, a [tibble::tibble()] is returned a row for each match, |
|
17 | 17 | #' and a column for each *named* group within a match. For the |
|
18 | 18 | #' `retrieve_checkbox_choices()` function, the columns will be. |
|
19 | 19 | #' * `id`: The numeric value assigned to each choice (in the data dictionary). |
22 | 22 | #' @details |
|
23 | 23 | #' The [regex_named_captures()] function is general, and not specific to |
|
24 | 24 | #' REDCap; it accepts any arbitrary regular expression. |
|
25 | - | #' It returns a [base::data.frame()] with as many columns as named matches. |
|
25 | + | #' It returns a [tibble::tibble()] with as many columns as named matches. |
|
26 | 26 | #' |
|
27 | 27 | #' The [checkbox_choices()] function is specialized, and accommodates the |
|
28 | 28 | #' "select choices" for a *single* REDCap checkbox group (where multiple boxes |
|
29 | - | #' can be selected). It returns a [base::data.frame()] with two columns, one |
|
29 | + | #' can be selected). It returns a [tibble::tibble()] with two columns, one |
|
30 | 30 | #' for the numeric id and one for the text label. |
|
31 | 31 | #' |
|
32 | + | #' The parse will probably fail if a label contains a pipe (*i.e.*, `|`), |
|
33 | + | #' since that the delimiter REDCap uses to separate choices |
|
34 | + | #' presented to the user. |
|
35 | + | #' |
|
32 | 36 | #' @author Will Beasley |
|
33 | 37 | #' @references See the official documentation for permissible characters in a |
|
34 | 38 | #' checkbox label. |
59 | 63 | #' token <- "9A81268476645C4E5F03428B8AC3AA7B" |
|
60 | 64 | #' |
|
61 | 65 | #' ds_metadata <- redcap_metadata_read(redcap_uri=uri, token=token)$data |
|
62 | - | #' choices_2 <- ds_metadata[ds_metadata$field_name=="race", "select_choices_or_calculations"] |
|
66 | + | #' choices_2 <- ds_metadata[ds_metadata$field_name=="race", ]$select_choices_or_calculations |
|
63 | 67 | #' |
|
64 | 68 | #' REDCapR::regex_named_captures(pattern=pattern_boxes, text=choices_2) |
|
65 | 69 | #' } |
70 | 74 | #' REDCapR::regex_named_captures(pattern=pattern_boxes, text=choices_3) |
|
71 | 75 | ||
72 | 76 | #' @export |
|
73 | - | regex_named_captures <- function(pattern, text, perl=TRUE) { |
|
74 | - | ||
77 | + | regex_named_captures <- function(pattern, text, perl = TRUE) { |
|
75 | 78 | checkmate::assert_character(pattern, any.missing=FALSE, min.chars=0L, len=1) |
|
76 | 79 | checkmate::assert_character(text , any.missing=FALSE, min.chars=0L, len=1) |
|
77 | 80 | checkmate::assert_logical( perl , any.missing=FALSE) |
|
78 | 81 | ||
79 | 82 | match <- gregexpr(pattern, text, perl = perl)[[1]] |
|
80 | 83 | capture_names <- attr(match, "capture.names") |
|
81 | - | d <- as.data.frame(matrix( |
|
84 | + | d <- base::data.frame(matrix( |
|
82 | 85 | data = NA_character_, |
|
83 | 86 | nrow = length(attr(match, "match.length")), |
|
84 | 87 | ncol = length(capture_names) |
95 | 98 | attr(match, "capture.length")[, column_name] |
|
96 | 99 | ) |
|
97 | 100 | } |
|
98 | - | d |
|
101 | + | tibble::as_tibble(d) |
|
99 | 102 | } |
|
100 | 103 | ||
101 | 104 | #' @rdname metadata_utilities |
10 | 10 | # This function isn't used during testing itself. Just to create the expected file. |
|
11 | 11 | save_expected <- function(o, path) { |
|
12 | 12 | # nocov start |
|
13 | - | attr(returned_object$data, which = "problems") <- NULL |
|
13 | + | attr(o, which = "problems") <- NULL |
|
14 | 14 | path <- file.path("inst", path) |
|
15 | 15 | if (!dir.exists(dirname(path))) dir.create(dirname(path), recursive = FALSE) |
|
16 | 16 |
32 | 32 | #' @author Will Beasley |
|
33 | 33 | #' |
|
34 | 34 | #' @seealso |
|
35 | - | #' See [redcap_read()] for a function that uses `create_batch_gloassary`. |
|
35 | + | #' See [redcap_read()] for a function that uses `create_batch_glossary`. |
|
36 | 36 | #' |
|
37 | 37 | #' @examples |
|
38 | 38 | #' REDCapR::create_batch_glossary(100, 50) |
22 | 22 | #' `httr` package. See the details below. Optional. |
|
23 | 23 | #' |
|
24 | 24 | #' @return Currently, a list is returned with the following elements, |
|
25 | - | #' * `data`: An R [base::data.frame()] where each row represents one column |
|
25 | + | #' * `data`: A [tibble::tibble()] where each row represents one column |
|
26 | 26 | #' in the REDCap dataset. |
|
27 | 27 | #' * `success`: A boolean value indicating if the operation was apparently |
|
28 | 28 | #' successful. |
119 | 119 | } else { |
|
120 | 120 | # nocov start |
|
121 | 121 | kernel$success <- FALSE # Override the 'success' http status code. |
|
122 | - | ds <- data.frame() #Return an empty data.frame |
|
122 | + | ds <- tibble::tibble() # Return an empty data.frame |
|
123 | 123 | ||
124 | 124 | outcome_message <- sprintf( |
|
125 | 125 | "The REDCap variable retrieval failed. The http status code was %i. The 'raw_text' returned was '%s'.", |
129 | 129 | # nocov end |
|
130 | 130 | } |
|
131 | 131 | } else { |
|
132 | - | ds <- data.frame() #Return an empty data.frame |
|
132 | + | ds <- tibble::tibble() # Return an empty data.frame |
|
133 | 133 | outcome_message <- if (any(grepl(kernel$regex_empty, kernel$raw_text))) { |
|
134 | 134 | "The REDCapR read/export operation was not successful. The returned dataset (of instrument-events) was empty." |
|
135 | 135 | } else { |
Learn more Showing 1 files with coverage changes found.
R/redcap-metadata-coltypes.R
Files | Coverage |
---|---|
R | 0.32% 95.99% |
Project Totals (40 files) | 95.99% |
f079d9d
3050fbb
822629e
e3ebcd3
6e02a5d
c2265e4
dd32165
be24076
7d5b55e
befdf65
3c0cb99
2902999
6cf4eb6
44aecc1
c913dc8
24e1236
57bbacf
293dc5e
e7442cb
bb4184c
5683b9d
d9a5013
2561267
b9db5de
6bc9ea6
0c75c6e
f722a4a
d73e33a
01ab083
94a4f04
5c6d4ae
54e067b
01e63b2
fe42dd4
a44ca1a
7af72e9
9d5fe4c
dc036a0
56481de
437763c
28e6eb5
efd4278
54f82e2
fac9698
31cb13e
a7dbc28
59d1f82
e95b463
6147117