Skip to content

Commit

Permalink
updates to resolve styler errors
Browse files Browse the repository at this point in the history
  • Loading branch information
csandrews21 committed Jul 3, 2024
1 parent 1e722f9 commit 7f6c9f9
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 22 deletions.
6 changes: 3 additions & 3 deletions R/date_cut.R
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ date_cut <- function(dataset_sdtm,
mutate(TEMP_DCUT_KEEP = "Y")

ifelse(!is.na(dcut$DCUT_TEMP_DCUTDTM), assert_that(is.POSIXt(dcut$DCUT_TEMP_DCUTDTM),
msg = "cut_var is expected to be of date type POSIXt"
), NA)
msg = "cut_var is expected to be of date type POSIXt"
), NA)

attributes(dcut$USUBJID)$label <- attributes(dataset_sdtm$USUBJID)$label

Expand All @@ -90,7 +90,7 @@ date_cut <- function(dataset_sdtm,
# Flag records to be removed - those occurring after cut date and patients not in dcut dataset
dataset <- dataset_sdtm_pt %>%
mutate(DCUT_TEMP_REMOVE = ifelse((DCUT_TEMP_SDTM_DATE > DCUT_TEMP_DCUTDTM) |
is.na(TEMP_DCUT_KEEP), "Y", NA_character_))
is.na(TEMP_DCUT_KEEP), "Y", NA_character_))

# Ensure variable is character
dataset$DCUT_TEMP_REMOVE <- as.character(dataset$DCUT_TEMP_REMOVE)
Expand Down
4 changes: 2 additions & 2 deletions R/special_dm_cut.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ special_dm_cut <- function(dataset_dm,
)

ifelse(!is.na(dm_temp$DCUT_TEMP_DCUTDTM), assert_that(is.POSIXt(dm_temp$DCUT_TEMP_DCUTDTM),
msg = "cut_var is expected to be of date type POSIXt"
), NA)
msg = "cut_var is expected to be of date type POSIXt"
), NA)

# Flag records with Death Date after Cut date
dataset_updatedth <- dm_temp %>%
Expand Down
33 changes: 18 additions & 15 deletions inst/read-out/read_out.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ data_review <- function(pt_data, dt_data, dm_data, no_cut) {
is_all_null <- all(sapply(objects, is.null))
if (is_all_null) {
cat("No data has been inputted into the read-out function.", " \n",
"If you would like to view a summary of the datacut, please double check you have filled in
all the parameters in the read_out() function (or process_cut() when using the wrapped
"If you would like to view a summary of the datacut, please double check you have filled in
all the parameters in the read_out() function (or process_cut() when using the wrapped
approach.)", " \n",
fill = TRUE
)
Expand Down Expand Up @@ -125,7 +125,8 @@ data_review <- function(pt_data, dt_data, dm_data, no_cut) {
reactable(sum_t,
columnGroups = list(
colGroup("Total Number of Records",
columns = c("Before Cut", "After Cut", "Removed", "Modified"))
columns = c("Before Cut", "After Cut", "Removed", "Modified")
)
),
bordered = TRUE, filterable = TRUE, searchable = TRUE, pagination = TRUE,
showPageSizeOptions = TRUE, striped = TRUE, showSortable = TRUE
Expand Down Expand Up @@ -173,10 +174,10 @@ df_tabs <- function(data) {
cat(paste("Number of records removed in ", toupper(name), ": ", x, " \n", " \n"))
removed <- df %>% filter(df$DCUT_TEMP_REMOVE == "Y")
print(htmltools::tagList(reactable(removed,
bordered = TRUE, filterable = TRUE, searchable = TRUE, pagination = TRUE,
showPageSizeOptions = TRUE, showSortable = TRUE,
striped = TRUE, wrap = FALSE, resizable = TRUE
)))
bordered = TRUE, filterable = TRUE, searchable = TRUE, pagination = TRUE,
showPageSizeOptions = TRUE, showSortable = TRUE,
striped = TRUE, wrap = FALSE, resizable = TRUE
)))
cat(" \n\n")
cyc_num <- cyc_num + 1
}
Expand All @@ -197,8 +198,8 @@ sum_test <- function(data) {
# case when data = NULL
if (is.null(data)) {
cat("No data has been cut with this cut type.", " \n")
cat("If you would like to apply this cut, please double check you have ran this cut / filled in
all the parameters in process_cut() - for the wrapped approach - or read_out() - modular
cat("If you would like to apply this cut, please double check you have ran this cut / filled in
all the parameters in process_cut() - for the wrapped approach - or read_out() - modular
approach.")
cat(" \n\n")
} else {
Expand All @@ -216,12 +217,14 @@ sum_test <- function(data) {
Modified = numeric()
) %>%
add_row(Dataset = "DM", `Before Cut` = uncut, `After Cut` = cut, Removed = x, Modified = y)
print(htmltools::tagList(reactable(sum_t, columnGroups = list(
colGroup("Total Number of Records",
columns = c("Before Cut", "After Cut", "Removed", "Modified"))
),
bordered = TRUE, filterable = TRUE, searchable = TRUE, pagination = TRUE,
showPageSizeOptions = TRUE, striped = TRUE, showSortable = TRUE
print(htmltools::tagList(reactable(sum_t,
columnGroups = list(
colGroup("Total Number of Records",
columns = c("Before Cut", "After Cut", "Removed", "Modified")
)
),
bordered = TRUE, filterable = TRUE, searchable = TRUE, pagination = TRUE,
showPageSizeOptions = TRUE, striped = TRUE, showSortable = TRUE
)))
cat(" \n\n")
} else {
Expand Down
4 changes: 2 additions & 2 deletions vignettes/variable_cut.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,8 @@ sv <- tibble::tribble(
dcut <- dcut %>%
left_join(sv %>%
filter(VISIT == "WEEK24") %>%
select(USUBJID, SVSTDTC)) %>%
filter(VISIT == "WEEK24") %>%
select(USUBJID, SVSTDTC)) %>%
mutate(DCUTDTC = as.character(ifelse(!is.na(SVSTDTC), SVSTDTC, as.character(DCUTDTC)))) %>%
impute_dcutdtc(dsin = ., varin = DCUTDTC, varout = DCUTDTM)
```
Expand Down

0 comments on commit 7f6c9f9

Please sign in to comment.