###Final COVID analysis: create network graph from subthemes### ###Polly Compston last edited 01/04/2021### ####set up data and workspace#### .libPaths("C:/Users/pcompston/Desktop/epicollect") setwd("C:/Users/pcompston/Desktop/epicollect/chickensandcovid/Final analysis/csv/") library(tidyverse) library(visNetwork) library(igraph) library (dplyr) library(ggplot2) library(RColorBrewer) subthemes<-read.csv("master_subthemes.csv", header = TRUE, na.strings=c(""," ","NA") ) names (subthemes) ####Rename columns#### subthemes<- subthemes %>% rename ( Consumer_demand_changes = CONSUMER.DEMAND.CHANGES, #Demand and market effects Reasons_for_demand_change = REASONS.FOR.DEMAND.CHANGE, #Demand and market effects Communications = INFORMATION.MANAGEMENT, #Demand and market effects Change_in_chicken_sales = CHANGES.IN.CHICKEN.or.CHICKEN.PRODUCT.SALES, #Demand and market effects Change_in_chicken_prices = CHANGES.IN.CHICKEN.or.CHICKEN.MEAT.PRICES, #Demand and market effects Value_chain_business_closure = VALUE.CHAIN.BUSINESS.CLOSURE, #Value chain effects Supply_chain_functioning = SUPPLY.CHAIN.FUNCTIONING, #Value chain effects Links_to_other_chains = LINKS.TO.OTHER.CHAINS, #Value chain effects Requests_and_power = REQUESTS.and.POWER, #Value chain effects Trade = TRADE, #Trade Impact_on_labour = LABOUR.AFFECTED.IN.VC.BUSINESS, #Labour and livelihoods Economic_hardship = ECONOMIC.HARDSHIP, #Labour and livelihoods Economic_support = ECONOMIC.RELIEF.SUPPORT, #Mitigation and interventions Food_donation = FOOD.DONATION, #Mitigation and interventions Normalise_market_dynamics = EFFORTS.TO.NORMALISE.MARKET.DYNAMICS, #Mitigation and interventions Outbreak_management = OUTBREAK.MANAGEMENT, #Mitigation and interventions Coping_consumers = COPING.CONSUMERS, #Coping Coping_processors = COPING.PROCESSORS, #Coping Coping_retailers_and_restaurants = COPING.RETAILERS.AND.RESTAURANTS, #Coping Coping_farmers = COPING.FARMERS, #Coping Epidemiological_information = EPIDEMIOLOGICAL.INFORMATION.RELEVANT.TO.CHICKEN.MEAT.FOOD.SYSTEMS, #Epidemiological factors Animal_welfare = ANIMAL.WELFARE #Animal welfare ) ####create nodes#### node1<- subthemes %>% distinct(Consumer_demand_changes ) %>% rename (label = Consumer_demand_changes ) node2<- subthemes %>% distinct(Reasons_for_demand_change) %>% rename (label = Reasons_for_demand_change) nodes<- full_join(node1, node2, by = "label", na.omit = TRUE) node3<- subthemes %>% distinct(Communications ) %>% rename (label = Communications) nodes<- full_join(nodes, node3, by = "label", na.omit = TRUE) node4<- subthemes %>% distinct(Change_in_chicken_sales) %>% rename (label=Change_in_chicken_sales) nodes<- full_join(nodes, node4, by = "label", na.omit = TRUE) node5<- subthemes %>% distinct(Change_in_chicken_prices) %>% rename (label=Change_in_chicken_prices) nodes<- full_join(nodes, node5, by = "label", na.omit = TRUE) node6<- subthemes %>% distinct(Value_chain_business_closure) %>% rename (label= Value_chain_business_closure) nodes<- full_join(nodes, node6, by = "label", na.omit = TRUE) node7<- subthemes %>% distinct(Supply_chain_functioning) %>% rename (label=Supply_chain_functioning) nodes<- full_join(nodes, node7, by = "label", na.omit = TRUE) node8<- subthemes %>% distinct(Links_to_other_chains) %>% rename (label=Links_to_other_chains) nodes<- full_join(nodes, node8, by = "label", na.omit = TRUE) node9<- subthemes %>% distinct(Requests_and_power) %>% rename (label=Requests_and_power) nodes<- full_join(nodes, node9, by = "label", na.omit = TRUE) node10<- subthemes %>% distinct(Trade) %>% rename (label = Trade) nodes<- full_join(nodes, node10, by = "label", na.omit = TRUE) node11<- subthemes %>% distinct(Impact_on_labour) %>% rename (label = Impact_on_labour) nodes<- full_join(nodes, node11, by = "label", na.omit = TRUE) node12<- subthemes %>% distinct(Economic_hardship) %>% rename (label = Economic_hardship) nodes<- full_join(nodes, node12, by = "label", na.omit = TRUE) node13<- subthemes %>% distinct(Economic_support) %>% rename (label = Economic_support) nodes<- full_join(nodes, node13, by = "label", na.omit = TRUE) node14<- subthemes %>% distinct(Food_donation) %>% rename (label = Food_donation) nodes<- full_join(nodes, node14, by = "label", na.omit = TRUE) node15<- subthemes %>% distinct(Normalise_market_dynamics) %>% rename (label = Normalise_market_dynamics) nodes<- full_join(nodes, node15, by = "label", na.omit = TRUE) node16<- subthemes %>% distinct(Outbreak_management) %>% rename (label = Outbreak_management) nodes<- full_join(nodes, node16, by = "label", na.omit = TRUE) node17<- subthemes %>% distinct(Coping_consumers) %>% rename (label = Coping_consumers) nodes<- full_join(nodes, node17, by = "label", na.omit = TRUE) node18<- subthemes %>% distinct(Coping_processors) %>% rename (label = Coping_processors) nodes<- full_join(nodes, node18, by = "label", na.omit = TRUE) node19<- subthemes %>% distinct(Coping_retailers_and_restaurants) %>% rename (label = Coping_retailers_and_restaurants) nodes<- full_join(nodes, node19, by = "label", na.omit = TRUE) node20<- subthemes %>% distinct(Coping_farmers) %>% rename (label = Coping_farmers) nodes<- full_join(nodes, node20, by = "label", na.omit = TRUE) node21<- subthemes %>% distinct(Epidemiological_information) %>% rename (label = Epidemiological_information) nodes<- full_join(nodes, node21, by = "label", na.omit = TRUE) node22<- subthemes %>% distinct(Animal_welfare) %>% rename (label = Animal_welfare) nodes<- full_join(nodes, node22, by = "label", na.omit = TRUE) nodes <- na.omit(nodes) nodes<-nodes%>% tibble::rowid_to_column ("id") nodes$id<-sub("^", "s", nodes$id) nodes ####create edges#### edgelist1 <- subthemes %>%group_by( Consumer_demand_changes,Reasons_for_demand_change) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Reasons_for_demand_change") edgelist2 <- subthemes %>%group_by( Consumer_demand_changes,Communications) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Communications") edgelist3 <- subthemes %>%group_by( Consumer_demand_changes,Change_in_chicken_sales) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Change_in_chicken_sales") edgelist4 <- subthemes %>%group_by( Consumer_demand_changes,Change_in_chicken_prices) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Change_in_chicken_prices") edgelist5 <- subthemes %>%group_by( Consumer_demand_changes,Value_chain_business_closure) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Value_chain_business_closure") edgelist6 <- subthemes %>%group_by( Consumer_demand_changes,Supply_chain_functioning) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Supply_chain_functioning") edgelist7 <- subthemes %>%group_by( Consumer_demand_changes,Links_to_other_chains) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Links_to_other_chains") edgelist8 <- subthemes %>%group_by( Consumer_demand_changes,Requests_and_power) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Requests_and_power") edgelist9 <- subthemes %>%group_by( Consumer_demand_changes,Trade) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Trade") edgelist10 <- subthemes %>%group_by( Consumer_demand_changes,Impact_on_labour) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Impact_on_labour") edgelist11 <- subthemes %>%group_by( Consumer_demand_changes,Economic_hardship) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Economic_hardship") edgelist12 <- subthemes %>%group_by( Consumer_demand_changes,Economic_support) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Economic_support") edgelist13 <- subthemes %>%group_by( Consumer_demand_changes,Food_donation) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Food_donation") edgelist14 <- subthemes %>%group_by( Consumer_demand_changes,Normalise_market_dynamics) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Normalise_market_dynamics") edgelist15 <- subthemes %>%group_by( Consumer_demand_changes,Outbreak_management) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Outbreak_management") edgelist16 <- subthemes %>%group_by( Consumer_demand_changes,Coping_consumers) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Coping_consumers") edgelist17 <- subthemes %>%group_by( Consumer_demand_changes,Coping_processors) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Coping_processors") edgelist18 <- subthemes %>%group_by( Consumer_demand_changes,Coping_retailers_and_restaurants) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Coping_retailers_and_restaurants") edgelist19 <- subthemes %>%group_by( Consumer_demand_changes,Coping_farmers) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Coping_farmers") edgelist20 <- subthemes %>%group_by( Consumer_demand_changes,Epidemiological_information) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Epidemiological_information") edgelist21 <- subthemes %>%group_by( Consumer_demand_changes,Animal_welfare) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Consumer_demand_changes", "B" = "Animal_welfare") edgelistA <- rbind(edgelist1, edgelist2, edgelist3, edgelist4, edgelist5, edgelist6, edgelist7, edgelist8, edgelist9, edgelist10, edgelist11, edgelist12, edgelist13, edgelist14, edgelist15, edgelist16, edgelist17, edgelist18, edgelist19, edgelist20, edgelist21) edgelist22 <- subthemes %>%group_by( Reasons_for_demand_change,Communications) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Communications") edgelist23 <- subthemes %>%group_by( Reasons_for_demand_change,Change_in_chicken_sales) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Change_in_chicken_sales") edgelist24 <- subthemes %>%group_by( Reasons_for_demand_change,Change_in_chicken_prices) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Change_in_chicken_prices") edgelist25 <- subthemes %>%group_by( Reasons_for_demand_change,Value_chain_business_closure) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Value_chain_business_closure") edgelist26 <- subthemes %>%group_by( Reasons_for_demand_change,Supply_chain_functioning) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Supply_chain_functioning") edgelist27 <- subthemes %>%group_by( Reasons_for_demand_change,Links_to_other_chains) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Links_to_other_chains") edgelist28 <- subthemes %>%group_by( Reasons_for_demand_change,Requests_and_power) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Requests_and_power") edgelist29 <- subthemes %>%group_by( Reasons_for_demand_change,Trade) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Trade") edgelist30 <- subthemes %>%group_by( Reasons_for_demand_change,Impact_on_labour) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Impact_on_labour") edgelist31 <- subthemes %>%group_by( Reasons_for_demand_change,Economic_hardship) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Economic_hardship") edgelist32 <- subthemes %>%group_by( Reasons_for_demand_change,Economic_support) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Economic_support") edgelist33 <- subthemes %>%group_by( Reasons_for_demand_change,Food_donation) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Food_donation") edgelist34 <- subthemes %>%group_by( Reasons_for_demand_change,Normalise_market_dynamics) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Normalise_market_dynamics") edgelist35 <- subthemes %>%group_by( Reasons_for_demand_change,Outbreak_management) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Outbreak_management") edgelist36 <- subthemes %>%group_by( Reasons_for_demand_change,Coping_consumers) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Coping_consumers") edgelist37 <- subthemes %>%group_by( Reasons_for_demand_change,Coping_processors) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Coping_processors") edgelist38 <- subthemes %>%group_by( Reasons_for_demand_change,Coping_retailers_and_restaurants) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Coping_retailers_and_restaurants") edgelist39 <- subthemes %>%group_by( Reasons_for_demand_change,Coping_farmers) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Coping_farmers") edgelist40 <- subthemes %>%group_by( Reasons_for_demand_change,Epidemiological_information) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Epidemiological_information") edgelist41 <- subthemes %>%group_by( Reasons_for_demand_change,Animal_welfare) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Reasons_for_demand_change", "B" = "Animal_welfare") edgelistB <- rbind( edgelist22, edgelist23, edgelist24, edgelist25, edgelist26, edgelist27, edgelist28, edgelist29, edgelist30, edgelist31, edgelist32, edgelist33, edgelist34, edgelist35, edgelist36, edgelist37, edgelist38, edgelist39, edgelist40, edgelist41) edgelist42 <- subthemes %>%group_by( Communications,Change_in_chicken_sales) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Change_in_chicken_sales") edgelist43 <- subthemes %>%group_by( Communications,Change_in_chicken_prices) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Change_in_chicken_prices") edgelist44 <- subthemes %>%group_by( Communications,Value_chain_business_closure) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Value_chain_business_closure") edgelist45 <- subthemes %>%group_by( Communications,Supply_chain_functioning) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Supply_chain_functioning") edgelist46 <- subthemes %>%group_by( Communications,Links_to_other_chains) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Links_to_other_chains") edgelist47 <- subthemes %>%group_by( Communications,Requests_and_power) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Requests_and_power") edgelist48 <- subthemes %>%group_by( Communications,Trade) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Trade") edgelist49 <- subthemes %>%group_by( Communications,Impact_on_labour) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Impact_on_labour") edgelist50 <- subthemes %>%group_by( Communications,Economic_hardship) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Economic_hardship") edgelist51 <- subthemes %>%group_by( Communications,Economic_support) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Economic_support") edgelist52 <- subthemes %>%group_by( Communications,Food_donation) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Food_donation") edgelist53 <- subthemes %>%group_by( Communications,Normalise_market_dynamics) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Normalise_market_dynamics") edgelist54 <- subthemes %>%group_by( Communications,Outbreak_management) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Outbreak_management") edgelist55 <- subthemes %>%group_by( Communications,Coping_consumers) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Coping_consumers") edgelist56 <- subthemes %>%group_by( Communications,Coping_processors) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Coping_processors") edgelist57 <- subthemes %>%group_by( Communications,Coping_retailers_and_restaurants) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Coping_retailers_and_restaurants") edgelist58 <- subthemes %>%group_by( Communications,Coping_farmers) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Coping_farmers") edgelist59 <- subthemes %>%group_by( Communications,Epidemiological_information) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Epidemiological_information") edgelist60 <- subthemes %>%group_by( Communications,Animal_welfare) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Communications", "B" = "Animal_welfare") edgelistC <- rbind(edgelist42, edgelist43, edgelist44, edgelist45, edgelist46, edgelist47, edgelist48, edgelist49, edgelist50, edgelist51, edgelist52, edgelist53, edgelist54, edgelist55, edgelist56, edgelist57, edgelist58, edgelist59, edgelist60) edgelist61 <- subthemes%>%group_by( Change_in_chicken_sales,Change_in_chicken_prices) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Change_in_chicken_prices") edgelist62 <- subthemes%>%group_by( Change_in_chicken_sales,Value_chain_business_closure) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Value_chain_business_closure") edgelist63 <- subthemes%>%group_by( Change_in_chicken_sales,Supply_chain_functioning) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Supply_chain_functioning") edgelist64 <- subthemes%>%group_by( Change_in_chicken_sales,Links_to_other_chains) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Links_to_other_chains") edgelist65 <- subthemes%>%group_by( Change_in_chicken_sales,Requests_and_power) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Requests_and_power") edgelist66 <- subthemes%>%group_by( Change_in_chicken_sales,Trade) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Trade") edgelist67 <- subthemes%>%group_by( Change_in_chicken_sales,Impact_on_labour) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Impact_on_labour") edgelist68 <- subthemes%>%group_by( Change_in_chicken_sales,Economic_hardship) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Economic_hardship") edgelist69 <- subthemes%>%group_by( Change_in_chicken_sales,Economic_support) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Economic_support") edgelist70 <- subthemes%>%group_by( Change_in_chicken_sales,Food_donation) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Food_donation") edgelist71 <- subthemes%>%group_by( Change_in_chicken_sales,Normalise_market_dynamics) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Normalise_market_dynamics") edgelist72 <- subthemes%>%group_by( Change_in_chicken_sales,Outbreak_management) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Outbreak_management") edgelist73 <- subthemes%>%group_by( Change_in_chicken_sales,Coping_consumers) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Coping_consumers") edgelist74 <- subthemes%>%group_by( Change_in_chicken_sales,Coping_processors) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Coping_processors") edgelist75 <- subthemes%>%group_by( Change_in_chicken_sales,Coping_retailers_and_restaurants) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Coping_retailers_and_restaurants") edgelist76 <- subthemes%>%group_by( Change_in_chicken_sales,Coping_farmers) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Coping_farmers") edgelist77 <- subthemes%>%group_by( Change_in_chicken_sales,Epidemiological_information) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Epidemiological_information") edgelist78 <- subthemes%>%group_by( Change_in_chicken_sales,Animal_welfare) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_sales", "B" = "Animal_welfare") edgelistD <- rbind( edgelist61, edgelist62, edgelist63, edgelist64, edgelist65, edgelist66, edgelist67, edgelist68, edgelist69, edgelist70, edgelist71, edgelist72, edgelist73, edgelist74, edgelist75, edgelist76, edgelist77, edgelist78) edgelist79 <- subthemes%>%group_by( Change_in_chicken_prices,Value_chain_business_closure) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Value_chain_business_closure") edgelist80 <- subthemes%>%group_by( Change_in_chicken_prices,Supply_chain_functioning) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Supply_chain_functioning") edgelist81 <- subthemes%>%group_by( Change_in_chicken_prices,Links_to_other_chains) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Links_to_other_chains") edgelist82 <- subthemes%>%group_by( Change_in_chicken_prices,Requests_and_power) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Requests_and_power") edgelist83 <- subthemes%>%group_by( Change_in_chicken_prices,Trade) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Trade") edgelist84 <- subthemes%>%group_by( Change_in_chicken_prices,Impact_on_labour) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Impact_on_labour") edgelist85 <- subthemes%>%group_by( Change_in_chicken_prices,Economic_hardship) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Economic_hardship") edgelist86 <- subthemes%>%group_by( Change_in_chicken_prices,Economic_support) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Economic_support") edgelist87 <- subthemes%>%group_by( Change_in_chicken_prices,Food_donation) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Food_donation") edgelist88 <- subthemes%>%group_by( Change_in_chicken_prices,Normalise_market_dynamics) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Normalise_market_dynamics") edgelist89 <- subthemes%>%group_by( Change_in_chicken_prices,Outbreak_management) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Outbreak_management") edgelist90 <- subthemes%>%group_by( Change_in_chicken_prices,Coping_consumers) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Coping_consumers") edgelist91 <- subthemes%>%group_by( Change_in_chicken_prices,Coping_processors) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Coping_processors") edgelist92 <- subthemes%>%group_by( Change_in_chicken_prices,Coping_retailers_and_restaurants) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Coping_retailers_and_restaurants") edgelist93 <- subthemes%>%group_by( Change_in_chicken_prices,Coping_farmers) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Coping_farmers") edgelist94 <- subthemes%>%group_by( Change_in_chicken_prices,Epidemiological_information) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Epidemiological_information") edgelist95 <- subthemes%>%group_by( Change_in_chicken_prices,Animal_welfare) %>% summarise( weight = n()) %>% ungroup ()%>% rename ("A" = "Change_in_chicken_prices", "B" = "Animal_welfare") edgelistE <- rbind( edgelist79, edgelist80, edgelist81, edgelist82, edgelist83, edgelist84, edgelist85, edgelist86, edgelist87, edgelist88, edgelist89, edgelist90, edgelist91, edgelist92, edgelist93, edgelist94, edgelist95) edgelist96 <- subthemes%>%group_by(Value_chain_business_closure,Supply_chain_functioning) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Supply_chain_functioning") edgelist97 <- subthemes%>%group_by(Value_chain_business_closure,Links_to_other_chains) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Links_to_other_chains") edgelist98 <- subthemes%>%group_by(Value_chain_business_closure,Requests_and_power) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Requests_and_power") edgelist99 <- subthemes%>%group_by(Value_chain_business_closure,Trade) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Trade") edgelist100 <- subthemes%>%group_by(Value_chain_business_closure,Impact_on_labour) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Impact_on_labour") edgelist101 <- subthemes%>%group_by(Value_chain_business_closure,Economic_hardship) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Economic_hardship") edgelist102 <- subthemes%>%group_by(Value_chain_business_closure,Economic_support) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Economic_support") edgelist103 <- subthemes%>%group_by(Value_chain_business_closure,Food_donation) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Food_donation") edgelist104 <- subthemes%>%group_by(Value_chain_business_closure,Normalise_market_dynamics) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Normalise_market_dynamics") edgelist105 <- subthemes%>%group_by(Value_chain_business_closure,Outbreak_management) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Outbreak_management") edgelist106 <- subthemes%>%group_by(Value_chain_business_closure,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Coping_consumers") edgelist107 <- subthemes%>%group_by(Value_chain_business_closure,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Coping_processors") edgelist108 <- subthemes%>%group_by(Value_chain_business_closure,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Coping_retailers_and_restaurants") edgelist109 <- subthemes%>%group_by(Value_chain_business_closure,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Coping_farmers") edgelist110 <- subthemes%>%group_by(Value_chain_business_closure,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Epidemiological_information") edgelist111 <- subthemes%>%group_by(Value_chain_business_closure,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Value_chain_business_closure", "B" = "Animal_welfare") edgelistF <- rbind( edgelist96, edgelist97, edgelist98, edgelist99, edgelist100, edgelist101, edgelist102, edgelist103, edgelist104, edgelist105, edgelist106, edgelist107, edgelist108, edgelist109, edgelist110, edgelist111) edgelist112 <- subthemes%>%group_by(Supply_chain_functioning,Links_to_other_chains) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Links_to_other_chains") edgelist113 <- subthemes%>%group_by(Supply_chain_functioning,Requests_and_power) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Requests_and_power") edgelist114 <- subthemes%>%group_by(Supply_chain_functioning,Trade) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Trade") edgelist115 <- subthemes%>%group_by(Supply_chain_functioning,Impact_on_labour) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Impact_on_labour") edgelist116 <- subthemes%>%group_by(Supply_chain_functioning,Economic_hardship) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Economic_hardship") edgelist117 <- subthemes%>%group_by(Supply_chain_functioning,Economic_support) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Economic_support") edgelist118 <- subthemes%>%group_by(Supply_chain_functioning,Food_donation) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Food_donation") edgelist119 <- subthemes%>%group_by(Supply_chain_functioning,Normalise_market_dynamics) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Normalise_market_dynamics") edgelist120 <- subthemes%>%group_by(Supply_chain_functioning,Outbreak_management) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Outbreak_management") edgelist121 <- subthemes%>%group_by(Supply_chain_functioning,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Coping_consumers") edgelist122 <- subthemes%>%group_by(Supply_chain_functioning,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Coping_processors") edgelist123 <- subthemes%>%group_by(Supply_chain_functioning,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Coping_retailers_and_restaurants") edgelist124 <- subthemes%>%group_by(Supply_chain_functioning,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Coping_farmers") edgelist125 <- subthemes%>%group_by(Supply_chain_functioning,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Epidemiological_information") edgelist126 <- subthemes%>%group_by(Supply_chain_functioning,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Supply_chain_functioning", "B" = "Animal_welfare") edgelistG <- rbind( edgelist112, edgelist113, edgelist114, edgelist115, edgelist116, edgelist117, edgelist118, edgelist119, edgelist120, edgelist121, edgelist122, edgelist123, edgelist124, edgelist125, edgelist126) edgelist127 <- subthemes%>%group_by(Links_to_other_chains,Requests_and_power) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Requests_and_power") edgelist128 <- subthemes%>%group_by(Links_to_other_chains,Trade) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Trade") edgelist129 <- subthemes%>%group_by(Links_to_other_chains,Impact_on_labour) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Impact_on_labour") edgelist130 <- subthemes%>%group_by(Links_to_other_chains,Economic_hardship) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Economic_hardship") edgelist131 <- subthemes%>%group_by(Links_to_other_chains,Economic_support) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Economic_support") edgelist132 <- subthemes%>%group_by(Links_to_other_chains,Food_donation) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Food_donation") edgelist133 <- subthemes%>%group_by(Links_to_other_chains,Normalise_market_dynamics) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Normalise_market_dynamics") edgelist134 <- subthemes%>%group_by(Links_to_other_chains,Outbreak_management) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Outbreak_management") edgelist135 <- subthemes%>%group_by(Links_to_other_chains,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Coping_consumers") edgelist136 <- subthemes%>%group_by(Links_to_other_chains,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Coping_processors") edgelist137 <- subthemes%>%group_by(Links_to_other_chains,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Coping_retailers_and_restaurants") edgelist138 <- subthemes%>%group_by(Links_to_other_chains,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Coping_farmers") edgelist139 <- subthemes%>%group_by(Links_to_other_chains,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Epidemiological_information") edgelist140 <- subthemes%>%group_by(Links_to_other_chains,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Links_to_other_chains", "B" = "Animal_welfare") edgelistH <- rbind( edgelist127, edgelist128, edgelist129, edgelist130, edgelist131, edgelist132, edgelist133, edgelist134, edgelist135, edgelist136, edgelist137, edgelist138, edgelist139, edgelist140) edgelist141 <- subthemes%>%group_by(Requests_and_power,Trade) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Trade") edgelist142 <- subthemes%>%group_by(Requests_and_power,Impact_on_labour) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Impact_on_labour") edgelist143 <- subthemes%>%group_by(Requests_and_power,Economic_hardship) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Economic_hardship") edgelist144 <- subthemes%>%group_by(Requests_and_power,Economic_support) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Economic_support") edgelist145 <- subthemes%>%group_by(Requests_and_power,Food_donation) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Food_donation") edgelist146 <- subthemes%>%group_by(Requests_and_power,Normalise_market_dynamics) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Normalise_market_dynamics") edgelist147 <- subthemes%>%group_by(Requests_and_power,Outbreak_management) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Outbreak_management") edgelist148 <- subthemes%>%group_by(Requests_and_power,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Coping_consumers") edgelist149 <- subthemes%>%group_by(Requests_and_power,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Coping_processors") edgelist150 <- subthemes%>%group_by(Requests_and_power,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Coping_retailers_and_restaurants") edgelist151 <- subthemes%>%group_by(Requests_and_power,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Coping_farmers") edgelist152 <- subthemes%>%group_by(Requests_and_power,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Epidemiological_information") edgelist153 <- subthemes%>%group_by(Requests_and_power,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Requests_and_power", "B" = "Animal_welfare") edgelistI <- rbind( edgelist141, edgelist142, edgelist143, edgelist144, edgelist145, edgelist146, edgelist147, edgelist148, edgelist149, edgelist150, edgelist151, edgelist152, edgelist153) edgelist154 <- subthemes%>%group_by(Trade,Impact_on_labour) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Impact_on_labour") edgelist155 <- subthemes%>%group_by(Trade,Economic_hardship) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Economic_hardship") edgelist156 <- subthemes%>%group_by(Trade,Economic_support) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Economic_support") edgelist157 <- subthemes%>%group_by(Trade,Food_donation) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Food_donation") edgelist158 <- subthemes%>%group_by(Trade,Normalise_market_dynamics) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Normalise_market_dynamics") edgelist159 <- subthemes%>%group_by(Trade,Outbreak_management) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Outbreak_management") edgelist160 <- subthemes%>%group_by(Trade,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Coping_consumers") edgelist161 <- subthemes%>%group_by(Trade,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Coping_processors") edgelist162 <- subthemes%>%group_by(Trade,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Coping_retailers_and_restaurants") edgelist163 <- subthemes%>%group_by(Trade,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Coping_farmers") edgelist164 <- subthemes%>%group_by(Trade,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Epidemiological_information") edgelist165 <- subthemes%>%group_by(Trade,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Trade", "B" = "Animal_welfare") edgelistJ <- rbind(edgelist154, edgelist155, edgelist156, edgelist157, edgelist158, edgelist159, edgelist160, edgelist161, edgelist162, edgelist163, edgelist164, edgelist165) edgelist166 <- subthemes%>%group_by(Impact_on_labour,Economic_hardship) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Economic_hardship") edgelist167 <- subthemes%>%group_by(Impact_on_labour,Economic_support) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Economic_support") edgelist168 <- subthemes%>%group_by(Impact_on_labour,Food_donation) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Food_donation") edgelist169 <- subthemes%>%group_by(Impact_on_labour,Normalise_market_dynamics) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Normalise_market_dynamics") edgelist170 <- subthemes%>%group_by(Impact_on_labour,Outbreak_management) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Outbreak_management") edgelist171 <- subthemes%>%group_by(Impact_on_labour,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Coping_consumers") edgelist172 <- subthemes%>%group_by(Impact_on_labour,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Coping_processors") edgelist173 <- subthemes%>%group_by(Impact_on_labour,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Coping_retailers_and_restaurants") edgelist174 <- subthemes%>%group_by(Impact_on_labour,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Coping_farmers") edgelist175 <- subthemes%>%group_by(Impact_on_labour,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Epidemiological_information") edgelist176 <- subthemes%>%group_by(Impact_on_labour,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Impact_on_labour", "B" = "Animal_welfare") edgelistK <- rbind(edgelist166, edgelist167, edgelist168, edgelist169, edgelist170, edgelist171, edgelist172, edgelist173, edgelist174, edgelist175, edgelist176) edgelist177 <- subthemes%>%group_by(Economic_hardship,Economic_support) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_hardship", "B" = "Economic_support") edgelist178 <- subthemes%>%group_by(Economic_hardship,Food_donation) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_hardship", "B" = "Food_donation") edgelist179 <- subthemes%>%group_by(Economic_hardship,Normalise_market_dynamics) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_hardship", "B" = "Normalise_market_dynamics") edgelist180 <- subthemes%>%group_by(Economic_hardship,Outbreak_management) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_hardship", "B" = "Outbreak_management") edgelist181 <- subthemes%>%group_by(Economic_hardship,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_hardship", "B" = "Coping_consumers") edgelist182 <- subthemes%>%group_by(Economic_hardship,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_hardship", "B" = "Coping_processors") edgelist183 <- subthemes%>%group_by(Economic_hardship,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_hardship", "B" = "Coping_retailers_and_restaurants") edgelist184 <- subthemes%>%group_by(Economic_hardship,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_hardship", "B" = "Coping_farmers") edgelist185 <- subthemes%>%group_by(Economic_hardship,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_hardship", "B" = "Epidemiological_information") edgelist186 <- subthemes%>%group_by(Economic_hardship,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_hardship", "B" = "Animal_welfare") edgelistL <- rbind(edgelist177, edgelist178, edgelist179, edgelist180, edgelist181, edgelist182, edgelist183, edgelist184, edgelist185, edgelist186) edgelist187 <- subthemes%>%group_by(Economic_support,Food_donation) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_support", "B" = "Food_donation") edgelist188 <- subthemes%>%group_by(Economic_support,Normalise_market_dynamics) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_support", "B" = "Normalise_market_dynamics") edgelist189 <- subthemes%>%group_by(Economic_support,Outbreak_management) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_support", "B" = "Outbreak_management") edgelist190 <- subthemes%>%group_by(Economic_support,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_support", "B" = "Coping_consumers") edgelist191 <- subthemes%>%group_by(Economic_support,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_support", "B" = "Coping_processors") edgelist192 <- subthemes%>%group_by(Economic_support,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_support", "B" = "Coping_retailers_and_restaurants") edgelist193 <- subthemes%>%group_by(Economic_support,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_support", "B" = "Coping_farmers") edgelist194 <- subthemes%>%group_by(Economic_support,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_support", "B" = "Epidemiological_information") edgelist195 <- subthemes%>%group_by(Economic_support,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Economic_support", "B" = "Animal_welfare") edgelistM <- rbind(edgelist187, edgelist188, edgelist189, edgelist190, edgelist191, edgelist192, edgelist193, edgelist194, edgelist195) edgelist196 <- subthemes%>%group_by(Food_donation,Normalise_market_dynamics) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Food_donation", "B" = "Normalise_market_dynamics") edgelist197 <- subthemes%>%group_by(Food_donation,Outbreak_management) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Food_donation", "B" = "Outbreak_management") edgelist198 <- subthemes%>%group_by(Food_donation,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Food_donation", "B" = "Coping_consumers") edgelist199 <- subthemes%>%group_by(Food_donation,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Food_donation", "B" = "Coping_processors") edgelist200 <- subthemes%>%group_by(Food_donation,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Food_donation", "B" = "Coping_retailers_and_restaurants") edgelist201 <- subthemes%>%group_by(Food_donation,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Food_donation", "B" = "Coping_farmers") edgelist202 <- subthemes%>%group_by(Food_donation,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Food_donation", "B" = "Epidemiological_information") edgelist203 <- subthemes%>%group_by(Food_donation,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Food_donation", "B" = "Animal_welfare") edgelistN <- rbind(edgelist196, edgelist197, edgelist198, edgelist199, edgelist200, edgelist201, edgelist202, edgelist203) edgelist204 <- subthemes%>%group_by(Normalise_market_dynamics,Outbreak_management) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Normalise_market_dynamics", "B" = "Outbreak_management") edgelist205 <- subthemes%>%group_by(Normalise_market_dynamics,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Normalise_market_dynamics", "B" = "Coping_consumers") edgelist206 <- subthemes%>%group_by(Normalise_market_dynamics,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Normalise_market_dynamics", "B" = "Coping_processors") edgelist207 <- subthemes%>%group_by(Normalise_market_dynamics,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Normalise_market_dynamics", "B" = "Coping_retailers_and_restaurants") edgelist208 <- subthemes%>%group_by(Normalise_market_dynamics,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Normalise_market_dynamics", "B" = "Coping_farmers") edgelist209 <- subthemes%>%group_by(Normalise_market_dynamics,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Normalise_market_dynamics", "B" = "Epidemiological_information") edgelist210 <- subthemes%>%group_by(Normalise_market_dynamics,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Normalise_market_dynamics", "B" = "Animal_welfare") edgelistO <- rbind(edgelist204, edgelist205, edgelist206, edgelist207, edgelist208, edgelist209, edgelist210) edgelist211 <- subthemes%>%group_by(Outbreak_management,Coping_consumers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Outbreak_management", "B" = "Coping_consumers") edgelist212 <- subthemes%>%group_by(Outbreak_management,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Outbreak_management", "B" = "Coping_processors") edgelist213 <- subthemes%>%group_by(Outbreak_management,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Outbreak_management", "B" = "Coping_retailers_and_restaurants") edgelist214 <- subthemes%>%group_by(Outbreak_management,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Outbreak_management", "B" = "Coping_farmers") edgelist215 <- subthemes%>%group_by(Outbreak_management,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Outbreak_management", "B" = "Epidemiological_information") edgelist216 <- subthemes%>%group_by(Outbreak_management,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Outbreak_management", "B" = "Animal_welfare") edgelistP <- rbind( edgelist211, edgelist212, edgelist213, edgelist214, edgelist215, edgelist216) edgelist217 <- subthemes%>%group_by(Coping_consumers,Coping_processors) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_consumers", "B" = "Coping_processors") edgelist218 <- subthemes%>%group_by(Coping_consumers,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_consumers", "B" = "Coping_retailers_and_restaurants") edgelist219 <- subthemes%>%group_by(Coping_consumers,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_consumers", "B" = "Coping_farmers") edgelist220 <- subthemes%>%group_by(Coping_consumers,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_consumers", "B" = "Epidemiological_information") edgelist221 <- subthemes%>%group_by(Coping_consumers,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_consumers", "B" = "Animal_welfare") edgelistQ <- rbind( edgelist217, edgelist218, edgelist219, edgelist220, edgelist221) edgelist222 <- subthemes%>%group_by(Coping_processors,Coping_retailers_and_restaurants) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_processors", "B" = "Coping_retailers_and_restaurants") edgelist223 <- subthemes%>%group_by(Coping_processors,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_processors", "B" = "Coping_farmers") edgelist224 <- subthemes%>%group_by(Coping_processors,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_processors", "B" = "Epidemiological_information") edgelist225 <- subthemes%>%group_by(Coping_processors,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_processors", "B" = "Animal_welfare") edgelistR <- rbind( edgelist222, edgelist223, edgelist224, edgelist225) edgelist226 <- subthemes%>%group_by(Coping_retailers_and_restaurants,Coping_farmers) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_retailers_and_restaurants", "B" = "Coping_farmers") edgelist227 <- subthemes%>%group_by(Coping_retailers_and_restaurants,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_retailers_and_restaurants", "B" = "Epidemiological_information") edgelist228 <- subthemes%>%group_by(Coping_retailers_and_restaurants,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_retailers_and_restaurants", "B" = "Animal_welfare") edgelistS <- rbind(edgelist226, edgelist227, edgelist228) edgelist229 <- subthemes%>%group_by(Coping_farmers,Epidemiological_information) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_farmers", "B" = "Epidemiological_information") edgelist230 <- subthemes%>%group_by(Coping_farmers,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Coping_farmers", "B" = "Animal_welfare") edgelistT <- rbind(edgelist229, edgelist230) edgelistU<- subthemes%>%group_by(Epidemiological_information,Animal_welfare) %>% summarise(weight = n()) %>% ungroup ()%>% rename ("A" = "Epidemiological_information", "B" = "Animal_welfare") edgelist <- rbind(edgelistA, edgelistB, edgelistC, edgelistD, edgelistE, edgelistF, edgelistG, edgelistH, edgelistI, edgelistJ, edgelistK, edgelistL, edgelistM, edgelistN, edgelistO, edgelistP, edgelistQ, edgelistR, edgelistS, edgelistT, edgelistU) edges<- edgelist %>% left_join (nodes, by = c("A" = "label")) %>% rename (from = id) edges<-edges %>% left_join (nodes, by = c("B" = "label")) %>% rename (to = id) edges<- edges %>% na.omit edges edges <- edges[c("from", "to", "weight")] ####add columns to nodes#### nodes$theme.type<- NA nodes$theme.type[nodes$label == "Consumer demand changes" | nodes$label =="Reasons for demand change" | nodes$label =="Communication(s)" | nodes$label =="Change in chicken sales" | nodes$label == "Change in chicken prices" ] <- 1 #"Demand and market effects" nodes$theme.type[nodes$label == "Value chain business closure" | nodes$label =="Supply chain functioning" | nodes$label =="Links to other chains" | nodes$label =="Requests and power" ] <- 2 #Value chain effects nodes$theme.type[nodes$label == "Trade" ] <- 3 #Trade nodes$theme.type[nodes$label == "Impact on labour" | nodes$label =="Economic hardship" ] <- 4 #Labour and livelihoods nodes$theme.type[nodes$label == "Economic support" | nodes$label =="Food donation" | nodes$label =="Normalise market dynamics" | nodes$label =="Outbreak management" ] <- 5 #Mitigation and interventions nodes$theme.type[nodes$label == "Coping consumers" | nodes$label =="Coping processors" | nodes$label =="Coping retailers and restaurants" | nodes$label =="Coping farmers" ] <- 6 #Coping nodes$theme.type[nodes$label == "Epidemiological information" ] <- 7 #Epidemiological factors nodes$theme.type[nodes$label == "Animal welfare" ] <- 8 #Animal welfare nodes$theme.name<- NA nodes$theme.name[nodes$label == "Consumer demand changes" | nodes$label =="Reasons for demand change" | nodes$label =="Communication(s)" | nodes$label =="Change in chicken sales" | nodes$label == "Change in chicken prices" ] <- "Demand and market effects" nodes$theme.name[nodes$label == "Value chain business closure" | nodes$label =="Supply chain functioning" | nodes$label =="Links to other chains" | nodes$label =="Requests and power" ] <- "Value chain effects" nodes$theme.name[nodes$label == "Trade" ] <- "Trade" nodes$theme.name[nodes$label == "Impact on labour" | nodes$label =="Economic hardship" ] <- "Labour and livelihoods" nodes$theme.name[nodes$label == "Economic support" | nodes$label =="Food donation" | nodes$label =="Normalise market dynamics" | nodes$label =="Outbreak management" ] <- "Mitigation and interventions" nodes$theme.name[nodes$label == "Coping consumers" | nodes$label =="Coping processors" | nodes$label =="Coping retailers and restaurants" | nodes$label =="Coping farmers" ] <- "Coping" nodes$theme.name[nodes$label == "Epidemiological information" ] <- "Epidemiological factors" nodes$theme.name[nodes$label == "Animal welfare" ] <- "Animal welfare" ####create graph#### graph<- graph_from_data_frame(d = edges, vertices = nodes, directed = F) colrs<- brewer.pal(8, "Dark2") V(graph)$color <- colrs[V(graph)$theme.type] V(graph)$label <- NA summary(nodes$theme.name) aa<- unique(nodes[c("theme.name")]) plot(graph, layout = layout_in_circle, edge.width = edges$weight/10 ) legend(x=-1.8, y=1.2, c(aa$theme.name), pch=21, col="#777777", pt.bg=colrs, pt.cex=2.5, cex=1, bty="n", ncol=1) locator <- function(...) { assign('.last.plot', recordPlot(), envir=.GlobalEnv) graphics::locator(...) } undo <- function() if (exists('.last.plot')) replayPlot(.last.plot) text(locator(1),"Trade") text(locator(1),"Impact \non labour") text(locator(1),"Economic \nhardship") text(locator(1),"Economic \nsupport") text(locator(1),"Food \ndonation") text(locator(1),"Normalise \nmarket dynamics") text(locator(1),"Outbreak \nmanagement") text(locator(1),"Coping \nconsumers") text(locator(1),"Coping \nprocessors") text(locator(1),"Coping retailers \nand restaurants") text(locator(1),"Coping \nfarmers") text(locator(1),"Epidemiological \ninformation") text(locator(1),"Animal \nwelfare") text(locator(1),"Consumer \ndemand changes") text(locator(1),"Reasons for \ndemand changes") text(locator(1),"Communication(s)") text(locator(1),"Change in \nchicken sales") text(locator(1),"Change in \nchicken prices") text(locator(1),"Value chain \nbusiness closure") text(locator(1),"Supply chain \nfunctioning") text(locator(1),"Links to \nother chains") text(locator(1),"Requests \nand power") undo()