summaryrefslogtreecommitdiffstats
path: root/R Scripts
diff options
context:
space:
mode:
Diffstat (limited to 'R Scripts')
-rwxr-xr-xR Scripts/generate-dag-dat.R10
1 files changed, 5 insertions, 5 deletions
diff --git a/R Scripts/generate-dag-dat.R b/R Scripts/generate-dag-dat.R
index b5f2c3a..a2df165 100755
--- a/R Scripts/generate-dag-dat.R
+++ b/R Scripts/generate-dag-dat.R
@@ -6,7 +6,7 @@ vic_ids = which(V(hyp_lcc)$vic==TRUE)
edgeWeights = function(eis){return(c(hyp_lcc_edges$weight[eis],Inf,Inf)[1:3])}
-dag_dat_all = data.frame(matrix(nrow=1,ncol=8))
+dag_dat_all = data.frame(matrix(nrow=1,ncol=10))
hyp_lcc2 = remove.edge.attribute(hyp_lcc,'weight')
ei = 1
ptm=proc.time()
@@ -28,15 +28,15 @@ for (u in vic_ids){
#will be faster to pre-allocate and fill in rather than rbind each time
dag_dat_all[ei:(ei+length(nbhd)-1),] = data.frame(rep(u,length(nbhd)), nbhd,
rep(tu,length(nbhd)), tvs, dists,
- weights, row.names=NULL)
+ weights, u_spawn, v_spawn, row.names=NULL)
ei = ei + length(nbhd)
}
print(proc.time()-ptm) #3.5 hours
-colnames(dag_dat_all) = c('from','to','t1','t2','dist','w1','w2','w3')
+colnames(dag_dat_all) = c('from','to','t1','t2','dist','w1','w2','w3','spawn1','spawn2')
rownames(dag_dat_all) = NULL
-dag_dat_all$spawn1 = hyp_lcc_verts$spawn.date[dag_dat_all$from]
-dag_dat_all$spawn2 = hyp_lcc_verts$spawn.date[dag_dat_all$to]
+# dag_dat_all$spawn1 = hyp_lcc_verts$spawn.date[dag_dat_all$from]
+# dag_dat_all$spawn2 = hyp_lcc_verts$spawn.date[dag_dat_all$to]
save(dag_dat_all, file='Results/dag_dat_all.RData')
write.csv(dag_dat_all, file='Results/dag_dat_all.csv')