evaluate_node_query | R Documentation |
This function is not meant to be called directly, but used inside other functions that accept a node query.
evaluate_node_query(data, query)
data |
An object of class |
query |
The query that defines for which nodes to extract indices,
defused into a |
There are multiple ways in which node indices can be queried in sfnetworks. The query can be formatted as follows:
As spatial features: Spatial features can be given as object of
class sf
or sfc
. The nearest node to
each feature is found by calling st_nearest_feature
.
As node type query function: A node type query function defines for each node if it is of a given type or not. Nodes that meet the criterium are queried.
As node predicate query function: A node predicate query function defines for each node if a given spatial predicate applies to the spatial relation between that node and other spatial features. Nodes that meet the criterium are queried.
As column name: The referenced column is expected to have logical values defining for each node if it should be queried or not. Note that tidy evaluation is used and hence the column name should be unquoted.
As integers: Integers are interpreted as node indices. A node index corresponds to a row-number in the nodes table of the network.
As characters: Characters are interpreted as node names. A node name corresponds to a value in a column named "name" in the the nodes table of the network. Note that this column is expected to store unique names without any duplicated values.
As logicals: Logicals should define for each node if it should be queried or not.
Queries that can not be evaluated in any of the ways described above will be
forcefully converted to integers using as.integer
.
A vector of queried node indices.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.