I have two files: 1. A graph mL which has been constructed of a public transport network with nodes representing stops/stations and edges representing connections between nodes with a corresponding travel time. The nodes have an id to represent the name of their stations. 2. A csv of nodes with id, lat/long coordinates and LSOA code
I need to join the lat/long coordinates and LSOA code to the existing graphml based on the node id and not sure how to do this. I'm using igraph and R to do this.
I also then want to subset the graphml based on only selecting out the part of the network relevant to the london area. I have also a subset of London nodes to do this.
Any help would be appreciated as I'm very new to R.
Below is the code I have tried so far:
g_L<-read_graph("graph_bustuberail_london_500m.graphml",format="graphml") #import gml
file_nodes <- "graph_bustuberail_london_kdtree_nodes.csv" #import csv of nodes
mergedSegments=merge(g_L,file_nodes,by.x="id",by.y="id")
This is the error message I get:
Error in as.data.frame.default(x) :
cannot coerce class ""igraph"" to a data.frame