2.1 Response variables

Below are the instructions and code for getting data from wildtrax that was developed by Elly Knight. The original rScripts are available here.

See the wildRtrax article here for more details on authentication: https://abbiodiversity.github.io/wildRtrax/articles/authenticating-into-wt.html

2.1.1 Get data from WildTrax

  1. Load packages
#install.packages("remotes")
#remotes::install_github("ABbiodiversity/wildRtrax")
library(wildRtrax)
library(tidyverse)
  1. Login to WildTrax

NOTE: Edit the ‘loginexample.R’ script to include your WildTrax login details and rename to ‘login.R’. DO NOT PUSH YOUR LOGIN TO GITHUB

config <- "login.R"
source(config)

wt_auth()
  1. Get list of projects from WildTrax
projects <- wt_get_download_summary(sensor_id = 'ARU')
  1. Download RUGR dataset summary report
dat.rugr <- wt_download_report(project_id = 1321, sensor_id = 'ARU', weather_cols = T, report = "summary")
  1. Download RUGR task report to check coordinate buffering
task.rugr <- wt_download_report(project_id = 1321, sensor_id = 'ARU', report = "task")
table(task.rugr$buffer)
  1. Download multiple projects
projects.test <- sample_n(projects, 3)

dat.list <- list()
error.log <- data.frame()
for(i in 1:nrow(projects.test)){
  
  dat.list[[i]] <- try(wt_download_report(project_id = projects.test$project_id[i], sensor_id = projects.test$sensorId[i], weather_cols = F, report = "summary"))
  
  print(paste0("Finished dataset ", projects.test$project[i], " : ", i, " of ", nrow(projects.test), " projects"))
  
}

dat.test <- do.call(rbind, dat.list)
  1. Save with metadata & timestamp
save(dat, projects.test, error.log, file=paste0("Data/wildtrax_raw_", Sys.Date(), ".Rdata"))