-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpatchstat.Rmd
132 lines (110 loc) · 2.73 KB
/
patchstat.Rmd
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
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
---
title: "White top Frequency"
author: "Amanda Stahlke"
date: "12/18/2019"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
options(scipen=999)
```
```{r libraries, message=FALSE, collapse=TRUE}
# data processing
library(dplyr)
library(SDMTools)
```
```{r}
freq_plot <- read.csv("Ldraba_raw_data_frequency.csv")
head(freq_plot, 20)
```
```{r}
freq_tots <- freq_plot %>%
filter(cell_row=="Totals")
colnames(freq_tots)
dropcols <- c('date', 'recorder')
freq_tots <- freq_tots[,-which(colnames(freq_tots)==dropcols)]
freq_tots$site <- rep(1:6, each=3)
freq_tots$plot <- rep(1:3, times=6)
freq_tots
freq_tots$site.plot <- paste0(freq_tots$site, ".", freq_tots$plot)
### These were calculated in Google sheet
colnames(freq_tots)[which(colnames(freq_tots)=="X")] <- "rowsum"
freq_tots %>%
group_by(site.plot) %>%
summarise(mean(rowsum)) %>%
arrange(`mean(rowsum)`)
freq_tots %>%
group_by(site) %>%
summarise(mean(rowsum), sd(rowsum)) %>%
arrange(`mean(rowsum)`)
freq_tots %>%
# group_by(site) %>%
summarise(mean(rowsum), sd(rowsum))
```
```{r}
freq_plot %>%
filter(site==1) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
PatchStat(.,cellsize=1)
freq_plot %>%
filter(site==1) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
ClassStat(.,cellsize=1)
freq_plot %>%
filter(site==2) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
# SDMTools::PatchStat(.,cellsize=1)
ClassStat(.,cellsize=1)
freq_plot %>%
filter(site==3) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
ClassStat(.,cellsize=1)
freq_plot %>%
filter(site==4) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
ClassStat(.,cellsize=1)
freq_plot %>%
filter(site==5) %>%
dplyr::select(starts_with("col")) %>%
# as.matrix() %>%SDMTools::ConnCompLabel() %>%
ClassStat(.,cellsize=1)
freq_plot %>%
filter(site==6) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
SDMTools::ConnCompLabel() %>%
ClassStat(.,cellsize=1)
freq_plot %>%
filter(site==4 & plot==1) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
# SDMTools::ConnCompLabel() %>%
ClassStat(.,cellsize=1)
freq_plot %>%
filter(site==4 & plot==2) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
# SDMTools::ConnCompLabel() %>%
ClassStat(.,cellsize=1)
freq_plot %>%
filter(site==4 & plot==3) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
ClassStat(.,cellsize=1)
freq_plot %>%
filter(site==4 & plot==3) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
ConnCompLabel()
freq_plot %>%
filter(site==4 & plot==3) %>%
dplyr::select(starts_with("col")) %>%
as.matrix() %>%
ConnCompLabel() %>%
ClassStat(.,cellsize=1)
```