diff --git a/DESCRIPTION b/DESCRIPTION index 2ac79eff..6728d526 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: Tplyr Title: A Traceability Focused Grammar of Clinical Data Summary -Version: 1.0.1 +Version: 1.0.2 Authors@R: c( person(given = "Eli", diff --git a/NEWS.md b/NEWS.md index 5dbe741a..bbf0ef94 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# Tplyr 1.0.2 +- Bug fixes + - Resolve issue with `where` logic when using population data. + # Tplyr 1.0.1 - Bug fixes - Resolve issue where `modify_nested_call()` fails if Tplyr is not loaded (#95) diff --git a/R/count.R b/R/count.R index 1368d81f..3bb0063f 100644 --- a/R/count.R +++ b/R/count.R @@ -624,9 +624,15 @@ process_count_denoms <- function(x) { abort("A value(s) were set with 'denom_ignore' but no missing count was set. Your percentages/totals may not have meaning.") } - # Logic to determine how to subset target for denominators + # Logic to determine how to subset target for denominators. if (is.null(denom_where)) { - denom_where <- where + # If a pop_data was passed change the denom_where to the pop_data_where + if (!isTRUE(try(identical(pop_data, target)))) { + denom_where <- quo(TRUE) + } else { + # Otherwise make denom_where equal to table where + denom_where <- where + } } # Because the missing strings haven't replaced the missing strings, it has to happen here. @@ -653,7 +659,9 @@ process_count_denoms <- function(x) { # population dataset. Trigger this by identifying that # the population dataset was overridden if (!isTRUE(try(identical(pop_data, target)))) { - if (deparse(denom_where) != deparse(where)) { + # If the denom_where doesn't match the where AND the denom_where isn't true + # than the user passed a custom denom_where + if (deparse(denom_where) != deparse(where) && !isTRUE(quo_get_expr(denom_where))) { warning(paste0("A `denom_where` has been set with a pop_data. The `denom_where` has been ignored.", "You should use `set_pop_where` instead of `set_denom_where`.", sep = "\n"), immediate. = TRUE) diff --git a/R/format.R b/R/format.R index f612521b..92308000 100644 --- a/R/format.R +++ b/R/format.R @@ -80,7 +80,7 @@ #' - `mean` #' - `sd` #' - `median` -#' - `variance` +#' - `var` #' - `min` #' - `max` #' - `iqr` diff --git a/R/table.R b/R/table.R index 5ab8a5ee..a2441b3a 100644 --- a/R/table.R +++ b/R/table.R @@ -25,7 +25,7 @@ #' individual parameters catered to your analysis. For example, to add a total group, you can use the #' \code{\link{add_total_group}}. #' -#' In future releases, we will provide vigenttes to fully demonstrate these capabilities. +#' In future releases, we will provide vignettes to fully demonstrate these capabilities. #' #' @param target Dataset upon which summaries will be performed #' @param treat_var Variable containing treatment group assignments. Supply unquoted. diff --git a/README.Rmd b/README.Rmd index f4863985..5f1c058c 100644 --- a/README.Rmd +++ b/README.Rmd @@ -21,7 +21,7 @@ load("vignettes/adae.Rdata") load("vignettes/adsl.Rdata") ``` -# Tplyr +# *Tplyr* [](https://pharmaverse.org) @@ -32,7 +32,7 @@ load("vignettes/adsl.Rdata") [![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) -Welcome to Tplyr! Tplyr is a traceability minded grammar of data format and summary. It's designed to simplify the creation of common clinical summaries and help you focus on how you present your data rather than redundant summaries being performed. Furthermore, for every result Tplyr produces, it also produces the metadata necessary to give your traceability from source to summary. +Welcome to **Tplyr**! **Tplyr** is a traceability minded grammar of data format and summary. It's designed to simplify the creation of common clinical summaries and help you focus on how you present your data rather than redundant summaries being performed. Furthermore, for every result **Tplyr** produces, it also produces the metadata necessary to give your traceability from source to summary. As always, we welcome your feedback. If you spot a bug, would like to see a new feature, or if any documentation is unclear - submit an issue through GitHub right [here](https://github.com/atorus-research/Tplyr/issues). @@ -40,7 +40,7 @@ Take a look at the [cheatsheet!](https://atorus-research.github.io/Tplyr_cheatsh # Installation -You can Tplyr install with: +You can install **Tplyr** with: ```{r install, eval=FALSE} # Install from CRAN: @@ -50,11 +50,11 @@ install.packages("Tplyr") devtools::install_github("https://github.com/atorus-research/Tplyr.git", ref="devel") ``` -# What is Tplyr? +# What is *Tplyr*? -[dplyr](https://dplyr.tidyverse.org/) from tidyverse is a grammar of data manipulation. So what does that allow you to do? It gives you, as a data analyst, the capability to easily and intuitively approach the problem of manipulating your data into an analysis ready form. `dplyr` conceptually breaks things down into verbs that allow you to focus on _what_ you want to do more than _how_ you have to do it. +[dplyr](https://dplyr.tidyverse.org/) from tidyverse is a grammar of data manipulation. So what does that allow you to do? It gives you, as a data analyst, the capability to easily and intuitively approach the problem of manipulating your data into an analysis ready form. [dplyr](https://dplyr.tidyverse.org/) conceptually breaks things down into verbs that allow you to focus on _what_ you want to do more than _how_ you have to do it. -`Tplyr` is designed around a similar concept, but its focus is on building summary tables common within the clinical world. In the pharmaceutical industry, a great deal of the data presented in the outputs we create are very similar. For the most part, most of these tables can be broken down into a few categories: +**Tplyr** is designed around a similar concept, but its focus is on building summary tables common within the clinical world. In the pharmaceutical industry, a great deal of the data presented in the outputs we create are very similar. For the most part, most of these tables can be broken down into a few categories: - Counting for event based variables or categories - Shifting, which is just counting a change in state with a 'from' and a 'to' @@ -74,7 +74,7 @@ When you look at this table, you can begin breaking this output down into smalle - Weight - and we're back to descriptive statistics. So we have one table, with 6 summaries (7 including the next page, not shown) - but only 2 different approaches to summaries being performed. -In the same way that `dplyr` is a grammar of data manipulation, `Tplyr` aims to be a grammar of data summary. The goal of `Tplyr` is to allow you to program a summary table like you see it on the page, by breaking a larger problem into smaller 'layers', and combining them together like you see on the page. +In the same way that [dplyr](https://dplyr.tidyverse.org/) is a grammar of data manipulation, **Tplyr** aims to be a grammar of data summary. The goal of **Tplyr** is to allow you to program a summary table like you see it on the page, by breaking a larger problem into smaller 'layers', and combining them together like you see on the page. Enough talking - let's see some code. In these examples, we will be using data from the [PHUSE Test Data Factory]( https://advance.phuse.global/display/WEL/Test+Dataset+Factory) based on the [original pilot project submission package](https://github.com/atorus-research/CDISC_pilot_replication). Note: You can see our replication of the CDISC pilot using the PHUSE Test Data Factory data [here](https://github.com/atorus-research/CDISC_pilot_replication). @@ -92,15 +92,15 @@ tplyr_table(adsl, TRT01P, where = SAFFL == "Y") %>% ``` -## 'Tplyr' is Qualified +## *Tplyr* is Qualified -We understand how important documentation and testing is within the pharmaceutical world. This is why outside of unit testing 'Tplyr includes an entire user-acceptance testing document, where requirements were established, test-cases were written, and tests were independently programmed and executed. We do this in the hope that you can leverage our work within a qualified programming environment, and that we save you a substantial amount of trouble in getting it there. +We understand how important documentation and testing is within the pharmaceutical world. This is why outside of unit testing **Tplyr** includes an entire user-acceptance testing document, where requirements were established, test-cases were written, and tests were independently programmed and executed. We do this in the hope that you can leverage our work within a qualified programming environment, and that we save you a substantial amount of trouble in getting it there. You can find the qualification document within this repository right [here](https://github.com/atorus-research/Tplyr/blob/master/uat/references/output/uat.pdf). The 'uat' folder additionally contains all of the raw files, programmatic tests, specifications, and test cases necessary to create this report. ## The TL;DR -Here are some of the high level benefits of using `Tplyr`: +Here are some of the high level benefits of using **Tplyr**: - Easy construction of table data using an intuitive syntax - Smart string formatting for your numbers that's easily specified by the user @@ -108,7 +108,7 @@ Here are some of the high level benefits of using `Tplyr`: # Where to go from here? -There's quite a bit more to learn! And we've prepared a number of other vignettes to help you get what you need out of 'Tplyr'. +There's quite a bit more to learn! And we've prepared a number of other vignettes to help you get what you need out of **Tplyr**. - The best place to start is with our Getting Started vignette at `vignette("Tplyr")` - Learn more about table level settings in `vignette("table")` @@ -117,18 +117,18 @@ There's quite a bit more to learn! And we've prepared a number of other vignette - Learn more about shift layers in `vignette("shift")` - Learn more about percentages in `vignette("denom")` - Learn more about calculating risk differences in `vignette("riskdiff")` -- Learn more about sorting 'Tplyr' tables in `vignette("sort")` -- Learn more about using 'Tplyr' options in `vignette("options")` -- And finally, learn more about producing and outputting styled tables using 'Tplyr' in `vignette("styled-table")` +- Learn more about sorting **Tplyr** tables in `vignette("sort")` +- Learn more about using **Tplyr** options in `vignette("options")` +- And finally, learn more about producing and outputting styled tables using **Tplyr** in `vignette("styled-table")` -In the Tplyr version 1.0.0, we've packed a number of new features in. For deeper dives on the largest new additions: +In the **Tplyr** version 1.0.0, we've packed a number of new features in. For deeper dives on the largest new additions: -- Learn about Tplyr's traceability metadata in `vignette("metadata")` and about how it can be extended in `vigentte("custom-metadata")` +- Learn about **Tplyr**'s traceability metadata in `vignette("metadata")` and about how it can be extended in `vignette("custom-metadata")` - Learn about layer templates in `vignette("layer_templates")` # References -In building 'Tplyr', we needed some additional resources in addition to our personal experience to help guide design. PHUSE has done some great work to create guidance for standard outputs with collaboration between multiple pharmaceutical companies and the FDA. You can find some of the resource that we referenced below. +In building **Tplyr**, we needed some additional resources in addition to our personal experience to help guide design. PHUSE has done some great work to create guidance for standard outputs with collaboration between multiple pharmaceutical companies and the FDA. You can find some of the resource that we referenced below. [Analysis and Displays Associated with Adverse Events](https://phuse.s3.eu-central-1.amazonaws.com/Deliverables/Standard+Analyses+and+Code+Sharing/Analyses+and+Displays+Associated+with+Adverse+Events+Focus+on+Adverse+Events+in+Phase+2-4+Clinical+Trials+and+Integrated+Summary.pdf) diff --git a/README.md b/README.md index 318bc427..98d0c81a 100644 --- a/README.md +++ b/README.md @@ -15,12 +15,12 @@ status](https://github.com/atorus-research/tplyr/workflows/R-CMD-check/badge.svg stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable) -Welcome to Tplyr! Tplyr is a traceability minded grammar of data format -and summary. It’s designed to simplify the creation of common clinical -summaries and help you focus on how you present your data rather than -redundant summaries being performed. Furthermore, for every result Tplyr -produces, it also produces the metadata necessary to give your -traceability from source to summary. +Welcome to **Tplyr**! **Tplyr** is a traceability minded grammar of data +format and summary. It’s designed to simplify the creation of common +clinical summaries and help you focus on how you present your data +rather than redundant summaries being performed. Furthermore, for every +result **Tplyr** produces, it also produces the metadata necessary to +give your traceability from source to summary. As always, we welcome your feedback. If you spot a bug, would like to see a new feature, or if any documentation is unclear - submit an issue @@ -32,7 +32,7 @@ Take a look at the # Installation -You can Tplyr install with: +You can install **Tplyr** with: ``` r # Install from CRAN: @@ -47,11 +47,12 @@ devtools::install_github("https://github.com/atorus-research/Tplyr.git", ref="de [dplyr](https://dplyr.tidyverse.org/) from tidyverse is a grammar of data manipulation. So what does that allow you to do? It gives you, as a data analyst, the capability to easily and intuitively approach the -problem of manipulating your data into an analysis ready form. `dplyr` -conceptually breaks things down into verbs that allow you to focus on -*what* you want to do more than *how* you have to do it. +problem of manipulating your data into an analysis ready form. +[dplyr](https://dplyr.tidyverse.org/) conceptually breaks things down +into verbs that allow you to focus on *what* you want to do more than +*how* you have to do it. -`Tplyr` is designed around a similar concept, but its focus is on +**Tplyr** is designed around a similar concept, but its focus is on building summary tables common within the clinical world. In the pharmaceutical industry, a great deal of the data presented in the outputs we create are very similar. For the most part, most of these @@ -92,11 +93,11 @@ conceptualize this. So we have one table, with 6 summaries (7 including the next page, not shown) - but only 2 different approaches to summaries being performed. -In the same way that `dplyr` is a grammar of data manipulation, `Tplyr` -aims to be a grammar of data summary. The goal of `Tplyr` is to allow -you to program a summary table like you see it on the page, by breaking -a larger problem into smaller ‘layers’, and combining them together like -you see on the page. +In the same way that [dplyr](https://dplyr.tidyverse.org/) is a grammar +of data manipulation, **Tplyr** aims to be a grammar of data summary. +The goal of **Tplyr** is to allow you to program a summary table like +you see it on the page, by breaking a larger problem into smaller +‘layers’, and combining them together like you see on the page. Enough talking - let’s see some code. In these examples, we will be using data from the [PHUSE Test Data @@ -132,10 +133,10 @@ tplyr_table(adsl, TRT01P, where = SAFFL == "Y") %>% | Age Categories n (%) | \>80 | 30 ( 34.9%) | 18 ( 21.4%) | 29 ( 34.5%) | 2 | 1 | 2 | | Age Categories n (%) | 65-80 | 42 ( 48.8%) | 55 ( 65.5%) | 47 ( 56.0%) | 2 | 1 | 3 | -## ‘Tplyr’ is Qualified +## Tplyr is Qualified We understand how important documentation and testing is within the -pharmaceutical world. This is why outside of unit testing ’Tplyr +pharmaceutical world. This is why outside of unit testing **Tplyr** includes an entire user-acceptance testing document, where requirements were established, test-cases were written, and tests were independently programmed and executed. We do this in the hope that you can leverage @@ -150,7 +151,7 @@ this report. ## The TL;DR -Here are some of the high level benefits of using `Tplyr`: +Here are some of the high level benefits of using **Tplyr**: - Easy construction of table data using an intuitive syntax - Smart string formatting for your numbers that’s easily specified by @@ -161,7 +162,7 @@ Here are some of the high level benefits of using `Tplyr`: # Where to go from here? There’s quite a bit more to learn! And we’ve prepared a number of other -vignettes to help you get what you need out of ‘Tplyr’. +vignettes to help you get what you need out of **Tplyr**. - The best place to start is with our Getting Started vignette at `vignette("Tplyr")` @@ -172,25 +173,26 @@ vignettes to help you get what you need out of ‘Tplyr’. - Learn more about percentages in `vignette("denom")` - Learn more about calculating risk differences in `vignette("riskdiff")` -- Learn more about sorting ‘Tplyr’ tables in `vignette("sort")` -- Learn more about using ‘Tplyr’ options in `vignette("options")` +- Learn more about sorting **Tplyr** tables in `vignette("sort")` +- Learn more about using **Tplyr** options in `vignette("options")` - And finally, learn more about producing and outputting styled tables - using ‘Tplyr’ in `vignette("styled-table")` + using **Tplyr** in `vignette("styled-table")` -In the Tplyr version 1.0.0, we’ve packed a number of new features in. -For deeper dives on the largest new additions: +In the **Tplyr** version 1.0.0, we’ve packed a number of new features +in. For deeper dives on the largest new additions: -- Learn about Tplyr’s traceability metadata in `vignette("metadata")` - and about how it can be extended in `vigentte("custom-metadata")` +- Learn about **Tplyr’s** traceability metadata in + `vignette("metadata")` and about how it can be extended in + `vignette("custom-metadata")` - Learn about layer templates in `vignette("layer_templates")` # References -In building ‘Tplyr’, we needed some additional resources in addition to -our personal experience to help guide design. PHUSE has done some great -work to create guidance for standard outputs with collaboration between -multiple pharmaceutical companies and the FDA. You can find some of the -resource that we referenced below. +In building **Tplyr**, we needed some additional resources in addition +to our personal experience to help guide design. PHUSE has done some +great work to create guidance for standard outputs with collaboration +between multiple pharmaceutical companies and the FDA. You can find some +of the resource that we referenced below. [Analysis and Displays Associated with Adverse Events](https://phuse.s3.eu-central-1.amazonaws.com/Deliverables/Standard+Analyses+and+Code+Sharing/Analyses+and+Displays+Associated+with+Adverse+Events+Focus+on+Adverse+Events+in+Phase+2-4+Clinical+Trials+and+Integrated+Summary.pdf) diff --git a/cran-comments.md b/cran-comments.md index 4ee9d510..00720ad0 100644 --- a/cran-comments.md +++ b/cran-comments.md @@ -1,13 +1,12 @@ -## Submission 0.4.4 -* Functionality update for sorting nested count layers -* Updates for changes to rlang +## Submission 1.0.2 +* Bug fix identified in Tplyr 1.0.1 ## Test Environments * Local Ubuntu 18.04.4 devtools::check * Latest Ubuntu CI with latest tidyverse * Github release action with windows, linux, and osx check - +* RHub Check ## R CMD CHECK Results No Errors, warnings, or notes diff --git a/docs/404.html b/docs/404.html index c505ccf7..7c82bc7d 100644 --- a/docs/404.html +++ b/docs/404.html @@ -13,8 +13,8 @@ - - + + @@ -41,7 +41,7 @@ Tplyr - 1.0.0 + 1.0.1.9000