Skip to content

explore use of multi level venn diagram template #5

@ctastad

Description

@ctastad
library(ggvenn)
library(tidyverse)
library(kableExtra)

base <- read_csv("allofus_cohort_combined.csv") %>%
  mutate(new_col = "TRUE")

no_white <- base %>%
  filter(race != "White")

aa_only <- base %>%
  filter(race == "Black or African American")

plot_venn <- function(input, title) {
  a <- input %>%
    select(
      value = person_id,
      cohort,
      new_col
    ) %>%
    pivot_wider(
      names_from = cohort,
      values_from = new_col,
      values_fill = "FALSE"
    ) %>%
    mutate(
      Gettler = (Gettler == "TRUE"),
      Wide = (Wide == "TRUE"),
      Wide_filtered = (Wide_filtered == "TRUE"),
      DCC_Grant = (DCC_Grant == "TRUE")
    )

  ggvenn(
    a,
    c(
      "Gettler",
      "Wide",
      "Wide_filtered",
      "DCC_Grant"
    ),
    show_percentage = F
  ) +
    labs(title = title)
}

print_table <- function(input, title) {
  b <- input %>%
    filter(
      !cohort %in% c(
        "meds-_1icd",
        "meds-_2icd",
        "meds+_1icd"
      )
    ) %>%
    group_by(
      cohort,
      race
    ) %>%
    tally()
  kbl(b)
}

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions