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.


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




Does not work in functions, but works when parsed:

Order matters