Reputation: 59
Good Evening, I'm trying to build a dynamic network using networkDynamic() in R. I finally got it to run and build a network, but then I kept getting over 50 warning messages. One for each edge id ####.
I could not find this warning on a google search. I realize something is going on with the edge attributes. I have a node_df set up like...
x <- data.frame(start_time = rep(1648789456, 5), end_time = rep(1682571364, 5), value = as.integer(c(1,2,3,4,5)), propertyID = c("1659425840", "302027335", "1325538711", "1420839984", "35919230"), lat = c(-7.318461, -7.202876, -7.290118, -7.490271, -7.436534), long = c(-110.7441, -110.6784, -110.9157, -112.5476, -112.5974))
start_time end_time value propertyID lat long
1 1648789456 1682571364 1 1659425840 -7.318461 -110.7441
2 1648789456 1682571364 2 302027335 -7.202876 -110.6784
3 1648789456 1682571364 3 1325538711 -7.290118 -110.9157
4 1648789456 1682571364 4 1420839984 -7.490271 -112.5476
5 1648789456 1682571364 5 35919230 -7.436534 -112.5974
str(node_df)
'data.frame': 186 obs. of 7 variables:
$ start_time : num 1.65e+09 1.65e+09 1.65e+09 1.65e+09 1.65e+09 ...
$ end_time : num 1.68e+09 1.68e+09 1.68e+09 1.68e+09 1.68e+09 ...
$ value : int 1 2 3 4 5 6 7 8 9 10 ...
$ propertyID : chr "1659425840" "302027335" "1325538711" "1420839984" ...
$ lat : num -7.32 -7.2 -7.29 -7.49 -7.44 ...
$ long : num -111 -111 -111 -113 -113 ...
and an edge_df
y = data.frame(start_time = c(1650650617, 1650923498, 1651193217, 1651250902, 1651536477), end_time = c(1650923498, 1651167751, 1651250808, 1651516317, 1651774828), from = as.integer(c(10, 2, 1, 6, 9)), to = as.integer(c(2,1,6,9,10)), edgeID = c("C030E39-F95C-43CB-A9DF-2412DC984518", "DC030E39-F95C-43CB-A9DF-2412DC984518", "DC030E39-F95C-43CB-A9DF-2412DC984518", "DC030E39-F95C-43CB-A9DF-2412DC984518", "DC030E39-F95C-43CB-A9DF-2412DC984518"), veh_type = c("users", "users", "trucks", "trucks", "other"))
start_time end_time from to edgeID veh_type
1 1650650617 1650923498 10 2 DC030E39-F95C-43CB-A9DF-2412DC984518 users
2 1650923498 1651167751 2 1 DC030E39-F95C-43CB-A9DF-2412DC984518 users
3 1651193217 1651250808 1 6 DC030E39-F95C-43CB-A9DF-2412DC984518 users
4 1651250902 1651516317 6 9 DC030E39-F95C-43CB-A9DF-2412DC984518 users
5 1651536477 1651774828 9 10 DC030E39-F95C-43CB-A9DF-2412DC984518 users
str(edge_df)
'data.frame': 119046 obs. of 6 variables:
$ start_time: num 1.65e+09 1.65e+09 1.65e+09 1.65e+09 1.65e+09 ...
$ end_time : num 1.65e+09 1.65e+09 1.65e+09 1.65e+09 1.65e+09 ...
$ from : int 10 2 1 6 9 10 7 15 7 15 ...
$ to : int 2 1 6 9 10 7 15 7 15 7 ...
$ edgeID : chr "DC030E39-F95C-43CB-A9DF-2412DC984518" "DC030E39-F95C-43CB-A9DF-2412DC984518" "DC030E39-F95C-43CB-A9DF-2412DC984518" "DC030E39-F95C-43CB-A9DF-2412DC984518" ...
$ veh_type : chr "users" "users" "users" "users" ...
I tried running...
dyn_net <- networkDynamic(vertex.spells = node_df, edge.spells = edge_df, create.TEAs = TRUE)
OR
dyn_net <- networkDynamic(vertex.spells = node_df,edge.spells = test,
create.TEAs = TRUE,
vertex.TEA.names = c("propertyID", "prop_type_c", "lat", "long"))
OR
dyn_net <- networkDynamic(vertex.spells = node_df,edge.spells = test,
create.TEAs = TRUE,
vertex.TEA.names = c("propertyID", "prop_type_c", "lat", "long"), edge.TEA.names = c("edgeID", "veh_type"))
My outcome:
Initializing base.net of size 186 imputed from maximum vertex id in edge records
Activated TEA vertex attributes: propertyID, prop_type_c, lat, longActivated TEA edge attributes: edgeID, veh_typeCreated net.obs.period to describe network
Network observation period info:
Number of observation spells: 1
Maximal time range observed: 1648789456 until 1682571364
Temporal mode: continuous
Time unit: unknown
Suggested time increment: NA
There were 50 or more warnings (use warnings() to see the first 50)
warning()
4: In FUN(X[[i]], ...) :
edge spell data induced an invalid spell matrix for edge TEA 'veh_type' for edge id 1861
Of course, this sample data did not reproduce the warning :-( But this is a sample of the real data, so I'm not sure how to make it reproducible w/out the whole data set (which I can't supply). If you run networkDynamic on these small dfs, then it works.
When I took out the attributes from the original complete edge_df (last 2 columns in the edge_df) and ran networkDynamic() again, it worked with no warnings. The vertex attributes came out just fine. The attributes in the edge_df are not dynamic, but static. Each edge is an ID of a specific vehicle to track and it's type. I don't know if this changes anything. Eventually, what I want to do is create a multilevel multiplex network based on the edge attributes. My question then is why are the edge attributes causing the warnings, but the vertex attributes did not? And how can I add them in the network?
I've looked at these posts: This This This This This
plus the R documentation and vignette.
I'm not sure if you need more information or not, please let me know.
Thank you for your help in advance.
Upvotes: 0
Views: 40