eco.mem: Subset the slots of bsm objects

Description Usage Arguments Examples

Description

bsm objects, depending on the eco.mem argument used when they were fitted using the brokenstick function, can contain numerous slots (detailed in brokenstick) keeping information about the high sampling frequency data. These information are usefull to get accurate computations in numerous cases but need to be ignored in order to mimic abstracted dive profiles such as those obtained by CTD-SRDL tags. This function is a utility that allows to ignore these high sampling fequency information.

Usage

1
eco.mem(x, n = 4, type = c("ignore", "delete", "reset"))

Arguments

x

a bsm object or a list of bsm objects.

n

set the number of slot to ignore as the eco.mem argument in the brokenstick function. The default n = 4 returns abstracted dive profiles as if they were obtained from CTD-SRDL tags.

type

A character indicating how the slots are to be handled. "ignore" puts aside the slots (renaming them) so they are ignored by other bsm processing functions but does not remove them. "delete" delete them so that less memory is used to store the object. "reset" reverse the "ignore" operation.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(exses)
bsm <- tdrply(brokenstick, 1:2, no = 100, obj = exses)[[1]]

bsm <- eco.mem(bsm, type = "ignore")
try(predict(bsm)) # error: required slots treated as absent
bsm <- eco.mem(bsm, type = "reset")
predict(bsm) # slots were restored
identical(bsm, x)

# Use type = "delete" to save some memory
lr_bytes <- object.size(eco.mem(bsm, type = "delete")) 
hr_bytes <- object.size(bsm)
paste0(round(100 * as.numeric(lr_bytes / hr_bytes), digits = 2), "%")

# Works on lists
bsm <- eco.mem(tdrply(brokenstick, 1:2, no = 100:103, obj = exses), type = "delete")
# Same as
bsm <- tdrply(brokenstick, 1:2, no = 100:103, obj = exses, eco.mem = 4)

SESman/rbl documentation built on May 9, 2019, 11:10 a.m.