-
Notifications
You must be signed in to change notification settings - Fork 0
/
.Rhistory
86 lines (86 loc) · 2.71 KB
/
.Rhistory
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
install.packages("data.table")
library("data.table", lib.loc="/Library/Frameworks/R.framework/Versions/3.0/Resources/library")
detach("package:data.table", unload=TRUE)
getwd()
setwd("/Volumes/Macintosh HD 2/Projects/ecological/ED")
source("computeStats.R")
plot.sync.inter <- function(folder, output.file="sync_Inter.pdf"){
f <- list.files(folder)
theFile <- output.file
pdf(file = theFile)
for (fl in f){
print(fl)
load(paste0(folder,"/",fl))
specs <- model.spec.by.name(fl)
reg.map <- to.regional(no.species = strtoi(specs[1]), no.webs = strtoi(specs[2]))
result <- sapply(1:dim(abundances)[3], function(i) inter.sync(abundances = abundances[2500:3001,2:dim(abundances)[2],i],reg.map = reg.map))
result <- t(result)
d <- c(1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 0.001, .01, .02, .03, .04) #dispersal rates
matplot(d, result, t="l", lty=1, cex = d, xlab = "d", ylab="Interspecies sunchrony")
title(main = paste0("Species=",specs[1], ", Patches=", specs[2], ", Connectance=",specs[3], ", V",specs[4]))
}
dev.off()
}
plot.sync.inter <- function(folder, output.file="sync_Inter.pdf"){
f <- list.files(folder)
theFile <- output.file
pdf(file = theFile)
for (fl in f){
print(fl)
load(paste0(folder,"/",fl))
specs <- model.spec.by.name(fl)
reg.map <- to.regional(no.species = strtoi(specs[1]), no.webs = strtoi(specs[2]))
result <- sapply(1:dim(abundances)[3], function(i) inter.sync(abundances = abundances[2500:3001,2:dim(abundances)[2],i],reg.map = reg.map))
result <- t(result)
d <- c(1e-8, 1e-7, 1e-6, 1e-5, 1e-4, 0.001, .01, .02, .03, .04) #dispersal rates
matplot(d, result, t="l", lty=1, cex = d, xlab = "d", ylab="Interspecies sunchrony")
title(main = paste0("Species=",specs[1], ", Patches=", specs[2], ", Connectance=",specs[3], ", V",specs[4]))
}
dev.off()
}
plot.sync.inter("Output")
source('/Volumes/Macintosh HD 2/Projects/ecological/ED/plots.R')
plot.sync.inter("Output")
load("Output/out_S5C05n_V1_P2.rda")
fl <- "out_S5C05n_V1_P2.rda"
specs <- model.spec.by.name(fl)
reg.map <- to.regional(no.species = strtoi(specs[1]), no.webs = strtoi(specs[2]))
specs
reg.map
dim(abundances)
result <- sapply(1:dim(abundances)[3], function(i) intra.sync(abundances = abundances[2500:3001,2:dim(abundances)[2],i],reg.map = reg.map))
result
result [1,1]
result [2,1]
result[,2]
result[,3]
result[,4]
result[,5]
result[,5]$W
result[,5][1]
result[,5][1]$W
(result[,5][1])$W
(result[,5][1])$w
(result[,5][1])$[1]
(result[,5][1])[1]
(result[,5][1])[1,]
(result[,5][1])
a <- result[,1]
class(a)
a[[1]][1]
result[[1]]
result[[2]]
result[[20]]
result[[21]]
result[[1]]$W
a <- result[[1]]
a
a[1]
for (i in 1:10){}
for (i in 1:10){print(result[,i])}
for (i in 1:10){}
for (i in 1:10){print(i), print(result[,i])}
for (i in 1:10){print(i); print(result[,i])}
result
length(result)
result[,1]