Skip to contents

You might need to wait a few seconds for all of the graphics in this file to load.

How it works

You import a mapfile from a built-in example file, a local excel file, from a S3 store, or from sql using load_mapfile()

A family of functions pipe_* are provided (manipulate, calculate, hide, combine…) to implement successive filtering operations on a mapfile. These operations do not change the underlying data.

So you import/load data as a mapfile and all your work steps are then just applying successive filters.

Each filter returns another mapfile, suitably filtered.

Mapfiles, which are just lists of tables (actually, tibbles) with the class mapfile.

Statement tables are used in Causal Map as the underlying data which is to be coded into causal links. So each link refers to a quote from a particular statement. Statements are optional and this package can be used without them.

In this package, nodes are called factors and the edges are called links.

Parser

All of these filters can be produced and edited either in a chain of actual R functions or in the simplified text format which is processed by the parser: parse_commands.

This parser takes text strings with a simpler command syntax as input and outputs one of these main functions for each line of text. This parser is used to read text commands from the input window in Causal Map Viewer and manipulate the output map with the corresponding functions. The input text can also consist of several lines, and the commands are applied one by one in sequence, in a pipeline of commands, such that after each command, such as each command starts with the map defined by the previous line and produces a new one.

Output functions

There are three output functions which are thin wrappers around visNetwork, DiagrammeR and DT, allowing a graph to be displayed using any of these three visualisation engines.

Additional fields

Some of the commands such as path tracing create additional fields or variables for each factor and/or link. For example, when filtering by label, fields are created which can then be used to apply formatting.

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.

Visualise the files like this:

example2 %>% pipe_coerce_mapfile() %>% make_interactive_map

Your input mapfile 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.

Basic examples

Interactive and Print maps

Selecting and finding

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

Simple frequency

Zero up and down

Case insensitive

notcontains

notequals

OR

Does not work in functions, but works when parsed:

Order matters

No result

Numerical comparison

No result

Highlight only

Note this doesn’t work in the app:

Conditional formatting

Wrap factors

Remove brackets

Bundle factors

Note the defaults for bundle_links and label_links:

Note the default for bundle_links is equivalent to simple_bundle:

Group and label by sex and scale by count:

Group by sex and scale and colour by count:

Proportion

Surprise

Using initials to shorten the labels

Show continuity

Group and label by sex and scale by count:

Nested maps

Zooming out and showing source count

Combining opposites

Nested maps with opposites

Note colours in Interactive view

Path tracing

## ### Single
## ### Case insensitive
## ### Failing; no paths at all
## ### Failing; no paths
## ### Implicit multiple
## ### Explicit multiple
## Should this be possible?

Robustness

## # A tibble: 3 x 2
##   row_names            `High rainfall <U+0001F327>`
##   <chr>                            <dbl>
## 1 All targets                          1
## 2 Damage to Businesses                 1
## 3 Damage to Property                   1
## # 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>
## # 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>
## # A tibble: 1 x 2
##   row_names                                                `Capabilities; [P13]~
##   <chr>                                                                    <dbl>
## 1 Outcomes; [OP3] Diversification of livelihood activities                     6
row_names External factor; High rainfall
Outcome; People moving away from the area 2
row_names External factor; High rainfall
Flooding 3
row_names External factor; High rainfall
All targets 3
Damage to businesses 1
Damage to property 2
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
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:

##                              rowname Funds from Orgx
## 1 Increased investment into the area               1
##                                         rowname All origins
## 1                    (IEA) Increased income [P]           3
## 2                                   All targets           1
## 3      (IEA) Reduction in disposable income [N]           1
## 4                      (IEA) Reduced income [N]           0
## 5 (IEA) Increased time on income generation [P]           0
##   (IEA) Social Cash Transfer (Gov) [I] (IEA) Social Cash Transfer (OrgX) [E]
## 1                                   16                                     3
## 2                                    2                                     0
## 3                                    1                                     1
## 4                                    0                                     0
## 5                                    0                                     0
##   (IEA) Social Cash Transfer not working (Gov)
## 1                                            0
## 2                                            0
## 3                                            0
## 4                                            0
## 5                                            0

Check that opposites colouring is always preserved?

Colours in interactive map

Trace continuity

## NULL
## NULL

Cluster factors

Pipe-able:

Data manipulation, file management etc

Accessing the data

One column in one table

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

Note warning if factor labels are shared

Editing maps directly

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

Editing maps with pipe_update_mapfile

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

Coercing to a standard mapfile:

Printing the filters

You can also load up an Excel file: