Install libraries, pull in dataset.
#install.packages("tidyverse")
#install.packages("plotly")
#install.packages("ggplot2")
#install.packages("dplyr")
library(tidyverse)
## Warning: package 'tidyverse' was built under R version 3.5.3
## -- Attaching packages ---------------------------------------------------- tidyverse 1.2.1 --
## v ggplot2 3.2.1 v purrr 0.3.3
## v tibble 2.1.3 v dplyr 0.8.3
## v tidyr 1.0.0 v stringr 1.4.0
## v readr 1.3.1 v forcats 0.4.0
## Warning: package 'ggplot2' was built under R version 3.5.3
## Warning: package 'tibble' was built under R version 3.5.3
## Warning: package 'tidyr' was built under R version 3.5.3
## Warning: package 'readr' was built under R version 3.5.2
## Warning: package 'dplyr' was built under R version 3.5.3
## Warning: package 'stringr' was built under R version 3.5.3
## Warning: package 'forcats' was built under R version 3.5.3
## -- Conflicts ------------------------------------------------------- tidyverse_conflicts() --
## x dplyr::filter() masks stats::filter()
## x dplyr::lag() masks stats::lag()
library(plotly)
## Warning: package 'plotly' was built under R version 3.5.3
##
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
library(ggplot2)
library(dplyr)
participation <- read.csv("BPCIAparticipants.csv")
dim(participation)
## [1] 1086 10
summary(participation)
## bpid orglegalname
## 1001-0000: 1 REMEDY BPCI PARTNERS, LLC :228
## 1006-0000: 1 NAVIHEALTH, INC. :104
## 1011-0001: 1 FUSION5, INC. : 91
## 1019-0000: 1 STRYKER : 81
## 1045-0000: 1 UNITED HEALTHCARE SERVICES, INC.: 64
## 1048-0000: 1 SIGNATURE MEDICAL GROUP, INC. : 39
## (Other) :1080 (Other) :479
## orgdbaname role participanttype
## REMEDY PARTNERS :228 Convener :835 ACH :131
## NAVIHEALTH, INC. :104 Participant:251 Other:771
## FUSION5 : 91 PGP :184
## STRYKER PERFORMANCE SOLUTIONS : 81
## UNITED HEALTHCARE SERVICES, INC.: 64
## SIGNATURE CARE MANAGEMENT : 39
## (Other) :479
## address1 address2 city
## 1120 POST ROAD :164 :822 DARIEN :228
## 210 WESTWOOD PLACE, SUITE 400 :104 SUITE 300:106 BRENTWOOD :124
## 117 SOUTH MAIN STREET : 91 SUITE 100: 36 CHICAGO :102
## 350 NORTH ORLEANS ST., SUITE 650: 70 N/A : 22 ST. CHARLES: 91
## 1120 POST RD : 64 SUITE 120: 19 MINNETONKA : 64
## 9900 BREN ROAD EAST : 64 SUITE 270: 13 LOS ANGELES: 55
## (Other) :529 (Other) : 68 (Other) :422
## state zip
## CT :230 Min. : 1605
## MO :135 1st Qu.: 6820
## IL :130 Median :43215
## TN :130 Mean :42034
## CA : 79 3rd Qu.:63141
## MN : 68 Max. :99508
## (Other):314
The dimensions are 1,086 records of 10 variables.
the summary shows we have 835 Conveners, 251 Participants, 131 ACH, 771 Other, and 184 PGP. It also names the top 6 organizations by count.
Select the variables we want to look at and assign them back to participation dataset.
I decided to rename (mutate) the role so instead of “Participant” and “Convener” we have “Convener” and “Non-Convener” as this is how our BPCI Advanced Team speaks about them.
participation <- participation %>%
select(bpid, orglegalname, orgdbaname, role, participanttype, city, state) %>%
mutate(role = case_when(role=="Participant"~"Non-Convener", role=="Convener"~"Convener"))
Create a histogram of the roles.
I used plotly to display the counts when you hover.
roleplot <- qplot(data=participation, role, fill=role, geom_bar = "histogram", bins=20) +
scale_fill_brewer(palette= "Dark2") +
xlab("Participant Role") +
ylab("Number of Participants") +
ggtitle(label="BPCI Advanced MY 1&2 Convener and Non-Convener \n Participants by Role") +
theme(legend.title=element_blank())
## Warning: Ignoring unknown parameters: geom_bar, bins
ggplotly(roleplot)
Now I’ll plot the Participant Types (ACH, PGP, or Other) for our 1,086 Participants.
First, I sort the sort the types in a specific order: ACH, PGP, Other.
participation$participanttype <- ordered(participation$participanttype,levels=c("ACH", "PGP", "Other"))
typesplot <- qplot(data=participation, participanttype, fill=participanttype, labels=c("ACH", "PGP", "Other"), geom_bar = "histogram", bins=20) +
xlab("Participant Type") +
ylab("Number of Participants") +
ggtitle("BPCI Advanced MY 1&2 All Participants by Type") +
theme(legend.title=element_blank()) +
scale_fill_manual(values=c("darkgoldenrod1", "blueviolet", "cadetblue3"))
## Warning: Ignoring unknown parameters: labels, geom_bar, bins
ggplotly(typesplot)
Plot the number of Conveners by type (ACHs, PGPs, and Other).
allconveners <- participation %>%
filter(role =="Convener")
allconvenersplot <- qplot(data=allconveners, participanttype, fill=participanttype, geom_bar = "histogram", bins=20) +
theme(legend.title=element_blank()) +
xlab("Participant Type") +
ylab("Number of Participants") +
ggtitle("BPCI Advanced MY 1&2 Conveners by Type") +
scale_fill_manual(values=c("darkgoldenrod1", "blueviolet", "cadetblue3"))
## Warning: Ignoring unknown parameters: geom_bar, bins
ggplotly(allconvenersplot)
Plot the number of Non-Conveners by type (ACHs, PGPs, and Other).
nonconveners <- participation %>%
filter(role =="Non-Convener")
nonconvenersplot <- qplot(data=nonconveners, participanttype, fill=participanttype, geom_bar = "histogram", bins=20) +
theme(legend.title=element_blank()) +
xlab("Participant Type") +
ylab("Number of Participants") +
ggtitle("BPCI Advanced MY 1&2 Non-Conveners by Type") +
scale_fill_manual(values=c("darkgoldenrod1", "blueviolet", "cadetblue3"))
## Warning: Ignoring unknown parameters: geom_bar, bins
ggplotly(nonconvenersplot)