phsmethods 1.1.0 (2026-02-24)

New features

Introducing <percent> vectors, a re-imagined and simplified approach to working with percentages in R.

It is implemented as a lightweight S3 object that automatically formats proportions as percentages, simplifying any workflow that uses percentages at any stage of analysis.

Rather than:

x <- c(0.25, 0.5, 0.75)
paste0(x * 100, "%")
## [1] "25%" "50%" "75%"

You can now instead write:

x <- c(0.25, 0.5, 0.75)
as_percent(x)
## [1] "25%" "50%" "75%"

as_percent() keeps the proportions as-is and simply prints them as percentages.

p <- as_percent(0.000567)
p
## [1] "0.06%"
as.double(p) # Under-the-hood nothing is modified
## [1] 0.000567

This allows us to use <percent> vectors throughout our script without ever needing to convert to a character vector of percentages.

Maths operations are also possible with <percent> such as multiplication, division, rounding, summary statistics, etc. The more traditional workflow would require a lot more effort to do these same operations.

A percent vignette has been created to help introduce and explain this new feature.

Lifecycle changes

phsmethods 1.0.2 (2024-01-05)

phsmethods 1.0.1 (2023-11-27)

phsmethods 1.0.0 (2023-09-26)

phsmethods 0.2.3 (2023-09-11)

phsmethods 0.2.2 (2022-11-14)

phsmethods 0.2.1 (2022-02-11)

phsmethods 0.2.0 (2020-04-17)

phsmethods 0.1.1 (2020-02-10)

phsmethods 0.1.0 (2020-01-24)