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
)

Arguments

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 class and species (and network in the case of several graphml in one folder). URL of the .graphml file to import.

output

character scalar. Either "graph" for an igraph graph object, or "adjacency" for an adjacency matrix

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 asnr.df argument to construct_full.path.

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.

Value

According to output, either a igraph object or an adjacency matrix.

Examples

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) }