Search over all networks using a keyword, a custom query or a spatial object
If the query
is a character string, then all character columns in the table
are searched and the entries for which at least one
partial match was found are returned.
Alternatively, a named list can be used to look for an exact match in a specific column (see Details section)
Arguments
- query
either a character string including a single keyword or a named list containing a custom query (see details section below), or a spatial object (see the description of
query_sf
). Note that if an empty character string is passed, then all datasets available are returned.- verbose
a
logical
. Should extra information be reported on progress?- ...
further arguments to be passed to
httr::GET()
.- query_sf
a spatial object of class
sf
used to search in a specific geographical area.
Value
An object of class mgSearchNetworks
, which is a data.frame
object with all networks informations
Details
Names of the list should match one of the column names within the table.
For the networks
table, those are
id: unique identifier of the network;
all_interactions: false interaction can be considered as real false interaction
dataset_id: the identifier of the dataset;
public: network publicly available;
Note that for lists with more than one element, only the first element is used, the others are ignored. An example is provided below.
Functions
search_networks_sf()
: Search networks within a spatial object passed as an argument. Note thatsf
must be installed to use this function.
Examples
# \donttest{
mg_insect <- search_networks(query="insect%")
#> Data retrieval 100%
#>
#> Found 14 networks
# Retrieve the search results
nets_insect <- get_collection(mg_insect)
#> Processing id: 18 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 100%
#>
#> Processing id: 4 1/1
#>
#> Processing id: 4 1/1
#>
#> Processing id: 909 1/1
#>
#> Data retrieval 50%
#> Data retrieval 100%
#>
#> Data retrieval 33.3%
#> Data retrieval 66.7%
#> Data retrieval 100%
#>
#> Processing id: 9 1/1
#>
#> Processing id: 9 1/1
#>
#> Processing id: 948 1/1
#>
#> Data retrieval 20%
#> Data retrieval 40%
#> Data retrieval 60%
#> Data retrieval 80%
#> Data retrieval 100%
#>
#> Data retrieval 11.1%
#> Data retrieval 22.2%
#> Data retrieval 33.3%
#> Data retrieval 44.4%
#> Data retrieval 55.6%
#> Data retrieval 66.7%
#> Data retrieval 77.8%
#> Data retrieval 88.9%
#> Data retrieval 100%
#>
#> Processing id: 66 1/1
#>
#> Processing id: 65 1/1
#>
#> Processing id: 1460 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 100%
#>
#> Processing id: 91 1/1
#>
#> Processing id: 90 1/1
#>
#> Processing id: 1461 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 50%
#> Data retrieval 100%
#>
#> Processing id: 91 1/1
#>
#> Processing id: 90 1/1
#>
#> Processing id: 1471 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 100%
#>
#> Processing id: 99 1/1
#>
#> Processing id: 98 1/1
#>
#> Processing id: 1493 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 100%
#>
#> Processing id: 114 1/1
#>
#> Processing id: 113 1/1
#>
#> Processing id: 1501 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 100%
#>
#> Processing id: 118 1/1
#>
#> Processing id: 117 1/1
#>
#> Processing id: 1500 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 100%
#>
#> Processing id: 118 1/1
#>
#> Processing id: 117 1/1
#>
#> Processing id: 1502 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 100%
#>
#> Processing id: 119 1/1
#>
#> Processing id: 118 1/1
#>
#> Processing id: 1507 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 100%
#>
#> Processing id: 124 1/1
#>
#> Processing id: 123 1/1
#>
#> Processing id: 1508 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 50%
#> Data retrieval 100%
#>
#> Processing id: 124 1/1
#>
#> Processing id: 123 1/1
#>
#> Processing id: 1510 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 100%
#>
#> Processing id: 126 1/1
#>
#> Processing id: 125 1/1
#>
#> Processing id: 1566 1/1
#>
#> Data retrieval 100%
#>
#> Data retrieval 100%
#>
#> Processing id: 154 1/1
#>
#> Processing id: 151 1/1
#>
# Spatial query
library(sf)
#> Linking to GEOS 3.10.2, GDAL 3.4.1, PROJ 8.2.1; sf_use_s2() is TRUE
library(USAboundaries)
#> The USAboundariesData package needs to be installed.
#> Please try installing the package using the following command:
#> install.packages("USAboundariesData", repos = "https://ropensci.r-universe.dev", type = "source")
area <- us_states(state="california")
networks_in_area <- search_networks_sf(area, verbose = FALSE)
plot(networks_in_area)
#> Warning: plotting the first 9 out of 10 attributes; use max.plot = 10 to plot all
# Retrieve network ID 5013
net_5013 <- search_networks(query = list(id = 5013))
#> Data retrieval 100%
#>
#> Found 1 networks
# Network(s) of dataset ID 19
mg_19 <- search_networks(list(dataset_id = 19))
#> Data retrieval 100%
#>
#> Found 1 networks
# }