Description Usage Arguments Details Value Examples
Visualize which strata were visited in each year, and how many strata were visited in all but N years
1 2 3 4 |
X |
A trawl data.table |
reg |
region name |
gridSize |
grid size to be passed to |
append_keep_strat |
Logical, whether to add the |
prompt_strat_tol |
Logical, if in |
strat_tol |
The maximum number of unsampled years that is tolerated for any stratum before all rows corresponding to that stratum have their value in the "keep_strat" column set to FALSE |
plot |
Logical, visualize strata over time and the number of strata sampled in all but N years? |
The aim of the function is to guide the selection of which strata to exclude from analysis because they are not sampled often enough. Having fewer gaps in your data set is better, but sometimes tolerating a tiny amount of missingness can result in huge increases in data; the visualization provided by this funciton will help gauge that tradeoff.
Nothing. However, potentially modifies X, and may create a figure.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | # quick example for goa
check_strat(clean.goa[,c("year"):=list(as.integer(year))], "goa")
# a more thorough data processing example for shelf
## Not run:
# trim shelf
shelf <- trawlTrim("shelf", c.add=c("val.src", "flag"))
shelf <- shelf[
(taxLvl=="species" |taxLvl=="subspecies") &
(flag!="bad" | is.na(flag)) &
(val.src!="m3" | (!is.na(flag) & flag!="bad"))
]
# aggregate species within a haul (among individuals)
# this means taking the sum of many bio metrics
shelf <- trawlAgg(
X=shelf,
bioFun=sumna,
envFun=meanna,
bio_lvl="spp", space_lvl="haulid", time_lvl="haulid",
bioCols=c("wtcpue"),
envCols=c("btemp"),
metaCols=c("reg","common","year","datetime","stratum", "lon", "lat"),
meta.action=c("unique1")
)
# aggregate within a species within stratum
# refer to the time_lvl column from previous trawlAgg()
# can use mean for both bio and env
shelf[,stratum:=ll2strat(lon, lat)]
shelf <- trawlAgg(
X=shelf,
FUN=meanna,
bio_lvl="spp", space_lvl="stratum", time_lvl="year",
bioCols=c("wtcpue"),
envCols=c("btemp"),
metaCols=c("reg","common", "lon", "lat"),
meta.action=c("FUN"),
metaFun=list(reg=unique, common=unique, lon=mean, lat=mean)
)
setnames(shelf, "time_lvl", "year")
shelf[,year:=as.integer(as.character(year))]
setcolorder(shelf, c(
"reg", "year", "stratum", "lon", "lat",
"spp", "common", "btemp", "wtcpue", "nAgg"
))
setkey(shelf, reg, year, stratum, spp, common)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.