Learn R Programming

⚠️There's a newer version (0.2.2) of this package.Take me there.

healthyR

The goal of healthyR is to help quickly analyze common data problems in the Administrative and Clincial spaces.

Installation

You can install the released version of healthyR from CRAN with:

install.packages("healthyR")

And the development version from GitHub with:

# install.packages("devtools")
devtools::install_github("spsanderson/healthyR")

Example

This is a basic example of using the ts_median_excess_plt() function`:

library(healthyR)
library(timetk)
library(dplyr)

ts_signature_tbl(.data = m4_daily, .date_col = date, .pad_time = TRUE, id) %>%
    ts_median_excess_plt(
        .date_col           = date
        , .value_col        = value
        , .x_axis           = week
        , .ggplot_group_var = year
        , .years_back       = 5
    )

Here is a simple example of using the ts_signature_tbl() function:

library(healthyR)
library(timetk)

ts_signature_tbl(.data = m4_daily, .date_col = date)
#> # A tibble: 17,578 × 31
#>    id    date       value index.num  diff  year year.iso  half quarter month
#>    <fct> <date>     <dbl>     <dbl> <dbl> <int>    <int> <int>   <int> <int>
#>  1 D410  1978-06-23 9109. 267408000    NA  1978     1978     1       2     6
#>  2 D410  1978-06-24 9103. 267494400 86400  1978     1978     1       2     6
#>  3 D410  1978-06-25 9116. 267580800 86400  1978     1978     1       2     6
#>  4 D410  1978-06-26 9116. 267667200 86400  1978     1978     1       2     6
#>  5 D410  1978-06-27 9106. 267753600 86400  1978     1978     1       2     6
#>  6 D410  1978-06-28 9094. 267840000 86400  1978     1978     1       2     6
#>  7 D410  1978-06-29 9094. 267926400 86400  1978     1978     1       2     6
#>  8 D410  1978-06-30 9084. 268012800 86400  1978     1978     1       2     6
#>  9 D410  1978-07-01 9081. 268099200 86400  1978     1978     2       3     7
#> 10 D410  1978-07-02 9047. 268185600 86400  1978     1978     2       3     7
#> # … with 17,568 more rows, and 21 more variables: month.xts <int>,
#> #   month.lbl <ord>, day <int>, hour <int>, minute <int>, second <int>,
#> #   hour12 <int>, am.pm <int>, wday <int>, wday.xts <int>, wday.lbl <ord>,
#> #   mday <int>, qday <int>, yday <int>, mweek <int>, week <int>,
#> #   week.iso <int>, week2 <int>, week3 <int>, week4 <int>, mday7 <int>

Here is a simple example of using the plt_gartner_magic_chart() function:

suppressPackageStartupMessages(library(healthyR))
suppressPackageStartupMessages(library(tibble))
suppressPackageStartupMessages(library(dplyr))

gartner_magic_chart_plt(
  .data = tibble(x = rnorm(100, 0, 1), y = rnorm(100, 0, 1))
  , .x_col = x
  , .y_col = y
  , .y_lab = "los"
  , .x_lab = "RA"
  , .plt_title = "Test Title"
  , .tl_lbl = "Top Left lbl"
  , .tr_lbl = "Top Right lbl"
  , .bl_lbl = "Bottom Left lbl"
  , .br_lbl = "Bottom Right lbl"
)

Copy Link

Version

Install

install.packages('healthyR')

Monthly Downloads

248

Version

0.2.0

License

MIT + file LICENSE

Issues

Pull Requests

Stars

Forks

Maintainer

Steven Sanderson

Last Published

July 18th, 2022

Functions in healthyR (0.2.0)

hr_scale_fill_colorblind

Provide Colorblind Compliant Colors
px_cc_mapping

Procedure to Condition Code Mapping file
%>%

Pipe operator
los_ra_index_plt

Plot LOS and Readmit Index with Variance
los_ra_index_summary_tbl

Make LOS and Readmit Index Summary Tibble
kmeans_scree_plt

K-Means Scree Plot
ts_census_los_daily_tbl

Time Series - Census and LOS by Day
ts_alos_plt

Plot ALOS - Average Length of Stay
kmeans_scree_data_tbl

K-Means Scree Plot Data Table
save_to_excel

Save a file to Excel
service_line_augment

Service Line Grouper Augment Function
ts_plt

Time Series Plot
ts_median_excess_plt

Create a plot showing the excess of the median value
kmeans_user_item_tbl

K-Means Functions
kmeans_tidy_tbl

K-Means tidy Functions
tidyeval

Tidy eval helpers
named_item_list

Tibble to named list
umap_list

UMAP Projection
top_n_tbl

Top N tibble
sql_left

Use SQL LEFT type function
opt_bin

Get the optimal binwidth for a histogram
service_line_vec

Service Line Grouper Vectorized Function
sql_right

Use SQL RIGHT type functions
ts_signature_tbl

Make a Time Enhanced Tibble
sql_mid

Use SQL MID type function
ts_readmit_rate_plt

Plot Readmit Rate
umap_plt

UMAP and K-Means Cluster Visualization
kmeans_obj

K-Means Functions
category_counts_tbl

Counts by Category
gartner_magic_chart_plt

Gartner Magic Chart - Plotting of two continuous variables
hr_scale_color_colorblind

Provide Colorblind Compliant Colors
diverging_bar_plt

Diverging Bar Chart
color_blind

Provide Colorblind Compliant Colors
kmeans_mapped_tbl

K-Means Mapper
dx_cc_mapping

Diagnosis to Condition Code Mapping file
diverging_lollipop_plt

Diverging Lollipop Chart