1. Install the R package

The package was built under R 4.1 and depends on other packages.

# Install  (if not installed) and load necessary packages
package.list=c("attempt", "cowplot", "igraph", "ggalluvial","magrittr","vegan", "dplyr","readr","ggplot2","stringr","tibble","tidyr","rlang","bipartite","tidyverse", "Matrix","DT","hablar","devtools")
loaded <-  package.list %in% .packages()
package.list <-  package.list[!loaded]
installed <-  package.list %in% .packages(TRUE)
if (!all(installed)) install.packages(package.list[!installed], repos="http://cran.rstudio.com/")

devtools::install_github('Ecological-Complexity-Lab/emln', force=T)
library(emln)

# Install infomapecology 
devtools::install_github('Ecological-Complexity-Lab/infomap_ecology_package', force=T)
library(infomapecology)

# Check the version.
packageDescription('infomapecology')



2. Install Infomap

We use Infomap version 2.x as a stand-alone file. We are working on integrating Infomap directly intro R.


MacOS (Linux should be similar)

1. In the terminal run:

  • xcode-select --install
  • For OpenMP support
    • Install homebrew as specified in https://brew.sh. This will take a while.
    • install packages: brew install libomp.

2. Then either:

Install Infomap via the install_infomap function in the package as below. Avoid folder names with spaces or non-english lettes.

setwd('where your Infomap file and R script will live')
install_infomap()

# Check Infomap is running
setwd('where your Infomap file and R script now live')
check_infomap() # Make sure file can be run correctly. Should return TRUE

or download a binary from here and put the file in the working folder.


Windows

Install Infomap via the install_infomap function in the package as below. Avoid folder names with spaces or non-english lettes.

setwd('where your Infomap file and R script will live')
install_infomap()

# Check Infomap is running
setwd('where your Infomap file and R script now live')
check_infomap() # Make sure file can be run correctly. Should return TRUE

or download a binary from here and put the file in the working folder.

Important notes:

  1. The best practice is to compile Infomap under the file name “Infomap” and place it in the same working folder in which the R code is run.

  2. Other ways to install: https://www.mapequation.org/infomap/#Install