Loading example datasets

(After loading CausalMapFunctions library)

The package ships with some example datasets, at the moment just these:

  • example2
  • quip_example

which you can also view in Causal Map on the web.

You can load the files like this:

example2 <- load_premap("example2") %>% pipe_coerce_mapfile()#### should not be necessary TODO 

example2
## Factors: # A tibble: 11 x 19
##   label             factor_id factor_memo driver_score outcome_score driver_rank
##   <chr>                 <int> <chr>              <dbl>         <dbl>       <int>
## 1 Coastal erosion           2 <NA>                  -1            -1           5
## 2 Damage to Busine~         3 <NA>                  -2             1           8
## # ... with 9 more rows, and 13 more variables: outcome_rank <int>,
## #   is_opposable <lgl>, top_level_label <chr>, top_level_frequency <dbl>,
## #   zoom_level <dbl>, is_flipped <lgl>, map_id <int>, size <dbl>,
## #   betweenness <dbl>, betweenness_rank <dbl>, in_degree <dbl>,
## #   out_degree <dbl>, frequency <dbl>
## Links: # A tibble: 8 x 31
##   from_label   to_label  statement_id quote    simple_bundle    from    to note 
##   <chr>        <chr>            <int> <chr>    <chr>           <int> <int> <lgl>
## 1 "High rainf~ "Floodin~            1 Recent ~ "High rainfall~     9     7 NA   
## 2 "Flooding \~ "Damage ~            1 The flo~ "Flooding \U00~     7     4 NA   
## # ... with 6 more rows, and 23 more variables: strength <int>, certainty <int>,
## #   link_label <chr>, link_memo <chr>, hashtags <chr>, actualisation <int>,
## #   link_id <int>, capacity <dbl>, weight <int>, from_flipped <lgl>,
## #   to_flipped <lgl>, map_id <int>, text <chr>, statement_memo <chr>,
## #   statement_map_id <dbl>, source_id <chr>, source_memo <chr>,
## #   source_map_id <dbl>, question_id <chr>, question_text <chr>,
## #   question_memo <chr>, question_map_id <dbl>, simple_frequency <int>
## Statements: # A tibble: 2 x 11
##   text        statement_memo statement_map_id statement_id source_id source_memo
##   <chr>       <chr>                     <dbl>        <dbl> <chr>     <chr>      
## 1 "Welcome t~ st memo                       1            1 1         ooh        
## 2 "Rising se~ <NA>                          1            2 1         ooh        
## # ... with 5 more variables: source_map_id <dbl>, question_id <chr>,
## #   question_text <chr>, question_memo <chr>, question_map_id <dbl>
## Sources: # A tibble: 1 x 3
##   source_id source_memo source_map_id
##   <chr>     <chr>               <dbl>
## 1 1         ooh                     1
## Questions: # A tibble: 1 x 4
##   question_id question_text   question_memo question_map_id
##   <chr>       <chr>           <chr>                   <dbl>
## 1 1           global question q memo                      1
## Settings: # A tibble: 1 x 3
##   setting_id        value map_id
##   <chr>             <chr> <chr> 
## 1 background_colour <NA>  1
example2 %>% summary
## $colnames
## $colnames$factors
##  [1] "label"               "factor_id"           "factor_memo"        
##  [4] "driver_score"        "outcome_score"       "driver_rank"        
##  [7] "outcome_rank"        "is_opposable"        "top_level_label"    
## [10] "top_level_frequency" "zoom_level"          "is_flipped"         
## [13] "map_id"              "size"                "betweenness"        
## [16] "betweenness_rank"    "in_degree"           "out_degree"         
## [19] "frequency"          
## 
## $colnames$links
##  [1] "from_label"       "to_label"         "statement_id"     "quote"           
##  [5] "simple_bundle"    "from"             "to"               "note"            
##  [9] "strength"         "certainty"        "link_label"       "link_memo"       
## [13] "hashtags"         "actualisation"    "link_id"          "capacity"        
## [17] "weight"           "from_flipped"     "to_flipped"       "map_id"          
## [21] "text"             "statement_memo"   "statement_map_id" "source_id"       
## [25] "source_memo"      "source_map_id"    "question_id"      "question_text"   
## [29] "question_memo"    "question_map_id"  "simple_frequency"
## 
## $colnames$statements
##  [1] "text"             "statement_memo"   "statement_map_id" "statement_id"    
##  [5] "source_id"        "source_memo"      "source_map_id"    "question_id"     
##  [9] "question_text"    "question_memo"    "question_map_id" 
## 
## $colnames$sources
## [1] "source_id"     "source_memo"   "source_map_id"
## 
## $colnames$questions
## [1] "question_id"     "question_text"   "question_memo"   "question_map_id"
## 
## $colnames$settings
## [1] "setting_id" "value"      "map_id"    
## 
## 
## $`Number of rows`
## # A tibble: 1 x 6
##   factors links statements sources questions settings
##     <int> <int>      <int>   <int>     <int>    <int>
## 1      11     8          2       1         1        1

Visualise them like this:

example2 %>% make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

You can also load up an Excel file:

# system.file("extdata", "quip-lorem", package = "CausalMapFunctions") %>% 
#   get_mapfile_from_excel()

The file should have the standard Causal Map format: you can see an example by downloading any of the files in Causal Map on the web.

pipe_coerce_mapfile will also process a file with no factors and from_label and to_label columns as a named edgelist.

If you filter the factors of a mapfile, e.g. show only factors with labels beginning xyz,

  • also the links are filtered (removing links to removed factors)
  • the statements are not touched

If you filter the links of a mapfile, e.g. show only links with hashtags containing xyz,

  • the factors are not filtered (but using a different command you can remove any factors which no longer have any links)
  • the statements are not touched

If you filter the statements of a mapfile, e.g. show only statements with texts containing xyz,

  • also the links are filtered (removing links to removed statements)
  • the factors are filtered
  # ll <- quip_example
  # ee <- example2
  ee <- load_premap("example2")%>% pipe_coerce_mapfile 
  tt <- load_premap("cm1/tearfund-sl")%>% pipe_coerce_mapfile
  ll <- load_premap("quip-coded")%>% pipe_coerce_mapfile
  oo <- load_premap("organisation1coded")%>% pipe_coerce_mapfile
  e3 <- load_premap("example3-path-tracing")%>% pipe_coerce_mapfile
  mm <- load_premap("save-the-children-mozambique-copy")%>% pipe_coerce_mapfile
  hh <- load_premap("hannahcombiningopposites-sp-test")%>% pipe_coerce_mapfile

Basic examples

Accessing the data

One column in one table

ll %>%
    pipe_find_factors(value="economic") %>%
    .$factors %>%
    .$label %>% 
  knitr::kable()
x
  1. Poor economy
(IEA) Poverty
(BF) Started, expanded or invested in business [P]
(BF) Stopped/reduced piece work ‘ganyu’ [P]
(IEA) Increased income [P]
(IEA) Increased purchasing power [P]
(IEA) Increased savings/loans [P]
(IEA) Increased financial knowledge [P]
(RW) Improved gender equality in household [P]
(IEA) Increased economic independence [P]
(IEA) No longer borrows from community members [P]
(RW) Increased resilience [P]
  1. Economic migration [N]
(RW) Reduction in household size
(RW) Moved to live with relative

Merging two maps

merge_mapfile(ee,tt %>% pipe_select_factors(top=8)) %>% 
  pipe_color_factors(field="map_id") %>% 
  pipe_color_links(field="map_id",fun="unique") %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Note warning if factor labels are shared

load_premap("example2") %>%
  pipe_coerce_mapfile %>% 
  pipe_merge_mapfile("example2") %>% 
  pipe_color_factors(field="map_id") %>% 
  pipe_color_links(field="map_id",fun="unique") %>% 
  make_interactive_map
## Warning in merge_mapfile(graf, map2): Factor labels are shared!
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Editing maps directly

There is no guarantee that the resulting map is still a standard mapfile.

ee$factors$label[1] <- "Label changed"
ee %>% make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Editing maps with pipe_update_mapfile

There is no guarantee that the resulting map is still a standard mapfile.

ee %>% 
  pipe_update_mapfile(factors = ee$factors %>% mutate(label="one")) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Coercing to a standard mapfile:

ee %>% 
  pipe_update_mapfile(factors = ee$factors %>% mutate(label="one")) %>% 
  pipe_coerce_mapfile() %>% 
  make_interactive_map
## Warning: Unreplaced values treated as NA as .x is not compatible. Please specify
## replacements exhaustively or supply .default

## Warning: Unreplaced values treated as NA as .x is not compatible. Please specify
## replacements exhaustively or supply .default
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Interactive and Print maps

  ee %>%
    pipe_label_links("link_id") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
  ee %>%
    pipe_label_links("link_id") %>%
    make_print_map()
  ee %>%
    pipe_set_print(grv_layout="circo") %>%
    make_print_map()

Selecting and finding

factors links and statements

ll %>%
    pipe_select_factors(15) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Simple frequency

ll %>%
    pipe_find_links("simple_frequency",value = 50,"greater") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ll %>%
    pipe_select_links(5) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ll %>%
    pipe_find_statements(field="statement_id",value=5,operator="equals") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ll %>%
    pipe_find_factors(value="economic") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Case insensitive

ee %>%
    pipe_find_factors(value="business") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Should these work?

ee %>%
    pipe_find_factors(value="business|property") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ee %>%
    pipe_find_factors(value="business OR property") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

notcontains

ee %>%
    pipe_find_factors(value="sea",operator="notcontains") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ee %>%
    pipe_find_factors(value=c("sea", "High"),operator="notcontains") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ee %>% pipe_find_statements(value="1",operator="notcontains",field="statement_id")%>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ee %>% pipe_find_statements(value="1",operator="notcontains",field="statement_id")%>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

notequals

ee %>% pipe_find_statements(value="1",operator="notequals",field="statement_id")%>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ee %>%
    pipe_find_factors(value=c("Coastal erosion"),operator="notequals") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Does work:

ee %>%
    pipe_find_factors(value=c("business", "property")) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Order matters

ll %>%
    pipe_find_factors(value="economic") %>%
    pipe_select_factors(5) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

No result

ll %>%
    pipe_find_factors(value="asdfasdfasdf") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ll %>%
    pipe_find_links(field="from_label",value="economic",operator="contains") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Numerical comparison

ll %>%
    pipe_find_statements(field="statement_id",value=20,operator="less") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

No result

ll %>%
    pipe_find_statements(field="statement_id",value=20000000,operator="greater") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Conditional formatting

ll %>%
    pipe_select_factors(5) %>%
    pipe_scale_factors(field="frequency") %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ll %>%
    pipe_select_factors(5) %>%
    pipe_color_factors(field="frequency") %>%
    pipe_color_borders(field="betweenness") %>%
    pipe_wrap_factors(5) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ll %>%
    pipe_select_factors(5) %>%
    pipe_color_links(value="count: link_id") %>%
    pipe_wrap_factors(5) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ee %>%
    pipe_label_links("from_label",fun = "unique") %>%
    pipe_wrap_links(6) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ee %>%
    pipe_label_links(value="unique: from_label") %>%
    pipe_wrap_links(6) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ll %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Remove brackets

ll %>%
    pipe_select_factors(5) %>%
    pipe_remove_brackets() %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Bundle factors

ll %>%
    pipe_bundle_factors(value = "IEA") %>%
    pipe_select_factors(5) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Surprise

ll %>%    
  pipe_find_factors(value="sed yield",down=0) %>%
  pipe_bundle_links(group="1. Sex") %>% 
  pipe_color_links(field="1. Sex",fun="unique") %>% 
  pipe_label_links(field="source_id",fun="surprise") %>%  
  pipe_scale_links(field="source_id",fun="count") %>%  
  make_print_map
## Warning in as_numeric_if_all(vec): NAs introduced by coercion

Nested maps

tt %>%
    pipe_zoom_factors(1) %>%
    pipe_select_factors(5) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
tt %>%
    pipe_zoom_factors(1) %>%
    pipe_bundle_links() %>%
    pipe_label_links() %>%
    pipe_scale_links() %>%
    make_print_map

Zooming out and showing source count

oo %>%
    pipe_zoom_factors(1) %>%
    pipe_find_factors(value="Improved health and hygiene practices") %>%
  pipe_bundle_links(group="simple_bundle") %>% 
  pipe_label_links(field="source_id",fun = "count") %>% 
  pipe_wrap_factors() %>% 
    make_print_map 
## NULL

Combining opposites

hh %>% 
  make_print_map()
hh %>% 
  pipe_combine_opposites %>% 
  make_print_map()

Nested maps with opposites

Note colours in Interactive view

tt %>%
    pipe_zoom_factors(1) %>%
    pipe_combine_opposites() %>%
    pipe_select_links(3) %>%
    make_print_map
tt %>%
    pipe_zoom_factors(1) %>%
    pipe_combine_opposites() %>%
    pipe_select_links(3) %>%
    make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn

Path tracing

cat("### Single\n")  
## ### Single
ee %>%    
  pipe_trace_paths(from = "Funds",to="area",length = 5) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
cat("### Case insensitive\n")  
## ### Case insensitive
ee %>%    
  pipe_trace_paths(from = "funds",to="aREa",length = 5) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
cat("### Failing; no paths at all\n")  
## ### Failing; no paths at all
ee %>%    
  pipe_trace_paths(from = "xx",to="yy",length = 5) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
cat("### Failing; no paths\n")  
## ### Failing; no paths
ee %>%    
  pipe_trace_paths(from = "Funds",to="yy",length = 5) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ee %>%    
  pipe_trace_paths(from = "xx",to="Property",length = 5) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
cat("### Implicit multiple\n")  
## ### Implicit multiple
ee %>%    
  pipe_trace_paths(from = "High",to="Damage",length = 5) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
cat("### Explicit multiple\n")  
## ### Explicit multiple
ee %>%    
  pipe_trace_paths(from = "High",to="Property | Business",length = 5) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ee %>%    
  pipe_trace_paths(from = "High",to="Property OR Business",length = 5) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
cat("Should this be possible?")
## Should this be possible?
ee %>%    
  pipe_trace_paths(from = "High",to=c("Property","Business"),length = 5) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
tt %>%
  pipe_trace_paths(from = "Capabilities",to="[OP3]",length = 2) %>% 
  make_interactive_map
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
ee %>%    
  pipe_trace_paths(from = "Funds",to="area",length = 5) %>% 
  make_print_map()

Robustness

ee %>%    
  pipe_trace_robustness(from = "High",to="Damage",length = 5) %>% 
  pipe_wrap_factors() %>% 
  make_print_map()
## Joining, by = "label"
ee %>%    
  pipe_trace_robustness(from = "High",to="Damage",length = 5) %>% 
  get_robustness()
## Joining, by = "label"
## # A tibble: 3 x 2
##   row_names            `High rainfall \U0001f327`
##   <chr>                                     <dbl>
## 1 All targets                                   1
## 2 Damage to Businesses                          1
## 3 Damage to Property                            1
tt %>%
  pipe_trace_robustness(from = "Capabilities",to="[OP3]",length = 2) %>% 
  pipe_wrap_factors() %>% 
  make_print_map()
## Joining, by = "label"
tt %>%
  pipe_trace_robustness(from = "Capabilities",to="[OP3",length = 2) %>% 
  pipe_wrap_factors() %>% 
  make_print_map()
## Joining, by = "label"
tt %>%
  pipe_trace_robustness(from = "Capabilities",to="[OP3]",length = 2) %>% 
  get_robustness()
## Joining, by = "label"
## # A tibble: 1 x 6
##   row_names   `All origins` `Capabilities; [~ `Capabilities; [~ `Capabilities; ~
##   <chr>               <dbl>             <dbl>             <dbl>            <dbl>
## 1 Outcomes; ~            11                 6                 2                2
## # ... with 1 more variable:
## #   Capabilities; [P18] Expertise/knowledge for holistic wellbeing <dbl>
tt %>%
  pipe_trace_robustness(from = "Capabilities",to="[OP3",length = 2) %>% 
  get_robustness()
## Joining, by = "label"
## # A tibble: 5 x 7
##   row_names   `All origins` `~Capabilities; [~ `Capabilities; ~ `Capabilities; ~
##   <chr>               <dbl>              <dbl>            <dbl>            <dbl>
## 1 All targets            18                  1                7                4
## 2 Outcomes; ~             1                  0                0                0
## 3 Outcomes; ~             4                  1                1                1
## 4 Outcomes; ~             2                  0                0                2
## 5 Outcomes; ~            11                  1                7                4
## # ... with 2 more variables:
## #   Capabilities; [P15] CCMP: Envisioning the Church <dbl>,
## #   Capabilities; [P18] Expertise/knowledge for holistic wellbeing <dbl>
tt %>%
  pipe_trace_robustness(from = "Capabilities; [P13",to="[OP3]",length = 2) %>% 
  get_robustness()
## Joining, by = "label"
## # A tibble: 1 x 2
##   row_names                              `Capabilities; [P13] Acquistion of edu~
##   <chr>                                                                    <dbl>
## 1 Outcomes; [OP3] Diversification of li~                                       6
e3  %>%
  pipe_trace_robustness(from = "High",to="People moving",length = 5) %>% 
  make_print_map()
## Joining, by = "label"
e3  %>%
  pipe_trace_robustness(from = "High",to="People moving",length = 5) %>% 
  get_robustness() %>% 
  kable
## Joining, by = "label"
row_names External factor; High rainfall
Outcome; People moving away from the area 2
e3  %>%
  pipe_trace_robustness(from = "High",to="Flooding",length = 5) %>% 
  get_robustness() %>% 
  kable
## Joining, by = "label"
row_names External factor; High rainfall
Flooding 3
e3  %>%
  pipe_trace_robustness(from = "High",to="Damage",length = 5) %>% 
  get_robustness() %>% 
  kable
## Joining, by = "label"
row_names External factor; High rainfall
All targets 3
Damage to businesses 1
Damage to property 2
e3  %>%
  pipe_trace_robustness(from = "External",to="Damage",length = 5) %>% 
  get_robustness() %>% 
  kable
## Joining, by = "label"
row_names All origins External factor; High rainfall External factor; Loss of forests
All targets 3 3 1
Damage to businesses 1 1 1
Damage to property 2 2 1
e3  %>%
  pipe_trace_robustness(from = "External",to="Outcome",length = 5) %>% 
  get_robustness()%>% 
  kable
## Joining, by = "label"
row_names All origins External factor; High rainfall External factor; Loss of forests
All targets 3 3 1
Outcome; People moving away from the area 2 2 1
Outcome; Social things; People get angry 1 1 1

Robustness by field

Just one source:

ee  %>%
  pipe_trace_robustness(from = "Funds",to="Increased",length = 5,field = "source_id") %>% (get_robustness)
## Joining, by = "label"
##                              rowname Funds from Orgx
## 1 Increased investment into the area               1

Check that opposites colouring is always preserved?

hh  %>%
  pipe_trace_robustness(from = "Revision",to="happy",length = 5) %>% 
  pipe_combine_opposites %>% 
  make_print_map()
## Joining, by = "label"
hh  %>%
  pipe_combine_opposites %>% 
  pipe_find_factors(value="exam") %>% 
  make_print_map()
hh  %>%
  pipe_combine_opposites %>% 
  pipe_zoom_factors() %>% 
  pipe_find_factors(value="exam") %>% 
  pipe_select_factors(2) %>% 
  pipe_select_links(3) %>% 
  make_print_map()

Colours in interactive map

hh  %>%
  pipe_combine_opposites %>% 
  pipe_zoom_factors() %>% 
  make_interactive_map()
## 2vn
## 3vn
## 4vn
## 5vn
## 6vn
## 7vn
if(F){
graf <- tt1
graf$factors %>% filter(factor_id %notin% graf$links$from & factor_id %notin% graf$links$to)  %>% nrow

graf$links %>% filter(from %notin% graf$factors$factor_id & to %notin% graf$factors$factor_id)  %>% nrow

graf$links %>% filter(statement_id %notin% graf$statements$statement_id) %>% nrow
  }

Cluster factors

ee %>% 
  pipe_cluster_factors("Damage OR Flood") %>% 
  make_print_map

Pipe-able:

ee %>% 
  pipe_cluster_factors("Damage OR Flood") %>% 
  pipe_cluster_factors("Rising") %>% 
  make_print_map