read_network.RdRead a csv file with a specific format (see Details) and intepret it as network directed data with possibly weighted edges.
read_network(x)
| x | character. Path of csv file |
|---|
object of class igraph
The file must be plain text with comma-separated columns and variable names in the first line. Field separators other than comma are also supported. In particular, semi-colon field separators and comma decimal separator. There must be either 6 or 7 columns in the same order and of the same types as follows:
origin character
destination character
lon_orig numeric (decimal degrees, WGS84)
lat_orig numeric (decimal degrees, WGS84)
lon_dest numeric (decimal degrees, WGS84)
lat_dest numeric (decimal degrees, WGS84)
volume Optional. directed flux in some consistent unit
Variable names can be different. If strings contain spaces they must be quoted.
d <- data.frame(from = "A", to = "B", fx = 0, fy = 0, tx = 1, ty = 1) tf <- tempfile() write.csv(d, tf, row.names = FALSE) read_network(tf)#> IGRAPH d1ae7cd DN-- 2 1 -- #> + attr: name (v/c) #> + edge from d1ae7cd (vertex names): #> [1] A->B