Skip to content

Instantly share code, notes, and snippets.

@slarge
Last active February 23, 2016 16:15
Show Gist options
  • Save slarge/c4be45d9a55d762d4f56 to your computer and use it in GitHub Desktop.
Save slarge/c4be45d9a55d762d4f56 to your computer and use it in GitHub Desktop.
Squalus acanthias with getDATRAS()
# Use the devtools package (on CRAN) to get the most up to date version of rICES package (very much in the works) here:
# https://github.com/ices-dk
devtools::install_github("ICES-dk/rICES", force = TRUE)
library(rICES)
# You can get the HL, HH, or CA "EXCHANGE" data using the following function. HH is info on the haul (used to calculate a survey index)
# and HL is the length data. CA is for age info.
# You can make a loop or a function to get data from other surveys. Let it run overnight because there is a lot of data!!!
d <- getDATRAS(record = "HL",
survey="NS-IBTS",
startyear = 2010,
endyear = 2011,
quarters = 1,
parallel = TRUE,
cores = 4)
# ~1.5 minutes on my laptop
# Query species codes with this service: https://datras.ices.dk/Data_products/qryspec.aspx
# Someone with more background than I could provide a reason why both codes are still used...
squal <- d[d$SpecCodeType == "W" & # WoRMS Aphia
d$SpecCode == 105923 |
d$SpecCodeType == "T" & # TSN Code
d$SpecCode == 160617,]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment