initialize_network: Initialize a mineral-chemistry network as stand-alone network...

View source: R/fct_build-network.R

initialize_networkR Documentation

Initialize a mineral-chemistry network as stand-alone network rather than for embedding into the Shiny App.

Description

Initialize a mineral-chemistry network as stand-alone network rather than for embedding into the Shiny App.

Usage

initialize_network(
  elements_of_interest,
  force_all_elements = FALSE,
  elements_by_redox = FALSE,
  restrict_to_elements = FALSE,
  ignore_na_redox = FALSE,
  age_range = c(0, 5),
  max_age_type = "Maximum",
  cluster_algorithm = "Louvain",
  cluster_seed = NULL,
  use_data_cache = TRUE
)

Arguments

elements_of_interest

An array of specified elements whose minerals should be included in the network. For all elements, specify "all".

force_all_elements

A logical. If FALSE (default), minerals containing any of 'elements_of_interest' will be included in network. If TRUE, only minerals with full intersection of all specified elements will be included in network.

elements_by_redox

A logical. If FALSE (default), element nodes will be constructed regardless of redox state. If TRUE, creates separate node for each element's redox state, e.g. Fe2+ and Fe3+ would be separate nodes.

restrict_to_elements

A logical. If FALSE (default), constructed network will _only_ contain the specified focal element(s)

ignore_na_redox

A logical. If TRUE and elements_by_redox is TRUE, element nodes without redox states will be removed from the network.

age_range

A array of two numbers giving inclusive range of mineral ages in Ga to include in network.

max_age_type

A string indicating how mineral ages should be assessed. If "Maximum" (default), filters minerals using maximum known ages at localities. If "Minimum", filters minerals using minimum known ages at localities.

cluster_algorithm

A string giving community clustering algorithm, one of "Louvain" (default) or "Leading eigenvector".

cluster_seed

An integer giving a random seed for reproducible clustering. Default is NULL. "Louvain" (default) or "Leading eigenvector".

use_data_cache

A logical. If TRUE (default) cached Mineral Evolution Database will be used to build the network. If FALSE, data will be fetched from MED here. CAUTION: Requires internet connection and will take several minutes to update.

Value

Named list containing an igraph-formatted network (‘network’), an igraph::communities object giving node cluster memberships (‘clustering’), a tibble of nodes associated metadata (‘nodes’), and a tibble of edges and associated metadata (‘edges’), and a tibble of mineral locality information ('locality_info')

Examples

## Not run: 
# Include all Iron minerals whose maximum known age is between 1-2 Gya, and apply 
#   Louvain community clustering
initialize_network("Fe", age_range = c(1,2))

# Include all minerals containing either Iron and Oxygen whose maximum known age 
#   is between 1-2 Gya
initialize_network(c("Fe", "O"), age_range = c(1,2))

# Include all minerals containing both Iron and Oxygen whose maximum known age is 
#   between 1-2 Gya
initialize_network(c("Fe", "O"), force_all_elements = TRUE, age_range = c(1,2))

# Build the full mineral network
initialize_network("all")

## End(Not run)

spielmanlab/dragon documentation built on Nov. 15, 2023, 3:04 a.m.