Description Usage Arguments Value Examples
The function resamples the 'lfq' data by sample date. Sampling is done in a non-parametric manner that follows the relative frequencies of the original data, allowing for individual counts to be selected more than once (i.e. 'replace = TRUE' in sample), and resulting in total counts (by sample) equal to the original data.
1 | lfqResample(lfq)
|
lfq |
a length frequency object of the class 'lfq'. |
a resampled version of the 'lfq' class dataset.
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 | # load data
library(TropFishR)
data(alba)
# resample lfq data
alba_p <- lfqResample(alba)
# side-by-side plot
op <- par( mfcol = c(2,1), mar=c(4,4,2,1) )
plot(lfqRestructure(alba), Fname="rcounts")
mtext("original", side=3, line=0.25)
plot(lfqRestructure(alba_p), Fname="rcounts")
mtext("resampled", side=3, line=0.25)
par(op)
# relative difference
alba_diff <- alba
alba_diff$delta <- (alba$catch - alba_p$catch) / alba$catch
alba_diff$delta[is.na(alba_diff$delta)] <- 0
plot(alba, Fname = "catch", image.col = NA, hist.col=NA, draw = FALSE)
with(alba_diff, image(
x=dates, y=midLengths, z=t(delta),
zlim = max(abs(delta))*c(-1,1), col=rev(cm.colors(21)),
add=TRUE
))
with(alba_diff, contour(x=dates, y=midLengths, z=t(delta), add=TRUE))
box()
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.