clinify

Extensions and helper functions working with flextable objects for creating clinical reports

https://github.com/atorus-research/clinify

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (19.3%) to scientific vocabulary
Last synced: 9 months ago · JSON representation

Repository

Extensions and helper functions working with flextable objects for creating clinical reports

Basic Info
Statistics
  • Stars: 6
  • Watchers: 2
  • Forks: 3
  • Open Issues: 11
  • Releases: 1
Created over 2 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License

README.Rmd

---
output: github_document
---



```{r, include = FALSE}
knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>",
  fig.path = "man/figures/README-",
  out.width = "100%"
)
```

# **clinify** 


[![Codecov test coverage](https://codecov.io/gh/atorus-research/clinify/graph/badge.svg)](https://app.codecov.io/gh/atorus-research/clinify)
[](https://github.com/atorus-research/clinify/blob/main/LICENSE.md)
[![Lifecycle: experimental](https://img.shields.io/badge/lifecycle-experimental-orange.svg)](https://lifecycle.r-lib.org/articles/stages.html#experimental)
[![R-CMD-check](https://github.com/atorus-research/clinify/actions/workflows/R-CMD-check.yaml/badge.svg)](https://github.com/atorus-research/clinify/actions/workflows/R-CMD-check.yaml)


**{clinify}** is direct extension of the [{flextable}](https://davidgohel.github.io/flextable/) and [{officer}](https://davidgohel.github.io/officer/) packages, aimed at supplementing some functionality and simplifying some common tasks in the creation of clinical tables, listings, and figures. 


## Installation

You can install the development version of **{clinify}** like so:

```{r, eval=FALSE}
install.packages("clinify")

# Install the development version:
devtools::install_github(
  "https://github.com/atorus-research/clinify.git",
  ref = "development"
)
```

## Motivation

There's a large assortment of table packages available, and many are specifically catered to clinical reporting. For many organizations, one of these packages may very well be a great choice, but there are a couple of key motivators we've found that drove us to start writing **{clinify}**:

- Clinical output standards likely exist within an organization, and changing those standards may not be an option
- It's very likely that certain outputs will require that you deviate from those standards, so flexibility is necessary, sometimes in highly nuanced ways
- Organizations like Contract Research Organizations (CROs) may have to adapt to multiple clients' reporting standards, which likely don't look the same
- Regardless of the situation, reuse and repeatability of a given configuration is critical, and changes in configuration must be easily implemented 

Instead of building a new package from the ground up, **{clinify}** aims to extend what we see as a best choice for the situation at hand, adding new functionality where necessary and streamlining common tasks to make them more efficient for programmers to implement. We chose {flextable} for a two key reasons:

- {flextable} already offers most of the functionality that we're looking for, particularly with the pairing of {officer}. For example, word documents have to be a first class priority of output support. 

- While creating a table is the focus, the output tends to be more than just a table. We need the capability to modify the underlying document as a whole, which is another place that {officer} is truly necessary.

## Design Philosophy 

Here are some key principles we're using in building **{clinify}**:

- **{clinify}** objects should inherit from an underlying {flextable} or {officer} object
- **{clinify}** functionality must not interfere with {flextable} or {officer} functionality, i.e. {flextable} or {officer} functions called should operate without error

## Example

Here's a basic example of some of clinify's benefit in action

```{r demo_table, eval=FALSE}
library(clinify)
# Mock some data
dat <- mtcars
dat["page"] <- c(
  rep(1, 10),
  rep(2, 10),
  rep(3, 10),
  c(4, 4)
)
dat2 <- rbind(dat, dat)
dat2["groups"] <- c(
  rep("a", 32),
  rep("b", 32)
)

# Create a basic table
ct <- clintable(dat2) |>
  # Break pages by the "page" variable
  clin_page_by("page") |>
  # Add header lines using the "groups" variable
  clin_group_by("groups") |>
  # For overflowing columns, alternate pages with
  # fixed variables for each page
  clin_alt_pages(
    key_cols = c("mpg", "cyl", "hp"),
    col_groups = list(
      c("disp", "drat", "wt"),
      c("qsec", "vs", "am"),
      c("gear", "carb")
    )
  ) |>
  # Apply column widths as a proportion of the total page
  # For alternating pages, the proportion allocated to key columns
  # is carried to each page group
  clin_col_widths(mpg = .2, cyl = .2, disp = .15, vs = .15) |>
  # Add titles here is using new_header_footer to allow flextable functions
  # to customize the titles block
  clin_add_titles(
    list(
      c("Left", "Right"),
      c("Just the middle")
    )
  ) |>
  clin_add_footnotes(
    list(
      c(
        "Here's a footnote.",
        format(Sys.time(), "%H:%M %A, %B %d, %Y")
      )
    )
  )

# Print pages (by default 3 pages) to the viewer of the IDE
print(ct)
```

Built off {flextable} and {officer}, you can then write the table out to a docx file. ```{r write_table, eval=FALSE} # Write the table out to docx write_clindoc(ct, "demo_table.docx") ```

Owner

  • Name: Atorus Research
  • Login: atorus-research
  • Kind: organization

GitHub Events

Total
  • Create event: 8
  • Release event: 2
  • Issues event: 40
  • Watch event: 4
  • Delete event: 8
  • Issue comment event: 30
  • Push event: 103
  • Public event: 1
  • Pull request review event: 2
  • Pull request event: 43
  • Fork event: 3
Last Year
  • Create event: 8
  • Release event: 2
  • Issues event: 40
  • Watch event: 4
  • Delete event: 8
  • Issue comment event: 30
  • Push event: 103
  • Public event: 1
  • Pull request review event: 2
  • Pull request event: 43
  • Fork event: 3

Issues and Pull Requests

Last synced: 9 months ago

All Time
  • Total issues: 46
  • Total pull requests: 61
  • Average time to close issues: about 1 year
  • Average time to close pull requests: 4 days
  • Total issue authors: 2
  • Total pull request authors: 4
  • Average comments per issue: 0.59
  • Average comments per pull request: 0.05
  • Merged pull requests: 51
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 15
  • Pull requests: 51
  • Average time to close issues: 2 days
  • Average time to close pull requests: about 20 hours
  • Issue authors: 2
  • Pull request authors: 2
  • Average comments per issue: 0.27
  • Average comments per pull request: 0.04
  • Merged pull requests: 41
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • mstackhouse (44)
  • PallabiniDash (2)
Pull Request Authors
  • mstackhouse (55)
  • hanose (3)
  • lanmino (1)
  • RossLux (1)
Top Labels
Issue Labels
enhancement (3)
Pull Request Labels

Packages

  • Total packages: 1
  • Total downloads:
    • cran 306 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 2
  • Total maintainers: 1
cran.r-project.org: clinify

Clinical Table Styling Tools and Utilities

  • Versions: 2
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 306 Last month
Rankings
Dependent packages count: 27.0%
Stargazers count: 27.0%
Forks count: 29.0%
Dependent repos count: 33.3%
Average: 40.7%
Downloads: 87.0%
Last synced: 10 months ago