-
Notifications
You must be signed in to change notification settings - Fork 2
Use trawlData
Using trawlData
is really simple. Just remember that the main point of the package is to have standardized data sets available to you, but to not limit what you can do with them. Thus, you can almost forget about all the functions, and just remember that 2 simple categories of data sets:
- raw.__
- clean.__
Where the __
represents a region name. Regions include
ai | Aleutian Islands |
ebs | Eastern Bering Sea |
gmex | Gulf of Mexico |
goa | Gulf of Alaska |
newf | Newfoundland |
neus | Northeast US |
sa | 'South Atlantic' (Southeast US) |
sgulf | Southern Gulf of St. Lawrence |
shelf | Scotian Shelf |
wcann | West Coast US (annual survey) |
wctri | West Coast US (triennial survey) |
There are also data sets for species taxonomy (spp.key
), gridded depth (depth
), gridded surface temperatures (sst
, sst.ann
, sst.mu
), gridded bottom temperatures (soda
, soda.annMax
, soda.annMean
, soda.annMean.mu
).
Currently, some plotting functions are also being developed. A fun one right now is to plot a picture of a species given it's scientific name ... see ?sppImg
!
Note: There is currently a problem with the function to read in the raw data when using the latest version of data.table
; if you want this functionality, please do
remove.packages("data.table")
library(devtools)
install_version("data.table", "1.9.4")
Below is a quick tour of some of the functions and data sets in the package:
# load package
library(trawlData)
# both raw & clean data + taxonomy already in workspace
data(raw.newf) # raw Newfoundland
data(clean.ebs) # clean Eastern Berring Sea
data(spp.key) # the species key
# check documentation
?raw.sa
?clean.wctri
# easy function to read in from source data
my.goa <- read.trawl(reg="goa") # same as raw.goa
# functions for cleaning raw data
# a specific order for calling these functions!
clean.names(my.goa, reg="goa") # note it affects my.goa directly!
clean.format(my.goa, reg="goa")
clean.columns(my.goa, reg="goa")
my.goa <- clean.tax(my.goa, reg="goa") # only clean.__ function that doesn't change data.table in place!
clean.trimRow(my.goa, reg="goa") # doesn't drop rows, just adds suggestive keep.row column
# somewhat confusingly, clean.trimCol actually
# reduces information in your data set!
# (it drops columns)
skinny.goa <- copy(clean.goa)
clean.trimCol(skinny.goa, reg="goa")
# these functions are documented
?clean.trimCol # you will see the options for which columns to keep (or not)!
# check which data sets are available
data(package="trawlData")