library(lubridate)
library(ggplot2)
library(stringr)exif_data = read.csv("~/Dropbox/brockwell_exif/RoseRinged.csv")# Extract sitenames (get the name of the directory of the directory containing the file)
# not perfect - some sites still labelled at DCIM
exif_data$site = basename(dirname(dirname(exif_data$SourceFile)))
# Fix those sites, by getting the dirname of those (they have an extra directory)
exif_data$site[exif_data$site == "DCIM"] = basename(dirname(dirname(dirname(exif_data$SourceFile[exif_data$site == "DCIM"]))))
# How many images per site
table(exif_data$site)##
## 01 02 03 04 05 06 07 08 09 10 11 12 13
## 291 4788 1953 8216 6263 8934 731 3477 1573 1685 7990 2140 26253
## 14 15 16 17 18 19 20 21 22 23 24 25 26
## 799 5411 16984 2394 2681 10434 18430 4616 4002 4475 27804 33363 17414
## 28 29 30
## 17723 29470 1139
ggplot(exif_data, aes(x = factor(site))) + geom_bar() + theme_minimal() + labs(title = "Images per site", subtitle = "Brockwell Park")# Get a datetime value
exif_data$datetime = as.POSIXct(exif_data$DateTimeOriginal, format = "%Y:%m:%d %H:%M:%S")
# Get day (of year) number
exif_data$day = yday(exif_data$datetime)
# How many images per day (day is 'day of year' - note 33 images on January 1st where clock wasn't set)
table(exif_data$day)##
## 1 114 115 116 117 118 119 120 121 122 123 124 125
## 33 1286 528 1047 343 10119 6725 11087 12236 7688 4760 10996 5100
## 126 127 128 129 130 131 132 133 134 135 136
## 12583 12279 7146 6799 14285 17696 38520 28718 32624 18008 10824
ggplot(exif_data, aes(x = factor(day))) + geom_bar() + theme_minimal() + labs(title = "Images per day", subtitle = "Brockwell Park")
## How many images per site, per day
# How many images per site/day
table(exif_data$site, exif_data$day)##
## 1 114 115 116 117 118 119 120 121 122 123 124
## 01 0 0 0 0 0 103 11 2 5 14 14 81
## 02 31 0 0 0 0 172 0 3 0 3 4 33
## 03 0 0 0 0 0 272 42 15 36 48 61 68
## 04 0 0 0 0 0 370 314 1239 259 179 102 301
## 05 0 0 0 0 0 185 278 288 223 124 65 303
## 06 0 0 0 0 0 1441 279 201 181 386 528 308
## 07 0 119 67 9 36 10 46 142 12 12 3 4
## 08 0 0 0 0 0 164 66 51 138 74 211 41
## 09 0 0 0 0 0 179 165 125 97 107 36 148
## 10 0 0 0 0 0 275 72 94 75 20 37 363
## 11 0 0 0 0 0 331 387 512 501 411 357 540
## 12 0 150 45 340 25 54 95 102 65 63 49 46
## 13 0 0 0 0 0 1439 625 743 750 720 578 4142
## 14 0 0 0 0 0 136 4 4 1 6 0 48
## 15 0 0 0 0 0 300 368 452 296 135 154 224
## 16 0 422 192 326 245 297 241 301 221 267 90 276
## 17 2 135 2 8 15 4 5 377 3 5 2 389
## 18 0 0 0 0 0 122 103 98 160 150 96 100
## 19 0 0 0 0 0 127 66 1383 299 247 89 1488
## 20 0 0 0 0 0 94 7 12 21 10 10 184
## 21 0 0 0 0 0 121 116 76 58 70 44 6
## 22 0 332 200 200 14 62 56 114 106 62 242 38
## 23 0 128 22 164 8 70 159 685 106 60 23 71
## 24 0 0 0 0 0 547 818 1012 875 704 712 673
## 25 0 0 0 0 0 1724 1961 1923 1925 1403 1206 782
## 26 0 0 0 0 0 234 61 101 71 34 36 43
## 28 0 0 0 0 0 299 121 28 3 37 11 229
## 29 0 0 0 0 0 418 234 956 5735 2292 0 0
## 30 0 0 0 0 0 569 25 48 14 45 0 67
##
## 125 126 127 128 129 130 131 132 133 134 135 136
## 01 26 7 28 0 0 0 0 0 0 0 0 0
## 02 0 8 44 11 4 150 49 87 254 2538 566 831
## 03 90 34 104 80 36 85 96 142 44 96 105 499
## 04 215 271 252 98 77 246 257 525 854 446 1760 451
## 05 195 80 269 119 160 156 98 305 300 993 728 1394
## 06 853 255 246 360 80 90 187 435 285 998 224 1597
## 07 6 6 46 8 14 16 31 20 9 30 17 68
## 08 215 151 134 41 48 144 103 110 114 244 63 1365
## 09 68 25 53 22 36 74 35 105 29 28 21 220
## 10 81 46 89 44 44 89 33 107 44 35 34 103
## 11 547 923 694 47 191 190 279 641 316 480 443 200
## 12 33 57 78 27 17 64 51 80 67 151 137 344
## 13 473 0 168 327 324 826 3285 4196 1611 2851 1941 1254
## 14 6 0 36 6 9 3 0 7 26 25 2 480
## 15 298 366 407 97 103 145 204 456 304 636 251 214
## 16 320 359 315 140 164 246 3041 2002 6497 1022 0 0
## 17 22 59 72 18 1 27 95 880 273 0 0 0
## 18 144 305 204 153 165 170 129 99 94 84 123 182
## 19 157 1589 557 45 66 116 848 2076 174 904 115 88
## 20 102 31 44 22 0 55 198 2075 4050 4199 7316 0
## 21 93 127 72 44 46 35 21 226 455 1105 1513 388
## 22 110 296 150 342 66 160 85 318 177 278 326 268
## 23 86 81 209 38 17 55 244 675 353 424 379 417
## 24 859 1095 830 677 686 1018 1640 13694 1963 0 0 0
## 25 0 0 864 1865 2059 2153 4153 5516 3884 1945 0 0
## 26 76 691 667 239 294 828 395 2333 4125 7186 0 0
## 28 20 12 2476 804 276 1164 314 1403 2396 5851 1927 352
## 29 0 5704 3139 1434 1810 5935 1813 0 0 0 0 0
## 30 5 5 32 38 6 45 12 7 20 75 17 109
t = table(site = exif_data$site, day = exif_data$day)
ggplot(data.frame(t), aes(x = factor(site), y = factor(day), fill = Freq)) +
geom_tile(colour = "white") +
geom_text(aes(label = sprintf("%1.0f", Freq)), color = "white", vjust = 1, size = 2) +
theme_minimal() + labs(title = "Images per site, per day", subtitle = "Brockwell Park")fox_data = subset(exif_data, str_detect(Keywords, "Fox"))
t_fox = table(site = fox_data$site, day = fox_data$day)
ggplot(data.frame(t_fox), aes(x = factor(site), y = factor(day), fill = Freq)) +
geom_tile(colour = "white") +
geom_text(aes(label = sprintf("%1.0f", Freq)), color = "white", vjust = 1, size = 2) +
theme_minimal() + labs(title = "Fox images per site, per day", subtitle = "Brockwell Park")