Load libraries
library(plotly)
library(ggplot2)
library(dplyr)
Load the dataset, and convert variables into factor and numerics.
hedis <- read.csv("~/MHS_HEDIS_EOY_2015.csv", stringsAsFactors = FALSE)
hedis$enrollment <- gsub(",","", hedis$enrollment)
hedis$enrollment <- as.numeric(hedis$enrollment)
hedis$location <- as.factor(hedis$location)
hedis$thsnd <- hedis$enrollment/1000
Scatterplot using plotly
p <- plot_ly(hedis, x = hedis$thsnd, y = hedis$score)
add_markers(p, color = hedis$location,
colors = "Set1",
size = hedis$enrollment) %>%
layout(p, title = "HEDIS Score by Enrollment",
xaxis = list(title = "Enrollment (Thousands)"),
yaxis = list(title = "HEDIS Composite Score"))
## Warning in arrange_impl(.data, dots): '.Random.seed' is not an integer
## vector but of type 'NULL', so ignored