R/asnr_tools.R
import_from_asnr.Rd
Import network from asnr package Bansal lab's Animal Social Network Repository
import_from_asnr( class = NULL, species = NULL, network = NULL, url = NULL, output = c("graph", "adjacency"), type = c("both", "upper", "lower"), ..., default_prefix = "https://raw.githubusercontent.com/bansallab/asnr/master/Networks/", full.path = NULL )
class | character scalar. Phylogenetic class folder of the network to import (e.g. "Aves","Mammalia",etc.). Supports partial matching. |
---|---|
species | character scalar. species folder of the network to import (e.g. "Aves","Mammalia",etc.). Needs to match the beginning of the folder's name Supports partial matching. |
network | character scalar. Optional if the folder contains only one .graphml file. Otherwise the .graphml file name to import. Supports partial matching. |
url | character scalar. Optional if argument |
output | character scalar. Either "graph" for an |
type | character scalar. One of "both", "upper", and "lower". In the case of undirected network, "upper" or "lower" should probably be preferred. |
... | additional argument. Useful to pass a |
default_prefix | character scalar. URL "prefix" used to retrieve the graphml file from github. |
full.path | character scalar. Optional, can be used to input directly an URL to a graphml file. |
According to output, either a igraph object or an adjacency matrix.
if (FALSE) { import_from_asnr("Aves","cowbird") # partial matching works, but at the moment not case insensitive import_from_asnr("Amph","frog",output = "adj") # Users can also copy-paste a `.graphml`'s URL # link split into two for line length reason. User can directly copy paste full links, however import_from_asnr( url = paste0( "https://github.com/bansallab/asnr/blob/master/Networks/Reptilia/", "lizard_proximity_weighted/weighted_network_social_T_rugosa.graphml" ) ) # To avoid multiple get querries and longer computation time, users can first # load a `asnr.df` data frame by calling once the `asnr_network_df` function asnr.df <- asnr_network_df() import_from_asnr("Amph","frog",output = "adj",asnr.df = asnr.df) }