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
- Load packages
#install.packages("remotes")
#remotes::install_github("ABbiodiversity/wildRtrax")
library(wildRtrax)
library(tidyverse)
- 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
<- "login.R"
config source(config)
wt_auth()
- Get list of projects from WildTrax
<- wt_get_download_summary(sensor_id = 'ARU') projects
- Download RUGR dataset summary report
<- wt_download_report(project_id = 1321, sensor_id = 'ARU', weather_cols = T, report = "summary") dat.rugr
- Download RUGR task report to check coordinate buffering
<- wt_download_report(project_id = 1321, sensor_id = 'ARU', report = "task")
task.rugr table(task.rugr$buffer)
- Download multiple projects
<- sample_n(projects, 3)
projects.test
<- list()
dat.list <- data.frame()
error.log for(i in 1:nrow(projects.test)){
<- try(wt_download_report(project_id = projects.test$project_id[i], sensor_id = projects.test$sensorId[i], weather_cols = F, report = "summary"))
dat.list[[i]]
print(paste0("Finished dataset ", projects.test$project[i], " : ", i, " of ", nrow(projects.test), " projects"))
}
<- do.call(rbind, dat.list) dat.test
- Save with metadata & timestamp
save(dat, projects.test, error.log, file=paste0("Data/wildtrax_raw_", Sys.Date(), ".Rdata"))