-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathRinsp_examples.R
53 lines (36 loc) · 1.31 KB
/
Rinsp_examples.R
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
##########
#Library
##########
library(RInSp)
library(vegan)
################################
#Discrete - stickleback example
################################
data(Stickleback)
#Import dataset
Site_A = import.RInSp(Stickleback, row.names = 1, info.cols = c(2:13),subset.rows = c("Site", "A"))
WT = WTdMC(Site_A, replicates = 999)
SiteA_E = Emc(Site_A, popd.type = "average", replicates = 999) #Evalue
Null.data = MCp.RInSp(Site_A, replicates = 999)
null.d.NODF = c()
for (i in 1:(999 + 1)) {
null.d.NODF = c(null.d.NODF, NODF(import.RInSp(Null.data[ , , i], print.messages=FALSE), print.results=FALSE)$NODF)}
null.d.NODF[1]
summary(null.d.NODF)
hist(null.d.NODF)
abline(v=null.d.NODF[1])
###########################
#Continuous trout example
##########################
data(Trout)
#import dataset
TroutRIS = import.RInSp(Trout, col.header=TRUE, row.names=1, info.cols=c(1:6), data.type="double")
#specialisation 0 is strong specialisation and 1 is generalisation
results <- WTcMC(TroutRIS, replicates = 999)
#weighted specialisation
results= WTcMC(TroutRIS, weight="N_items", replicates=999)
#E index 0 is all ind same resources in same proportion, 1 every ind relies on different resources
TroutE = Eindex(TroutRIS, index = "saramaki", jackknife = TRUE)
decomp = Hier2L(TroutRIS, factor=1)
#histogram
sumMC.RInSp(results)