knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of slrplotfun is to implement the design used by the Swedish Arthroplasty Register with figures produced by ggplot2. Functions are used for the annual report and more.
You can install the development version from GitHub with:
# install.packages("devtools") devtools::install_github("swehip/slrplotfun")
Here are some example plots but please see the individual manual pages for a comprehensive list.
library(slrplotfun) set.seed(123) # Create some data df <- data.frame(age = rpois(100000, 65), gender = sample(c('Woman', 'Woman', 'Man'), 100000, replace = TRUE)) # Age pyramid age_pyramid(df, age_var = 'age', gender_var = 'gender', man_level = 'Man', title = "This is an age pyramid") # Bar plot bar_plot(df = ggplot2::diamonds, x_var = 'color', fill_var = 'cut', y_breaks = 2) # KM-plot with 2 levels survfit_obj <- survival::survfit(survival::Surv(time/365.24, status) ~ sex, data = survival::colon ) km_plot(survfit_obj, y_lim = c(40,100), y_breaks = 10, x_lim = c(0,9)) # Line plot line_plot(df = ggplot2::diamonds, x_var = 'cut', color_var = 'color', y_breaks = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.