intensitynet {intensitynet} | R Documentation |
Constructor of the class intensitynet.
Description
This constructor creates an intensitynet object using an adjacency matrix, the coordinates of the nodes and the coordinates of the events.
Usage
intensitynet(
adjacency_mtx,
node_coords,
event_data,
graph_type = c("undirected", "directed", "mixed"),
event_correction = 5
)
Arguments
adjacency_mtx |
Network adjacency matrix |
node_coords |
Nodes latitude and longitude matrix (coordinates) |
event_data |
DataFrame with event latitude and longitude coordinates (mandatory columns) and optional attributes related to the events |
graph_type |
Network type: 'undirected' (default), 'directed' or 'mixed' |
event_correction |
Value that determines how far can be an event to be considered part of a segment (default 5). This value highly depends on the given coordinate system |
Value
intensitynet class object containing: graph = <igraph>, events = <matrix>, graph_type = c('directed', 'undirected', 'mixed'), distances = <matrix>, event_correction = <integer>, events_related = <boolean>
Examples
library(spatstat)
data(chicago)
chicago_df <- as.data.frame(chicago[["data"]]) # Get as dataframe the data from Chicago
# Get the adjacency matrix. One way is to create an igraph object from the edge coordinates.
edges <- cbind(chicago[["domain"]][["from"]], chicago[["domain"]][["to"]])
chicago_net <- igraph::graph_from_edgelist(edges)
# And then use the igraph function 'as_adjacency_matrix'
chicago_adj_mtx <- as.matrix(igraph::as_adjacency_matrix(chicago_net))
chicago_node_coords <- data.frame(xcoord = chicago[["domain"]][["vertices"]][["x"]],
ycoord = chicago[["domain"]][["vertices"]][["y"]])
# Create the intensitynet object, in this case will be undirected
intnet_chicago <- intensitynet(chicago_adj_mtx,
node_coords = chicago_node_coords,
event_data = chicago_df)
[Package intensitynet version 1.4.0 Index]