knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
rwetasks has simple functions for performing common tasks, such as calculating the number (and proportion) of people: in each age group, receiving a specific treatment, annualizing healthcare costs and how different inclusion criteria affects the sample size. It was built for anyone working with real-world data (RWDD) in mind, however experienced R users can already do everything covered here. rwetasks is aimed at improving speed of simple tasks, so you can use your brain power for the more complex stuff!
Status: Currently in development, not officially released yet (aka not ready for prime time)
The development version from GitHub with:
# install.packages("devtools") devtools::install_github("battenr/rwetasks")
mean_by_group provides a way to calculate the mean for each group. Can also be used across a dataframe when you want to calculate mean(sd) for each group for every variable
library(tidyverse) library(rwetasks) rwetasks::mean_by_group(mtcars, mpg, gear) # Can also use across a dataframe like so mtcars %>% purrr::map( ~mean_by_group(mtcars, .x, gear) )
count_percent provides a way to quickly calculate the number (n) and proportion of each value of a variable, arranged by proportion.
library(tidyverse) library(rwetasks) rwetasks::count_percent(mtcars, gear)
count_percent_demo provides a way to quickly calculate the number (n) and proportion of each value of a variable, when you have multiple measures per participants (i.e., if you have longitudinal data, but want to calculate proportion of females for participants).
library(tidyverse) library(rwetasks) rwetasks::count_percent_demo(iris, Species, Petal.Width)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.