Brian Erly, MD MPH

Brian Erly, MD MPH, is a physician and epidemiologist. He currently works as a primary care provider at Marathon Health and as a telemedicine physician with Mochi Health. He also serves as the medical director of the Salish Research Group, which works at the intersection of health science, data science, and novel statistical methods.

You can learn more about Dr. Erly’s experience by accessing his CV in the menu bar or by interacting with the visualization below.

Show the code
# Load packages
suppressPackageStartupMessages(library(tidyverse))
suppressPackageStartupMessages(library(lubridate))

# Read in data, specify column types
Network_Data <- read_csv("data/Network_Data.csv",
                         col_types = "cicflilc"
) %>%
  mutate(Date = mdy(Date))

### Principal Components analysis
# See https://towardsdatascience.com/understanding-dimension-reduction-and-principal-component-analysis-in-r-e3fbd02b29ae

# Perform principal components analsis (for 3d graphing)
pca <- Network_Data  %>%
  select(-Title, - Link, -Date) %>%
  mutate(across(everything(),as.numeric
  )
  ) %>%
  prcomp(scale = TRUE)

# Extract principal components
pca_x <- pca$x %>%
  data.frame() %>%
  `colnames<-`(c("PCA1","PCA2","PCA3","PCA4","PCA5"))

# Add in PCA output to graph
Network_Data_Plot <- Network_Data %>%
   mutate(PCA1 = pca_x$PCA1,
          PCA2 = pca_x$PCA2
          )

### Generate plotly visualization

fig <- plotly::plot_ly(Network_Data_Plot,
                x = ~PCA1,
                y = ~PCA2,
                z = ~Date,
                marker = list(size = 5,
                              opacity = 0.8) ) %>%
  plotly::add_markers(color = ~Category,
                customdata = ~Link,
                text = ~Title,
                hoverinfo = "text")%>% 
  plotly::config(displayModeBar = FALSE)

# Make points clikcable (if links available)
# See https://stackoverflow.com/questions/51681079/how-to-make-scatterplot-points-open-a-hyperlink-using-ggplotly-r

figgy <- htmlwidgets::onRender(fig, "
     function(el, x) {
     el.on('plotly_click', function(d) {
     var Link = d.points[0].customdata;
     //Link
     window.open(Link);
     });
     }
     ")

# Display graph output
figgy

Click on the graph to view additional works and resources.


Page created in R Markdown and Quarto. Source code available in GitHub.