Closed andrewallenbruce closed 1 month ago
``` r
library(tictoc)
library(provider)
library(tidyverse)
library(highcharter)
tic()
rhc_abb <- providers(specialty_code = "00-17") |>
count(state,
sort = TRUE,
name = "count")
#> # A tibble: 45 × 2
#> state count
#>
Created on 2023-10-18 with reprex v2.0.2
``` r library(highcharter) library(tidyverse) library(provider) ex <- gen_data(2020:2030) |> change(pay) |> dplyr::mutate(group = NULL) |> dplyr::distinct(year, .keep_all = TRUE) ex |> hchart("column", hcaes(x = year, y = pay_chg), name = "Change") |> hc_yAxis(gridLineWidth = 0, labels = list( style = list( color = "#000000")), title = list(text = "", style = list( color = "#000000"))) |> hc_xAxis(labels = list( style = list( color = "#000000")), title = FALSE, lineWidth = 0, tickWidth = 0) |> hc_title(text = "Yearly Absolute Change") |> hc_tooltip(useHTML = TRUE, crosshairs = TRUE, borderWidth = 1, sort = TRUE) |> hc_plotOptions(column = list( color = "red", dataLabels = list( enabled = TRUE))) |> hc_add_theme(hc_theme_smpl()) |> hc_size(height = 500, width = 550) ```
Created on 2023-10-20 with reprex v2.0.2
Code
``` r library(tictoc) library(provider) library(tidyverse) library(highcharter) tic() rhc <- providers(specialty_code = "00-17") #> # A tibble: 5,168 × 7 #> npi pac enid specialty_code specialty_description state organization #>
#> 1 15088613… 0941… O200… 00-17 PART A PROVIDER - RU… WA PALOUSE HEA…
#> 2 14978560… 0042… O200… 00-17 PART A PROVIDER - RU… ND WEST RIVER …
#> 3 17605703… 0042… O200… 00-17 PART A PROVIDER - RU… ND WEST RIVER …
#> 4 18019879… 0042… O200… 00-17 PART A PROVIDER - RU… SD WEST RIVER …
#> 5 18312861… 0042… O200… 00-17 PART A PROVIDER - RU… ND WEST RIVER …
#> 6 15583893… 0547… O200… 00-17 PART A PROVIDER - RU… ND CARRINGTON …
#> 7 18018116… 0547… O200… 00-17 PART A PROVIDER - RU… ND CARRINGTON …
#> 8 16694912… 0547… O200… 00-17 PART A PROVIDER - RU… ND ST. JOSEPH'…
#> 9 18816228… 0244… O200… 00-17 PART A PROVIDER - RU… MI PRESCOTT CL…
#> 10 11442076… 0648… O200… 00-17 PART A PROVIDER - RU… CA MEDICAL OFF…
#> # ℹ 5,158 more rows
rhc_count <- rhc |>
count(state,
sort = TRUE,
name = "count") |>
mutate(state = campfin::expand_state(state),
state = stringr::str_to_title(state))
#> # A tibble: 45 × 2
#> state count
#>
#> 1 Kentucky 370
#> 2 Texas 332
#> 3 Missouri 326
#> 4 Tennessee 263
#> 5 Illinois 262
#> 6 California 252
#> 7 Mississippi 227
#> 8 Michigan 221
#> 9 Louisiana 214
#> 10 Iowa 209
#> # ℹ 35 more rows
hc <- rhc_count |>
hchart("bar",
hcaes(x = state, y = count),
color = "#2980b9",
name = "Rural Health Clinics") |>
hc_yAxis(gridLineWidth = 0,
labels = list(
style = list(color = "#000000")),
title = list(
text = "",
style = list(color = "#000000"))) |>
hc_xAxis(labels = list(style = list(color = "#000000")),
title = list(text= ""),
lineWidth = 0,
tickWidth = 0) |>
hc_tooltip(useHTML = TRUE,
crosshairs = TRUE,
borderWidth = 1,
sort = TRUE) |>
hc_add_theme(hc_theme_bloom()) |>
hc_plotOptions(column = list(
dataLabels = list(enabled = TRUE))) |>
hc_title(
text = "Number of Rural Health Clinics by State",
margin = 10,
align = "left",
style = list(color = "#22A884",
useHTML = TRUE)) |>
hc_size(height = 1000,
width = 800)
toc()
#> 3.56 sec elapsed
```
Created on 2023-10-18 with reprex v2.0.2