The Distribution of Average Price for Most Advertised Drugs, Ordered by Descending Advertising Spending
#shiny application : most advertised (by spending) vs. most abused vs. most prescribed (by sales)
#another shiny application: give list of all "most" drugs and can see boxplot for that specific drug
final_dataset %>%
  filter(!is.na(avg_price)) %>%
  filter(trade_name %in% top_advertising_cost) %>%
  ungroup() %>%
  mutate(trade_name = factor(trade_name)) %>%
  mutate(trade_name_new = fct_relevel(trade_name, c("Eliquis", "Xeljanz", "Cialis", "Invokana", "Latuda","Viagra"))) %>%
   group_by(trade_name) %>% 
  plot_ly(x = ~trade_name_new, y = ~avg_price, type = "box", color = ~trade_name, colors = "Set3") %>%
  layout(title = "Distribution of Average Price for Most Advertised Drugs, 
         Ordered by Descending Advertising Spending", xaxis = trade_name_axis, yaxis = avg_price_axis)

We see a weak trend: The less advertising, the higher the price