R/check_infomap.R

Defines functions check_infomap

Documented in check_infomap

#' Check if Infomap's standalone file is installed.
#'
#' Attempts to run Infomap via the \code{system} command to make sure it works propoerly.
#'
#' @return FALSE and an error if Infomap is not installed correctly. TRUE (and version number) if it is.
#'
#' @examples 
#' check_infomap()
#' 
#' @param x The name of the Infomap executable file.
#' @details For now, this package depends on Infomap's stand-alone version. Futre versions or another package will incorporate Infomap directly into R.
#'
#' @export

check_infomap <- function(x='Infomap'){
    out <- attempt(system(paste('./',x,' -V',sep='')), msg = 'Infomap not installed correctly. See www.mapequation.org for instructions on how to install.')
    if (out==0) {
      return(T)
    } else {
      return(F)
    }
}
Ecological-Complexity-Lab/infomap_ecology_package documentation built on June 6, 2024, 5:28 a.m.