Skip to content

Commit

Permalink
Merge pull request #108 from atorus-research/devel
Browse files Browse the repository at this point in the history
Introduce bug fix for #106 to prepare for CRAN release
  • Loading branch information
elimillera committed Nov 4, 2022
2 parents 03f7650 + 66f5b06 commit 7ea8a92
Show file tree
Hide file tree
Showing 99 changed files with 1,403 additions and 1,194 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
4 changes: 4 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
14 changes: 11 additions & 3 deletions R/count.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion R/format.R
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
#' - `mean`
#' - `sd`
#' - `median`
#' - `variance`
#' - `var`
#' - `min`
#' - `max`
#' - `iqr`
Expand Down
2 changes: 1 addition & 1 deletion R/table.R
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
34 changes: 17 additions & 17 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ load("vignettes/adae.Rdata")
load("vignettes/adsl.Rdata")
```

# Tplyr <img src="man/figures/logo.png" align="right" alt="" width="120" />
# *Tplyr* <img src="man/figures/logo.png" align="right" alt="" width="120" />

<!-- badges: start -->
[<img src="http://pharmaverse.org/shields/Tplyr.svg">](https://pharmaverse.org)
Expand All @@ -32,15 +32,15 @@ load("vignettes/adsl.Rdata")
[![Lifecycle: stable](https://img.shields.io/badge/lifecycle-stable-brightgreen.svg)](https://lifecycle.r-lib.org/articles/stages.html#stable)
<!-- badges: end -->

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).

Take a look at the [cheatsheet!](https://atorus-research.github.io/Tplyr_cheatsheet.pdf)

# Installation

You can Tplyr install with:
You can install **Tplyr** with:

```{r install, eval=FALSE}
# Install from CRAN:
Expand All @@ -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'
Expand All @@ -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).

Expand All @@ -92,23 +92,23 @@ 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
- A great deal of flexibility in what is performed and how it's presented, without specifying hundreds of parameters

# 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")`
Expand All @@ -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)

Expand Down
66 changes: 34 additions & 32 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
<!-- badges: end -->

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
Expand All @@ -32,7 +32,7 @@ Take a look at the

# Installation

You can Tplyr install with:
You can install **Tplyr** with:

``` r
# Install from CRAN:
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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")`
Expand All @@ -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)
Expand Down
7 changes: 3 additions & 4 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 7ea8a92

Please sign in to comment.