Skip to content

Commit

Permalink
Documentation fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Hanna authored and Richard Hanna committed Sep 26, 2024
1 parent a343d6e commit 851450f
Show file tree
Hide file tree
Showing 8 changed files with 78 additions and 7 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ importFrom(dplyr,bind_rows)
importFrom(dplyr,case_when)
importFrom(dplyr,coalesce)
importFrom(dplyr,cur_column)
importFrom(dplyr,distinct)
importFrom(dplyr,filter)
importFrom(dplyr,first)
importFrom(dplyr,group_by)
Expand Down Expand Up @@ -148,6 +149,7 @@ importFrom(tidyselect,any_of)
importFrom(tidyselect,ends_with)
importFrom(tidyselect,eval_select)
importFrom(tidyselect,everything)
importFrom(tidyselect,matches)
importFrom(tidyselect,starts_with)
importFrom(tidyselect,where)
importFrom(vctrs,vec_ptype)
Expand Down
4 changes: 2 additions & 2 deletions R/REDCapTidieR-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#' @importFrom dplyr %>% across bind_rows case_when filter group_by if_any if_else
#' left_join mutate pull recode relocate rename right_join row_number rowwise
#' select slice summarise ungroup coalesce cur_column bind_cols first nth n_distinct
#' first
#' first distinct
#' @importFrom formattable percent
#' @importFrom lobstr obj_size
#' @importFrom lubridate is.difftime is.period is.POSIXt is.Date
Expand All @@ -27,7 +27,7 @@
#' @importFrom tidyr complete fill pivot_wider nest separate_wider_delim unnest
#' unnest_wider
#' @importFrom tidyselect all_of any_of ends_with eval_select everything
#' starts_with where
#' starts_with where matches
#' @importFrom vctrs vec_ptype_abbr vec_ptype
#' @importFrom pillar tbl_sum
#' @importFrom readr parse_logical parse_integer parse_double parse_date parse_time
Expand Down
2 changes: 1 addition & 1 deletion R/clean_redcap_long.R
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ distill_repeat_table_long <- function(form_name,
filter(
(
!is.na(.data$redcap_form_instance) |
if_any(starts_with("redcap_event_instance"), ~ !is.na(.))
if_any(matches("redcap_event_instance"), ~ !is.na(.))
) &
.data$redcap_repeat_instrument == my_form
)
Expand Down
10 changes: 9 additions & 1 deletion R/join_data_tibbles.R
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ get_join_fn <- function(type) {
#'
#' @returns a character vector
#'
#' @keywords interal
#' @keywords internal
build_by <- function(supertbl, x, y, is_mixed) {
x_pks <- supertbl$pks[supertbl$redcap_form_name == x] %>%
stringr::str_split(", ", simplify = TRUE)
Expand Down Expand Up @@ -174,6 +174,14 @@ add_missing_columns <- function(tbl, columns) {
#' the event of mixed structure data tibble joins, will seek to split data into
#' three categories before performing the joins. The key identifiers here are
#' `redcap_form_instance` and the added `.repeat_type` columns.
#'
#' @inheritParams join_data_tibbles
#' @param join_fn the user specified join function type output by [get_join_fn()]
#' @param is_mixed TRUE/FALSE mixed data structure
#'
#' @returns a dataframe
#'
#' @keywords internal

join_tbls <- function(x, y, join_fn, by, suffix, is_mixed) {
if (is_mixed) {
Expand Down
4 changes: 2 additions & 2 deletions R/read_redcap.R
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ calc_metadata_stats <- function(data) {

get_repeat_event_types <- function(data) {
out <- data %>%
dplyr::distinct(.data$redcap_event_name, .data$redcap_repeat_instrument, .data$redcap_repeat_instance) %>%
distinct(.data$redcap_event_name, .data$redcap_repeat_instrument, .data$redcap_repeat_instance) %>%
mutate(
repeat_type = case_when(
!is.na(redcap_event_name) & !is.na(redcap_repeat_instrument) & !is.na(redcap_repeat_instance) ~
Expand All @@ -540,7 +540,7 @@ get_repeat_event_types <- function(data) {
TRUE ~ "nonrepeating"
)
) %>%
dplyr::distinct(.data$redcap_event_name, .data$repeat_type)
distinct(.data$redcap_event_name, .data$repeat_type)

# Check for instances where the same event is labelled as nonrepeating & repeating separate
# If this is the case, it must be repeating separate (there is just data that qualifies as both)
Expand Down
2 changes: 1 addition & 1 deletion man/build_by.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

60 changes: 60 additions & 0 deletions man/join_tbls.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pkgdown/_pkgdown.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ reference:
Helpful functions for supertibble data analytics.
contents:
- combine_checkboxes
- join_data_tibbles
- title: "Data"
contents:
- superheroes_supertbl
Expand Down

0 comments on commit 851450f

Please sign in to comment.