-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* New function to derive oak_id_vars. More work needed. * cm template updates. In progress. * almost completed cm template * Basic support for "conditioned" data frames - Adds a new S3 class (cnd_df) for represented conditioned data frames, i.e. data frames that carry metadata about what records should be used for derivations - Adds support for basic pretty printing of cnd_df objects - Adds a user-facing function for creating such cnd_df objects: `condition_by` - Adds experimental "mutate"-version function for these conditioned data frames: `derive_by_condition()` * Basic support for conditioned data sets * Extensive support for conditioned tibbles - Joins by raw and target data sets are now aware of conditioned tibbles - Transformation functions, namely `assign_datetime()`, `hardcode*()` and `assign*` are also conditioned-tibble aware - Unit test coverage for most cases indicated at #54 I believe the essential components are here to support the if_then_else algorithm via conditioned tibbles. Now, further testing, assertions and documentation is needed. * Ramm's feedback integration - Move `tgt_dat` to the first position in the argument list for cleaner command pipes. - Rename `condition_by()` to `condition_add()`. - Export `oak_id_vars()` for direct user access. - Update tidyselections to align with the latest practices. * A fix to derive study day * Algorithms Vignette update * cm template code update * A function to help display of dataset in Vignette * Template update * Raw data change * DM domain csv * Events domain article * update controlled terminology * Updated CM template * VS domain template and Vignette * CM domain Vignette update * Update on conditioned data frames - Documentation - Examples - New article about cnd_df (WIP) * Fix Vignette * Updates to code * Remove white spaces * remove white spaces * clean up * pipeline failures * Fix pipeline failures * Automatic renv profile update. * Automatic renv profile update. * Fix pipeline failures * Fix pipeline failure * Moving DT from suggests to imports * Update WORDLIST * fix spelling --------- Co-authored-by: Rammprasad Ganapathy <[email protected]> Co-authored-by: Ramiro Magno <[email protected]> Co-authored-by: rammprasad <[email protected]>
- Loading branch information
1 parent
13644bd
commit 08cc5de
Showing
32 changed files
with
3,711 additions
and
373 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
#' Output a Dataset in a Vignette in the sdtm.oak Format | ||
#' | ||
#' Output a dataset in a vignette with the pre-specified sdtm.oak format. | ||
#' | ||
#' @param dataset Dataset to output in the vignette | ||
#' | ||
#' @param display_vars Variables selected to demonstrate the outcome of the mapping | ||
#' | ||
#' Permitted Values: list of variables | ||
#' | ||
#' Default is NULL | ||
#' | ||
#' If `display_vars` is not NULL, only the selected variables are visible in the vignette while the | ||
#' other variables are hidden. They can be made visible by clicking the`Choose the columns to | ||
#' display` button. | ||
#' | ||
#' @param filter Filter condition | ||
#' | ||
#' The specified condition is applied to the dataset before it is displayed. | ||
#' | ||
#' Permitted Values: a condition | ||
#' | ||
#' @return A HTML table | ||
#' | ||
#' @keywords dev_utility | ||
#' @importFrom rlang exprs | ||
#' | ||
#' @keywords internal | ||
#' | ||
dataset_oak_vignette <- function(dataset, display_vars = NULL, filter = NULL) { | ||
filter <- admiraldev::assert_filter_cond(rlang::enexpr(filter), optional = TRUE) | ||
|
||
out <- dataset |> | ||
admiraldev::filter_if(filter) |> | ||
dplyr::mutate(dplyr::across(dplyr::where(is.character), as.factor)) | ||
|
||
# Create a short markdown table when this function is called outside {pkgdown} | ||
if (!identical(Sys.getenv("IN_PKGDOWN"), "true")) { | ||
if (is.null(display_vars)) { | ||
return(knitr::kable(utils::head(out, 10L))) | ||
} else { | ||
return(knitr::kable(utils::head(dplyr::select(out, !!!display_vars), 10L))) | ||
} | ||
} | ||
|
||
if (!is.null(display_vars)) { | ||
hide_columns <- which(!(colnames(out) %in% admiraldev::vars2chr(display_vars))) | ||
cols_to_hide <- list(list(targets = hide_columns - 1L, visible = FALSE)) | ||
} else { | ||
cols_to_hide <- list() | ||
} | ||
htmltools::tagList( | ||
htmltools::htmlDependency( | ||
name = "dt-scroll", | ||
version = "1.0.0", | ||
src = "www", | ||
stylesheet = "style.css", | ||
package = "sdtm.oak" | ||
), | ||
DT::datatable( | ||
out, | ||
rownames = FALSE, | ||
filter = "top", | ||
height = "auto", | ||
width = "auto", | ||
extensions = c("Buttons", "ColReorder", "Scroller"), | ||
options = list( | ||
columnDefs = cols_to_hide, | ||
searchHighlight = TRUE, | ||
searching = TRUE, | ||
pageLength = 5L, | ||
lengthMenu = c(5L, 10L, 15L, 20L, 50L, 100L), | ||
dom = "<Bfr<\"dt-scroll\"t>ipl>", | ||
buttons = list(list( | ||
extend = "colvis", | ||
text = "Choose the columns to display", | ||
scroller = TRUE, | ||
collectionLayout = "fixed two-column" | ||
)), | ||
colReorder = TRUE | ||
) | ||
) | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.