R package for drug shortages

This post is a part of a series on drug shortages.

2020 May Update: This package is now called rdrugshortages.

Introducing drugshortagesr! An awful name for somewhat useful chunk of code to make it easier to access shortagescanada.ca shortage data. The package is currently in development, but you can try it out now but installing it like so:

install.packages('devtools')
devtools::install_github('pipitone/drugshortagesr')Code language: PHP (php)

I’ve tried to keep it simple:

library(tidyverse)
library(drugshortagesr)
dsc_login("your@address.com", "password") # your login info
    
# search results default to data.frame so it plays well with tidyverse
dsc_search(term="venlafaxine") %>% 
  filter(actual_start_date >= "2019-01-01") %>% 
  ggplot(aes(x=company_name, fill=status)) + geom_bar() + coord_flip() +
  labs(
    title="Number of shortages of Venlafaxine in 2019 by manufacturer",
    x=NULL)Code language: PHP (php)

Which produces the following chart. Nice!

1 Comment

Comments are closed.