aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKen Kellner <ken@kenkellner.com>2019-02-14 16:03:26 (GMT)
committerKen Kellner <ken@kenkellner.com>2019-02-14 16:03:26 (GMT)
commit7239a1ad32022c4ba81e3071786117ea39df6652 (patch)
tree3bc6a83f7ad4d6a5e65d53683ac9892945156ca9
parent95bc79786d33981b107f0777a0cf9e120fd5780d (diff)
Complete fixing appendix S2
-rw-r--r--supplements/appendixS2.Rmd152
-rw-r--r--supplements/appendixS2_old.Rmd254
2 files changed, 148 insertions, 258 deletions
diff --git a/supplements/appendixS2.Rmd b/supplements/appendixS2.Rmd
index e35b727..25fd931 100644
--- a/supplements/appendixS2.Rmd
+++ b/supplements/appendixS2.Rmd
@@ -60,7 +60,7 @@ suppressMessages(library(tidyverse))
```{r,echo=F}
inp <- read.csv(outpath('tableS2_lvl1/mam_lvl1.csv'),header=T)
-inp <- cbind(inp[,1],round(inp[,c(2,4,5,6)],2))
+inp <- cbind(inp[,1],round(inp[,c(2,4,6,7)],2))
names(inp) <- c('Parameter','Mean','2.5%','97.5%','f')
inp_out <- inp %>%
@@ -85,7 +85,7 @@ knitr::kable(inp_out)
```{r,echo=F}
inp <- read.csv(outpath('tableS2_lvl1/bat_lvl1.csv'),header=T)
-inp <- cbind(inp[,1],round(inp[,c(2,4,5,6)],2))
+inp <- cbind(inp[,1],round(inp[,c(2,4,6,7)],2))
names(inp) <- c('Parameter','Mean','2.5%','97.5%','f')
inp_out <- inp %>%
@@ -110,7 +110,7 @@ knitr::kable(inp_out)
```{r,echo=F}
inp <- read.csv(outpath('tableS2_lvl1/bird_lvl1.csv'),header=T)
-inp <- cbind(inp[,1],round(inp[,c(2,4,5,6)],2))
+inp <- cbind(inp[,1],round(inp[,c(2,4,6,7)],2))
names(inp) <- c('Parameter','Mean','2.5%','97.5%','f')
inp_out <- inp %>%
@@ -137,7 +137,7 @@ knitr::kable(inp_out)
```{r,echo=F}
inp <- read.csv(outpath('tableS2_lvl1/turtle_lvl1.csv'),header=T)
-inp <- cbind(inp[,1],round(inp[,c(2,4,5,6)],2))
+inp <- cbind(inp[,1],round(inp[,c(2,4,6,7)],2))
names(inp) <- c('Parameter','Mean','2.5%','97.5%','f')
inp_out <- inp %>%
@@ -155,3 +155,147 @@ inp_out$pn_raw <- pn_raw
inp_out <- inp_out %>% arrange(pn_raw,Index) %>% select(-pn_raw,-Index)
knitr::kable(inp_out)
```
+
+# Level-2 Analysis Output (Landscape Scale)
+
+```{r,echo=F,message=F,warning=F}
+
+format_lvl2 <- function(file,nspecies){
+ inp <- read.csv(outpath(paste('tableS3_lvl2/',file,sep='')),header=T)
+ inp <- cbind(inp[,1],round(inp[,c(2,4,6,7)],2))
+ names(inp) <- c('Parameter','Mean','2.5%','97.5%','f')
+
+ inp_out <- inp %>%
+ filter(!str_detect(Parameter,'resid'),!str_detect(Parameter,'deviance'))
+
+ pn_raw <- c('Occurrence: Intercept',
+ 'Response to modification: Intercept',
+ 'Occurrence: Niche breadth effect',
+ rep('Occurrence: Modification effect',nspecies),
+ 'Response to modification: Niche breadth effect')
+ indices <- c(1,1,1,1:nspecies,1)
+ param_names <- pn_raw
+ param_names[4:(length(pn_raw)-1)] <- paste(pn_raw[4:(length(pn_raw)-1)],'[',
+ 1:nspecies,']',sep='')
+
+ if(str_detect(file,'P')){
+ pn_raw <- c(pn_raw,"Response to modification: Pagel's lambda")
+ param_names <- c(param_names,"Response to modification: Pagel's lambda")
+ indices <- c(indices,1)
+ }
+
+ inp_out$pn_raw <- pn_raw
+ inp_out$indices <- indices
+ inp_out$Parameter <- param_names
+
+ inp_out <- inp_out %>%
+ arrange(pn_raw,indices) %>%
+ select(-pn_raw,-indices)
+
+ knitr::kable(inp_out)
+}
+```
+
+## Small Mammals
+
+**Table S2.10**. Output from model NN (no imperfect detection, no phylogenetic relationships) for small mammals. See Table S2.2 for species indices.
+
+```{r,echo=F}
+format_lvl2('mam_NN.csv',11)
+```
+
+**Table S2.11**. Output from model IN (imperfect detection, no phylogenetic relationships) for small mammals. See Table S2.2 for species indices.
+
+```{r,echo=F}
+format_lvl2('mam_IN.csv',11)
+```
+
+**Table S2.12**. Output from model NP (no imperfect detection, phylogenetic relationships) for small mammals. See Table S2.2 for species indices.
+
+```{r,echo=F}
+format_lvl2('mam_NP.csv',11)
+```
+
+**Table S2.13**. Output from model IP (imperfect detection, phylogenetic relationships) for small mammals. See Table S2.2 for species indices.
+
+```{r,echo=F}
+format_lvl2('mam_IP.csv',11)
+```
+
+## Bats
+
+**Table S2.14**. Output from model NN (no imperfect detection, no phylogenetic relationships) for bats. See Table S2.3 for species indices.
+
+```{r,echo=F}
+format_lvl2('bat_NN.csv',7)
+```
+
+**Table S2.15**. Output from model IN (imperfect detection, no phylogenetic relationships) for bats. See Table S2.3 for species indices.
+
+```{r,echo=F}
+format_lvl2('bat_IN.csv',7)
+```
+
+**Table S2.16**. Output from model NP (no imperfect detection, phylogenetic relationships) for bats. See Table S2.3 for species indices.
+
+```{r,echo=F}
+format_lvl2('bat_NP.csv',7)
+```
+
+**Table S2.17**. Output from model IP (imperfect detection, phylogenetic relationships) for bats. See Table S2.3 for species indices.
+
+```{r,echo=F}
+format_lvl2('bat_IP.csv',7)
+```
+
+## Birds
+
+**Table S2.18**. Output from model NN (no imperfect detection, no phylogenetic relationships) for birds. See Table S2.4 for species indices.
+
+```{r,echo=F}
+format_lvl2('bird_NN.csv',39)
+```
+
+**Table S2.19**. Output from model IN (imperfect detection, no phylogenetic relationships) for birds. See Table S2.4 for species indices.
+
+```{r,echo=F}
+format_lvl2('bird_IN.csv',39)
+```
+
+**Table S2.20**. Output from model NP (no imperfect detection, phylogenetic relationships) for birds. See Table S2.4 for species indices.
+
+```{r,echo=F}
+format_lvl2('bird_NP.csv',39)
+```
+
+**Table S2.21**. Output from model IP (imperfect detection, phylogenetic relationships) for birds. See Table S2.4 for species indices.
+
+```{r,echo=F}
+format_lvl2('bird_IP.csv',39)
+```
+
+## Aquatic Turtles
+
+**Table S2.22**. Output from model NN (no imperfect detection, no phylogenetic relationships) for turtles. See Table S2.5 for species indices.
+
+```{r,echo=F}
+format_lvl2('turtle_NN.csv',8)
+```
+
+**Table S2.23**. Output from model IN (imperfect detection, no phylogenetic relationships) for turtles. See Table S2.5 for species indices.
+
+```{r,echo=F}
+format_lvl2('turtle_IN.csv',8)
+```
+
+**Table S2.24**. Output from model NP (no imperfect detection, phylogenetic relationships) for turtles. See Table S2.5 for species indices.
+
+```{r,echo=F}
+format_lvl2('turtle_NP.csv',8)
+```
+
+**Table S2.25**. Output from model IP (imperfect detection, phylogenetic relationships) for turtles. See Table S2.5 for species indices.
+
+```{r,echo=F}
+format_lvl2('turtle_IP.csv',8)
+```
diff --git a/supplements/appendixS2_old.Rmd b/supplements/appendixS2_old.Rmd
deleted file mode 100644
index 7e04f7d..0000000
--- a/supplements/appendixS2_old.Rmd
+++ /dev/null
@@ -1,254 +0,0 @@
----
-title: "Appendix S2"
-output: pdf_document
----
-
-Supplemental information for:
-
-Kellner, K. F., Duchamp, J. E., & Swihart R. K. Niche breadth and vertebrate sensitivity to habitat modification: signals from multiple taxa across replicated landscapes. Diversity & Distributions.
-
-```{r, echo=FALSE, warning=FALSE, message=FALSE}
-setwd('..')
-source('.Rprofile')
-```
-
-# Species Index
-
-**Table S2.2**. Mammal species included in analyses and matching index values.
-
-```{r,echo=F}
-mam.sp <- read.csv(outpath('tableS2_lvl1/mam_species.csv'),header=T)
-names(mam.sp) <- c('Index','Code','Species Name')
-knitr::kable(mam.sp)
-```
-
-**Table S2.3**. Bat species included in analyses and matching index values.
-
-```{r,echo=F}
-bats.sp <- read.csv(outpath('tableS2_lvl1/bat_species.csv'),header=T)
-names(bats.sp) <- c('Index','Code','Species Name')
-knitr::kable(bats.sp)
-```
-
-\pagebreak
-
-**Table S2.4**. Bird species included in analyses and matching index values.
-
-```{r,echo=F}
-bird.sp <- read.csv(outpath('tableS2_lvl1/bird_species.csv'),header=T)
-names(bird.sp) <- c('Index','Code','Species Name')
-knitr::kable(bird.sp)
-```
-
-\pagebreak
-
-**Table S2.5**. Aquatic turtle species included in analyses and matching index values.
-
-```{r,echo=F}
-turtle.sp <- read.csv(outpath('tableS2_lvl1/turtle_species.csv'),header=T)
-names(turtle.sp) <- c('Index','Code','Species Name')
-knitr::kable(turtle.sp)
-```
-
-# Level-1 Analysis Output (Individual Plot Scale)
-
-```{r,echo=F}
-suppressMessages(library(tidyverse))
-rename_params <- function(x){
- ip <- as.character(x$Parameter)
- op <- case_when(str_detect(ip,'pmean') ~ str_replace(ip,'pmean','Mean detect (p)'),
- str_detect(ip,'psimean') ~ str_replace(ip,'psimean','Mean occ (psi)'),
- str_detect(ip,'beta.date') ~ str_replace(ip,'beta.date','Date effect on p'))
-}
-```
-
-
-**Table S2.6**. Output from multi-species plot-level occupancy model for small mammals. See Table S2.2 for species indices.
-
-```{r,echo=F}
-inp <- read.csv(outpath('tableS2_lvl1/mam_lvl1.csv'),header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.7**. Output from multi-species plot-level occupancy model for bats. See Table S2.3 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl1/bat_lvl1.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.8**. Output from multi-species plot-level occupancy model for birds. See Table S2.4 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl1/bird_lvl1.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.9**. Output from multi-species plot-level occupancy model for aquatic turtles. See Table S2.5 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl1/turtle_lvl1.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-# Level-2 Analysis Output (Landscape Scale)
-
-## Small Mammals
-
-**Table S2.10**. Output from model NN (no imperfect detection, no phylogenetic relationships) for small mammals. See Table S2.2 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/mam_NN.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.11**. Output from model IN (imperfect detection, no phylogenetic relationships) for small mammals. See Table S2.2 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/mam_IN.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.12**. Output from model NP (no imperfect detection, phylogenetic relationships) for small mammals. See Table S2.2 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/mam_NP.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.13**. Output from model IP (imperfect detection, phylogenetic relationships) for small mammals. See Table S2.2 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/mam_IP.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-## Bats
-
-**Table S2.14**. Output from model NN (no imperfect detection, no phylogenetic relationships) for bats. See Table S2.3 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/bat_NN.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.15**. Output from model IN (imperfect detection, no phylogenetic relationships) for bats. See Table S2.3 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/bat_IN.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.16**. Output from model NP (no imperfect detection, phylogenetic relationships) for bats. See Table S2.3 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/bat_NP.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.17**. Output from model IP (imperfect detection, phylogenetic relationships) for bats. See Table S2.3 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/bat_IP.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-## Birds
-
-**Table S2.18**. Output from model NN (no imperfect detection, no phylogenetic relationships) for birds. See Table S2.4 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/bird_NN.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.19**. Output from model IN (imperfect detection, no phylogenetic relationships) for birds. See Table S2.4 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/bird_IN.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.20**. Output from model NP (no imperfect detection, phylogenetic relationships) for birds. See Table S2.4 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/bird_NP.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.21**. Output from model IP (imperfect detection, phylogenetic relationships) for birds. See Table S2.4 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/bird_IP.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-## Aquatic Turtles
-
-**Table S2.22**. Output from model NN (no imperfect detection, no phylogenetic relationships) for turtles. See Table S2.5 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/turtle_NN.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.23**. Output from model IN (imperfect detection, no phylogenetic relationships) for turtles. See Table S2.5 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/turtle_IN.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.24**. Output from model NP (no imperfect detection, phylogenetic relationships) for turtles. See Table S2.5 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/turtle_NP.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```
-
-**Table S2.25**. Output from model IP (imperfect detection, phylogenetic relationships) for turtles. See Table S2.5 for species indices.
-
-```{r,echo=F}
-inp <- read.csv('lvl2/turtle_IP.csv',header=T)
-inp <- cbind(inp[,1],round(inp[,2:7],2))
-names(inp) <- c('Parameter','Mean','SD','2.5%','50%','97.5%','f')
-knitr::kable(inp)
-```