Quick analysis of “Camera_Master_2012-2015.csv”, the most current camera trap file in the dropbox dump. Despite file name, some 2016 data is here, but no 2017. There is a folder of raw images from 2017…

Updated: found another file with images going back to to 2010…

# ct <- read_csv("data/Dropbox_scrape20180209/Camera_Trap_Sheets_2012-2016/Camera_Master_2012-2015.csv")

## one file...
ct <- read_csv("data/Select_files/camera_traps/Camera_Master_2012-2015.csv")

## another file...
ct10 <- read_excel("data/Select_files/camera_traps/CameraMaster2010_2015.xlsx")
ct.cl <- ct %>% 
  clean_names() 

ct10.cl <- ct10 %>%
  clean_names()

# extract date, parse into month and year
ct.cl <- ct.cl %>% 
  dplyr::select(image_name,site,location, serial_number) %>% 
  separate(image_name, into = c('dt', 'dtx2'), sep = 10,remove = FALSE) %>% 
  mutate(dt= anydate(dt)) %>% 
  mutate(mo = lubridate::month(dt,label = TRUE)) %>% 
  mutate(yr = year(dt))


ct10.cl  <- ct10.cl %>% 
  dplyr::select(image_name,site,location, serial_number) %>% 
  separate(image_name, into = c('dt', 'dtx2'), sep = 10,remove = FALSE) %>% 
  mutate(dt= anydate(dt)) %>% 
  mutate(mo = lubridate::month(dt,label = TRUE)) %>% 
  mutate(yr = year(dt))

Distinct serial numbers

# distinct serial numbers
ct.cl.sn <- ct.cl %>% 
  distinct(serial_number) %>%
  as.data.frame() %>% 
  mutate(obj = 'ct.cl.sn')

ct10.cl.sn <- ct10.cl %>% 
  distinct(serial_number) %>%
  as.data.frame() %>%
  mutate(obj = 'ct10.cl.sn')

combined <- bind_rows(ct.cl.sn, ct10.cl.sn)

combined %>% 
  group_by(serial_number) %>% 
  summarize(n = n()) %>% 
  datatable(rownames = FALSE, caption = "Records with n=1 are the new serial #'s brought in with the 2010 data...")

by adding bringin in “CameraMaster2010_2015.xlsx”, we gained two more cameras for a total of 15 unique serial numbers

Tally of records by location, serial # and yr: “Camera_Master_2012-2015.csv”

# tally of records by location, serial # and yr
ct.cl %>% 
  group_by(location, serial_number, yr) %>% 
  tally() %>% 
  DT::datatable()

Tally of records by location, serial # and yr: “CameraMaster2010_2015.xlsx”

ct10.cl %>% 
  group_by(location, serial_number, yr) %>% 
  tally() %>% 
  DT::datatable()

combine the two files and find the distinct records across file name, location, and serial number

combo.all <- bind_rows(ct.cl,ct10.cl)


combo.all <- combo.all %>%
  distinct(image_name, location, serial_number) %>% 
  separate(image_name, into = c('dt', 'dtx2'), sep = 10,remove = FALSE) %>% 
  mutate(dt= anydate(dt)) %>% 
  mutate(mo = lubridate::month(dt,label = TRUE)) %>% 
  mutate(yr = year(dt)) %>% 
  select(-dtx2)

combo.all %>% names()
## [1] "image_name"    "dt"            "location"      "serial_number"
## [5] "mo"            "yr"
## prep for calendar heatmap
combo.all <- combo.all %>%
  mutate(wk = week(dt)) %>% 
  mutate(dow = lubridate::wday(dt,label = TRUE)) %>% 
  mutate(wday = lubridate::wday(dt,label = FALSE)) %>% 
  mutate(mday = mday(dt)) %>%
  mutate(mweek = ceiling(mday / 7)) # week of month -- note use of ceiling!

## there is an issue of Locations being inconsistently coded...
# See "Lost Creek" and "LostC", also "Elk1" and "ELK1"
# combo.all %>% 
#   distinct(location) %>% 
#   arrange(location) %>% 
#   knitr::kable()

## correct this...
combo.all <- combo.all %>% 
  mutate(location = if_else(location == "Lost Creek","LostC",location)) %>% 
  mutate(location = if_else(location == "ELK1","Elk1",location))

calendar heat maps

Location + serial number

Each plot is for an individual camera and location combination. The same serial number may appear in >1 location if moved. Fill corresponds to the number of images (as indicated by an entry in the “file name” field)