R package for drug shortages

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')

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)

Which produces the following chart. Nice!