Civil War Markers

library(tidyverse)
library(here)
library(htmltools)
library(purrr)
library(gt)
library(jsonlite)
library(configr)
library(RcppTOML)
library(tictoc)
library(janitor)
library(glue)

library(tidycensus)
source(here("analysis/_functions.R"))

I used the category list from the marker database to return all markers tagged as a civil war marker. I created two data frames, one for all civil war markers that had been erected, and one data frame that was for all civil war markers that were marked as currently being up.

# All civil war markers
civil_war_df = get_marker_category_subset("war, us civil",  all_valid_markers_df, marker_categories_df) 

# All civil war markers that are up
civil_war_up_df = get_marker_category_subset("war, us civil",  all_valid_markers_up_df, marker_categories_df)

Sentence:

+digital: NPR found that nearly 70% of markers that mention plantations do not mention slavery.

+marking_hate_watc_radio: Across the South, nearly 70 percent of markers that mention plantations do not mention slavery.

I searched for all markers that mentioned plantations in the South. The South was defined by this census map.

I then checked if the stem “slave” was detected in the marker. This would catch words like “slave”, “enslaved”, and “slavery”.

plantation = "plantation"
slave = "slave"

df_plantation = all_valid_markers_up_df %>% 
  filter(str_detect(title, plantation) | str_detect(old_title, plantation) |  str_detect(comments, plantation) |str_detect(text, plantation) | str_detect(subtitle, plantation) | str_detect(subtitle2, plantation)) %>% 
  mutate(mentions_slavery = case_when(
    
    str_detect(title, slave) | str_detect(old_title, slave) |  str_detect(comments, slave) |str_detect(text, slave) | str_detect(subtitle, slave) | str_detect(subtitle2, slave) ~ "yes_slave",
    TRUE ~ "no_slave"
    
  ), .after = url) %>% 
  mutate(is_in_south = state %in% southern_states)

df_plantation_summary = df_plantation %>% 
  filter(is_in_south == TRUE) %>% 
  summarise(n = n(), .by = mentions_slavery)  %>% 
  mutate(pct = (n/sum(n))*100)

cat_table(df_plantation_summary, "What percent of markers about or mentioning plantations mentioned the word slave or slavery")
What percent of markers about or mentioning plantations mentioned the word slave or slavery

Sentence:

+digital: the Civil War, one of the single most marked topics nationwide.

I filtered the categories table for the top-marked topics.

# Return for the top categories in the database
marker_categories_df %>% 
  filter(marker_id %in% all_valid_markers_up_df$marker_id ) %>% 
  summarize(n = n(), .by = category) %>% 
  arrange(desc(n))  %>% 
  cat_table("All markers currently up topic ranking")
All markers currently up topic ranking

Sentence:

+digital: At least 65 markers appear to promote a racist philosophy called the Lost Cause, which claims, among other things, that Black people enjoyed being enslaved.

+marking_hate_watc_radio: At least 65 markers appear to promote a racist philosophy called the lost cause which claims among other things that Black people enjoyed being enslaved.

Searched through civil war markers that are labeled as currently up for the phrases:

  • just cause
  • fallen cause
  • sacred cause
  • southern cause
  • righteous cause
  • lost cause

Then team members read each marker and confirmed by hand.

# Lost Cause key phrases

lost_cause_phrases = c("just cause",
                       "fallen cause",
                        "sacred cause",
                        "southern cause",
                      "righteous cause",
                      "lost cause")

# Search the markers for these phrases
lost_cause_up_df = civil_war_up_df  %>% 
  filter(str_detect(text, paste(lost_cause_phrases, collapse = "|"))|str_detect(title, paste(lost_cause_phrases, collapse = "|"))|str_detect(subtitle, paste(lost_cause_phrases, collapse = "|"))|str_detect(subtitle2, paste(lost_cause_phrases, collapse = "|")) ) %>% 
  select(marker_id, url, title, text, organization)

# Write to a CSV so we can analyze collaboratively on Google Sheets
# write_csv(lost_cause_up_df, here("data/processed/lost_cause_markers.csv"))


# Read in sheet that was confirmed by hand
lost_cause_up_confirmed = read_csv(here("data/handmade/lost_cause_confirmed - Sheet2.csv"))


lost_cause_up_confirmed %>% 
  filter(is_lost_cause == "yes") %>% 
  summarize(n = n(), .by = is_lost_cause) %>% 
  cat_table("Lost Cause Markers (Confirmed by Hand)")
Lost Cause Markers (Confirmed by Hand)

Heritage Groups

This was the method to identify union/federal heritage groups and southern heritage groups and see how many markers they had put up.

All marker groups and their alternative names are put into an orgs.toml file.

  1. The first step is to look at markers that have a civil war topic and fraternal/sorority tags.
fraternal_sororal_orgs = get_marker_category_subset("fraternal or sororal organizations",  all_valid_markers_df, marker_categories_df)

civil_war_frat_sor_df = semi_join(civil_war_df, fraternal_sororal_orgs, join_by(marker_id))
civil_war_frat_sor_df  %>% 
    summarize(n = n(), .by = organization)  %>% 
    cat_table("Fraternal and sororal groups in HMDB")
Fraternal and sororal groups in HMDB
  1. Next, we look for groups that have confederate or union/federal in their title and group by organizations:
civil_war_df  %>% 
    filter(str_detect(title, "confed")) %>% 
    summarize(n = n(), , urls = paste(url, collapse = ", "),  .by = organization) %>% 
    arrange(desc(n)) %>% cat_table("Organizations with confederate in their name")
Organizations with confederate in their name
civil_war_df  %>% 
    filter(str_detect(title, "union|federal")) %>% 
    summarize(n = n(), , urls = paste(url, collapse = ", "),  .by = organization) %>% 
    arrange(desc(n)) %>% cat_table("Organizations with union in their name")
Organizations with union in their name
  1. And final we use data from the Southern Poverty Law Center to look for heritage groups.
splc_df = read.csv(here("data/source/Whose Heritage SF - Whose Heritage Master.csv"))  %>% 
    clean_names()

splc_orgs_df = splc_df  %>% 
    select(sponsors) %>% 
    separate_wider_delim(cols = sponsors, delim = ";", names_sep = "_", too_few = "align_start") %>% 
    pivot_longer(cols = everything(), names_to = "sponsor_number", values_to = "sponsor") %>% 
    select(sponsor) %>% 
    mutate(sponsor = tolower(str_squish(sponsor))) %>% 
    summarize(n = n(), .by = sponsor) %>% 
    arrange(desc(n))

All of the groups and their common acronyms or alternative names were added to an orgs.toml file.

Here is that file:

# Union groups
# =========================
[union]

    [[union.group]]
        name = "daughters of union veterans of the civil war"
        alt = ["daughters of union veterans", "daughters of the union veterans", "duvcw", "daughter of union veterans", "daughters of the union"]
    [[union.group]]
        name = "sons of union veterans of the civil war"
        alt = ["sons of the union veterans", "sons of union veterans", "suvcw", "albert galloway camp no 11, sons of veterans" ]
    [[union.group]]
        name = "union soldiers and sailors memorial commission"

    [[union.group]]
        name = "st boniface union soldiers monument and memorial association"

    [[union.group]]
        name = "grand army of the republic"
        alt = ["union posts [grand army of the republic]", "gar"]

    [[union.group]]
        name = "womans relief corps"
        alt = ["womens relief corps", "woman relief corp", "women relief corp", "women relief corps","wrc"]

    [[union.group]]
        name = "ladies of the grand army of the republic"
        alt = ["ladies of the grand army of the republic", "ladies of the gar"]

    [[union.group]]
        name = "union soldiers monument association"

    [[union.group]]
        name = "military order of the loyal legion of the united states"
        alt = ["mollus"]

    [[union.group]]
        name = "union army district of fla"

    [[union.group]]
        name = "national society daughters of the union"
        alt = ["nsdu"]

    [[union.group]]
        name = "honorary first defenders"

    [[union.group]]
        name = "union army district of fla"

    [[union.group]]
        name = "union veteran legion"

    [[union.group]]
        name = "camden soldiers monument association"
        

# Confederate groups
# ====================

[confederate]

    [[confederate.group]]
        name = "united daughters of the confederacy"
        alt = ["udc", "united daughters (and children) of the confederacy", 
        "united daughters of the confedereacy", "united daughter of the confederacy", "daughters of the confederacy",
        "united daughters of the confederacy", "united daughters of confederacy", "united daughters of confederacy" ]

    [[confederate.group]]
        name = "confederate centennial commission"

    [[confederate.group]]
        name = "sons of confederate veterans"
        alt = ["scv", "sons of conferate veterans"]

    [[condederate.group]]
        name = "sons and daughters of confederate veterans"

    [[confederate.group]]
        name = "the society of the order of the southern cross"
        alt = ["osc", "order of the southern cross"]

    [[confederate.group]]
        name = "military order of the stars and bars"
        alt = ["mosb"]

    [[confederate.group]]
        name = "re lee confederate"

    [[confederate.group]]
        name = "martha reid silver confederate memorial association"
    
    [[confederate.group]]
        name = "confederate memorial association"

    [[confederate.group]]
        name = "old dominion rifles confederate memorial association"

    [[confederate.group]]
        name = "harmanson-west camp confederate volunteers"

    [[confederate.group]]
        name = "united confederate veterans"
        alt = ["ucv", "united confederate veteran"]

    [[confederate.group]]
        name = "order of confederate rose"
        alt = ["ocr", "order of the confederate rose"]

    [[confederate.group]]
        name = "ladies memorial association"
        alt = ["lca"]

    [[confederate.group]]
        name = "children of the confederacy"

    [[confederate.group]]
        name = "jefferson davis memorial association"

    [[confederate.group]]
        name = "confederate monument association"

    [[confederate.group]]
        name = "confederate veterans association"

    [[confederate.group]]
        name = "confederate memorial literary society"

    [[confederate.group]]
        name = "oconee southern heritage group"

    [[confederate.group]]
        name = "grand consistory of la"

    [[confederate.group]]
        name = "women of oconee county"

    [[confederate.group]]
        name = "women of lexington county"

    [[confederate.group]]
        name = "the women of cumberland county"
    
    [[confederate.group]]
        name = "the women of darlington county"

    [[confederate.group]]
        name = "surviving confederate veterans"

    

    

    

Here are the heritage groups found for each category.

heritage_groups <- parseTOML(here("analysis/orgs.toml"), verbose = FALSE, fromFile = TRUE, includize = FALSE)

confederate_group_names <- heritage_groups$confederate$group %>%
  map("name")

union_group_names <- heritage_groups$union$group %>%
  map("name")
cat_table(tibble(confederate_heritage_groups = confederate_group_names ), "Confederate Heritage Groups")
Confederate Heritage Groups
cat_table(tibble(union_heritage_groups = union_group_names ), "Union Heritage Groups")
Union Heritage Groups

I then search for matches from the toml file in the Civil War matches.

tic()
civil_war_heritage_group_markers_df = civil_war_df   %>% 
    # Remove organizations that are NA
    filter(!is.na(organization)) %>% 
    # Remove any non alpha numeric characters
    mutate(organization = gsub("[^[:alnum:] ]", "", organization)) %>% 
    # Use the custon function to find all heritage groups in the toml file
    mutate(matched_groups = sapply(organization, find_matching_groups)) %>% 
    select(marker_id, url, organization, matched_groups, year_erected, is_missing) %>% 
    mutate(has_union_group = if_else(str_detect(matched_groups, paste(union_group_names, collapse = "|")), TRUE, FALSE),
          has_confederate_group = if_else(str_detect(matched_groups, paste(confederate_group_names, collapse = "|")), TRUE, FALSE)) %>% 
    filter(!is.na(matched_groups))
toc()


# write.csv(civil_war_heritage_group_markers_df, here("data/processed/civil_war_heritage_group_markers_df.csv"))
civil_war_heritage_group_markers_df = read.csv(here("data/processed/civil_war_heritage_group_markers_df.csv"))

Sentence:

+up_first_sunday_podcast: We found the daughters helped erect more than 600 historical markers, far surpassing any other Civil War heritage group

+digital: We found the daughters helped erect more than 600 historical markers, far surpassing any other Civil War heritage group

+marking_hate_watc_radio: We found the daughters helped erect more than 600 historical markers, far surpassing any other Civil War heritage group, providing it a national – and public – canvas to rewrite the history of the Civil War. 

Return all markers that were erected by the U.D.C.

udc_markers_df = civil_war_heritage_group_markers_df  %>% 
   tidyr::separate_longer_delim(cols = matched_groups, delim = ",") %>% 
   mutate(matched_groups = str_squish(matched_groups)) %>% 
   summarize(n = n(), .by = matched_groups) %>% 
   arrange(desc(n))

udc_markers_df  %>% 
  cat_table("Heritage Group Summary")
Heritage Group Summary

Sentence:

+up_first_sunday_podcast: Nationwide though, we found these and other markers from Confederate heritage groups far outnumber similar markers from Union groups - with more than twice as many. It was similar with Confederate hospitals and Confederate cemeteries.

+digital: Nationwide, markers from Civil War heritage groups like the United Daughters outnumber comparable Union groups’ markers by more than 2-to-1, NPR found. Confederate hospitals and Confederate cemeteries follow a similar pattern.

+marking_hate_watc_radio: Nationwide though, we found these and other markers from Confederate heritage groups far outnumber similar markers from Union groups - with more than twice as many. And there were similar patterns for Confederate hospitals and Confederate cemeteries. 

civil_war_heritage_group_markers_df  %>% 
  filter(marker_id %in% civil_war_up_df$marker_id)  %>% 
  summarize(n = n(), .by = c(has_union_group, has_confederate_group)) %>% 
  arrange(desc(n)) %>% 
  cat_table("Heritage Groups")
Heritage Groups

Search for markers that mention Confederate hospitals but don’t mention union hospitals and vice versa

# Markers that mention Confederate hospitals but don't mention Union hospitals and vice versa
hospital_type_df = civil_war_up_df %>% 
  mutate(marker_id = as.double(marker_id))  %>% 
  mutate(hospital_type = case_when(
    (str_detect(title, "confederate hospital|grey hospital|gray hospital") | str_detect(text, "confederate hospital|grey hospital|gray hospital")  )  & !((str_detect(title, "union hospital|blue hospital|federal hospital") | str_detect(text, "union hospital|blue hospital|federal hospital"))) ~ "confederate_hospital",
    (str_detect(title, "union hospital|blue hospital|federal hospital") | str_detect(text, "union hospital|blue hospital|federal hospital")) & !((str_detect(title, "confederate hospital|grey hospital|gray hospital") | str_detect(text, "confederate hospital|grey hospital|gray hospital"))) ~ "union_hospital",
    TRUE ~ "NONE" 
  ))  %>% 
  select(marker_id, url, hospital_type) %>% 
  filter(hospital_type != "NONE")

hospital_summary_df = hospital_type_df %>% 
  summarize(n = n(), .by = c(hospital_type))  


cat_table(hospital_summary_df, "Hospital Markers")
Hospital Markers

Search for markers that mention Confederate cemeteries but don’t mention Union cemeteries and vice versa

cemetery_type_df = civil_war_up_df  %>% 
  mutate(cemetery_type = case_when(
    (str_detect(title, "confederate cemetery|grey cemetery|gray cemetery") | str_detect(text, "confederate cemetery|grey cemetery|gray cemetery")  )  & !((str_detect(title, "union cemetery|blue cemetery|federal cemetery") | str_detect(text, "union cemetery|blue cemetery|federal cemetery"))) ~ "confederate_cemetery",
    (str_detect(title, "union cemetery|blue cemetery|federal cemetery") | str_detect(text, "union cemetery|blue cemetery|federal cemetery")) & !((str_detect(title, "confederate cemetery|grey cemetery|gray cemetery") | str_detect(text, "confederate cemetery|grey cemetery|gray cemetery"))) ~ "union_cemetery",
    TRUE ~ "NONE" 
  ))  %>% 
  select(marker_id, url, cemetery_type) %>% 
  filter(cemetery_type != "NONE")

cemetery_summary_df = cemetery_type_df %>% 
  summarize(n = n(), .by = c(cemetery_type))  

cat_table(cemetery_summary_df, "Cemetery Markers")
Cemetery Markers

Sentence

+up_first_sunday_podcast: Markers to them and the Confederacy are prolific - with more than 12 thousand mentions. But while the war was fought over slaves and slavery, those words show up only about half as many times.

+digital: In all, markers about Confederates or the Confederacy are prolific, with more than 12,000 mentions. But despite the war’s root causes, the words slaves and slavery show up only about half as many times.

+marking_hate_watc_radio: In all, there are more than 12,000 markers in the database using the word Confederate or Confederacy. Only about a half of that use slave or slavery. 

Search for markers with the “confed” stem to match words like confederacy and confederate and then add them up.

Then search for markers with the “slave” stem to match words like enslaved, slave, or slavery.

confederacy_slavery_df =  all_valid_markers_up_df %>% 
  mutate(mention_confederacy = str_detect(title, "confed") | str_detect(text, "confed")) %>% 
  mutate(mention_slavery = str_detect(title, "slave") | str_detect(text, "slave") )  %>% 
  select(marker_id, url, year_erected, mention_slavery, mention_confederacy)

confederacy_slavery_df  %>% 
  summarize(n = n(), .by = c(mention_confederacy )) %>% 
  cat_table("Markers that mention confederacy by name")
Markers that mention confederacy by name
confederacy_slavery_df  %>% 
  summarize(n = n(), .by = c(mention_slavery )) %>% 
  cat_table("Markers that mention slavery")
Markers that mention slavery

Sentence

+up_first_sunday_podcast: While other groups have spent the past 20 years taking Confederate symbols down, the United Daughters put 47 more markers up

+digital: While many communities have begun taking Confederate symbols down, the United Daughters have put up 47 more markers over the last two decades.

+marking_hate_watc_radio: While other groups have spent the past 20 years taking Confederate symbols down, the United Daughters put 47 more markers up

udc_past_20_years = civil_war_heritage_group_markers_df  %>% 
  filter(str_detect(matched_groups, "united daughters of the confederacy" )) %>% 
  filter(year_erected > 2003)

udc_past_20_years  %>% cat_table("Past 20 Years UDC")
Past 20 Years UDC

Sentence:

+digital: Across the South, markers honor notable men and notable houses without mentioning the forced, free labor that made both the homes and the men’s wealth possible.

+marking_hate_watc_radio: More than 500 markers honor notable men and notable houses without mentioning the forced free labor that made both possible.

Downloaded the data from Washington Post’s slaveholding members of congress.

  1. Filtered for those who were slave owners
  2. For each state, took all of the members of Congress and searched for their names in the marker database, looking only at markers that are from the same state as the person.
  3. Then search for the words congressman, representative, or senator to make sure it was about a member of Congress.
  4. Then search for the stem “slave”
df_congress_slave_raw = read_csv(here("data", "source", "wapo", "congress_slaveowners.csv")) 

df_congress_slave = df_congress_slave_raw  %>% 
  mutate(name_clean = str_squish(tolower(name))) %>% 
  filter(is_slaveholder == "true")
search_names = df_congress_slave$name_clean

df_state_list <- fips_codes %>%
  distinct(state, state_name) %>% 
  mutate(across(everything(), tolower))

tic()

state_name_list = df_congress_slave  %>% 
  select(name, states_served) %>% 
  mutate(states_list = str_split(states_served, ',')) %>% 
  unnest(states_list) %>% 
  select(name, states_list)  %>% 
  mutate(name = str_squish(tolower(name))) %>% 
  summarise(names = list(name), .by = states_list) %>% 
  mutate(states_list = tolower(states_list)) %>% 
  left_join(df_state_list, join_by(states_list == state))  %>% 
  select(state_name, names)  %>% 
  deframe()

 


df_congress_result = tibble()


for (state_name in unique(all_valid_markers_up_df$state)){

  # Filter markers for that state

  data = all_valid_markers_up_df  %>% 
    filter(state == state_name)  %>% 
     mutate(across(where(is.character), ~replace_na(.,"")))

  # Filter for search names

   search_names = state_name_list[[state_name]]

   if(length(search_names > 0)){




  # Make Results Matrix

  results <- matrix(FALSE, nrow = nrow(data), ncol = length(search_names))

  # Loop through each search name and use str_detect for both columns
  for (i in 1:length(search_names)) {
  
    search_result = str_detect(data$title, pattern = fixed(search_names[i])) | str_detect(data$text, pattern = fixed(search_names[i]))
    results[, i] <- search_result
  }


  df_result = tibble()
  for(i in 1:length(search_names)){
    
    df = data[results[,i],]
    if(nrow(df) > 0){

      col_name = rep(search_names[i], time = length(unique(df$marker_id)))
      col_state = rep(state_name, time = length(unique(df$marker_id)))
      df_temp = tibble(name = col_name, marker_id =  df$marker_id, state = col_state)
      df_result = bind_rows(df_result, df_temp)
    } else {

      next
    }
    
  }

  df_congress_result = bind_rows(df_congress_result, df_result)

  #print(df_congress_result)

  #print(glue("{state_name} done ------------------"))

   } else{
    #print(glue("{state_name} done"))

    next
   }

  



}

toc()
23.272 sec elapsed
df_markers_to_congress_slave_owners =  all_valid_markers_up_df %>% 
  filter(marker_id %in% df_congress_result$marker_id) %>% 
  select(marker_id, url, title, text, year_erected, organization, state, town) %>% 
  left_join(df_congress_result, join_by(marker_id)) %>% 
  relocate(name, .after = marker_id) %>% 
  filter(str_detect(text, "congressman|representative|senator")) %>% 
  distinct(marker_id, .keep_all = TRUE) %>% 
  mutate(mention_slavery = str_detect(text, "slave"))  %>% 
  mutate(is_in_south = if_else(state.x %in% southern_states, TRUE, FALSE))


df_markers_to_congress_slave_owners   %>% 
  summarize(n = n(), .by = mention_slavery) %>% 
  cat_table("Congressmen markers that don't mention slaves")
Congressmen markers that don’t mention slaves

Sentence

+digital: NPR’s analysis revealed more than 500 markers that describe the Confederacy in glowing terms, vilify the Union, falsify the reasons for the war or recast Confederate soldiers as the war’s true heroes.

+two_way_atc: There are more than 500 markers in this country that glorify the confederacy, vilify the union, or falsify the reasons for the war.

southern_names_civil_war = c("war between the states")
confederate_states = c("texas", "arkansas", "louisiana", "tennessee", "mississippi", "alabama", "georgia", "florida", "south carolina", "north carolina", "virginia")

war_between_states_df = all_valid_markers_up_df  %>% 
  mutate(war_between_states = case_when(

    str_detect(text,paste(southern_names_civil_war, collapse = "|") ) | str_detect(title, paste(southern_names_civil_war, collapse = "|") ) | str_detect(subtitle, paste(southern_names_civil_war, collapse = "|") ) |  str_detect(subtitle2,paste(southern_names_civil_war, collapse = "|") ) ~ TRUE,

    TRUE ~ FALSE))  %>% 
    filter(war_between_states == TRUE) %>% 
    filter(state %in% confederate_states ) %>% 
    select(marker_id, url, war_between_states)

Select markers that have signs of glowing terms toward the Confederacy, vilify the Union, falsify the reasons for the war, or recast Confederate soldiers as heroes.

# Language patterns
confederate_patterns = c("served in the confederacy","\\bcsa\\b","\\bc.s.a\\b","\\bconfederate hero\\b","\\bsaved the south\\b","confederate units","gallant confederate","gallent confederate","brave confederate","served in the confederacy","to the confederate soldiers","southern heroism","stunning confederate victory","confederate states of america","confederate infantry regiment","confederate soliders of" , "honor the confederate soldiers", "valor of the confederate soldiers")

# Heritage Groups
heritage_confed_df = civil_war_heritage_group_markers_df  %>% 
  filter(has_confederate_group == TRUE & has_union_group == FALSE)

# Names for civil war common in the south

all_southern_civil_war_names = c("war between the states", "the war for southern independence", "war against northern aggression", "war of northern aggression", "second american revolution")

war_confed_name_df =  all_valid_markers_up_df  %>% 
  mutate(southern_name= case_when(

    str_detect(text,paste(all_southern_civil_war_names , collapse = "|") ) | str_detect(title, paste(all_southern_civil_war_names , collapse = "|") ) | str_detect(subtitle, paste(all_southern_civil_war_names , collapse = "|") ) |  str_detect(subtitle2,paste(all_southern_civil_war_names , collapse = "|") ) ~ TRUE,

    TRUE ~ FALSE)) %>% 
  filter(southern_name == TRUE)


glowing_to_confederacy_to_check = civil_war_up_df  %>% 
  # clean up html
  mutate(text = str_replace_all(text, "&lt;|br&gt;|&lt;|center&gt;|/b&gt;|b&gt;", ""))%>%
  mutate(text = str_remove_all(text, "<[^>]+>"))  %>% 
  mutate(text = str_squish(text)) %>% 
  # Some patterns of markers that glowingly describe the Confederacy
  mutate(matched_confed_pattern_text = sapply(str_extract_all(text, paste(confederate_patterns, collapse = "|")), paste, collapse = ", "), .before = url) %>% 
  mutate(has_confed_pattern = if_else(matched_confed_pattern_text == "", FALSE, TRUE))  %>% 
  mutate(from_confed_heritage = if_else(marker_id %in% heritage_confed_df$marker_id, TRUE, FALSE)) %>% 
  mutate(civil_war_confed_name = if_else(marker_id %in% war_confed_name_df$marker_id, TRUE, FALSE)) %>% 
  mutate(confed_in_title = if_else(str_detect(title, "confed"), TRUE, FALSE))  %>% 
  mutate(ranking = has_confed_pattern + from_confed_heritage + civil_war_confed_name + confed_in_title) %>% 
  select(url, marker_id, ranking, title, has_confed_pattern, from_confed_heritage, civil_war_confed_name, confed_in_title, text ) %>% 
  filter(ranking != 0) %>% 
  arrange(desc(ranking)) %>% 
  mutate(glowing = "", .after = url)
  # filter(matched_confed_pattern_text != "")

write_csv(glowing_to_confederacy_to_check , here("data/processed/glowing_to_confederacy_to_check.csv"))

After checking them by hand markers that were either glowing to the confederacy, vilified the union, or recast the confederate soldiers as heroes (marked true in the glowing category) the markers are read back in and filtered for true. These markers are then combined with all markers from states that were in the Confederacy that refer to the civil war as the “War Between States”, which falsifies the reasons for the war.

check_glowing_terms_df = read_csv(here("data/handmade/checked_glowing_confederacy.csv"))

glowing_falsify_df = check_glowing_terms_df  %>% 
  filter(glowing == "1") %>% 
  select(marker_id, glowing) %>% 
  full_join(war_between_states_df, join_by(marker_id)) %>% 
  distinct(marker_id, .keep_all = TRUE)


nrow(glowing_falsify_df)
[1] 843