mfdb_group: MareFrame DB groups

Description Usage Arguments Examples

Description

Represent a grouping of data to be applied when summarising area, timestep, age or length.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
# Named grouping of discrete items
mfdb_group(...)

# Pre-baked mfdb_groups for timesteps
mfdb_timestep_yearly
mfdb_timestep_biannually
mfdb_timestep_quarterly

# Grouping of discrete items, names generated by prefix
mfdb_group_numbered(prefix, ...)

# make (count) mfdb_groups, by sampling (count) times from (group)
mfdb_bootstrap_group(count, group)

Arguments

...

For mfdb_group, all named arguments are expected to be a named list of members for that group. For mfdb_group_numbered, the members do not have to be named, a name will be generated based on the prefix.

prefix

When generating numeric group names, the character prefix to append to the beginning.

group

For mfdb_bootstrap_group, the mfdb_group to do sampling with replacement from.

count

For mfdb_bootstrap_group, How many times to sample each member of the given group.

Examples

 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
50
51
52
53
54
55
56
57
58
59
60
## Aggregate age into 2 groups. "young" (for ages 1--3) and
## "old" (for ages 4--6)
g1 <- mfdb_group(young = c(1,2,3), old = c(4,5,6))
## Not run: 
$young
[1] 1 2 3

$old
[1] 4 5 6

attr(,"class")
[1] "mfdb_group"

## End(Not run)

## Aggregate areas into "area1" and "area2".
g2 <- mfdb_group_numbered("area", c(1011,1012,1013), c(1021,1022))
## Not run: 
$area1
[1] 1011 1012 1013

$area2
[1] 1021 1022

attr(,"class")
[1] "mfdb_group"

## End(Not run)

## Take 3 samples with replacement from each group in area
g3 <- mfdb_bootstrap_group(3, g2)
## Not run: 
[[1]]
[[1]]$area1
[1] 1011 1013 1012

[[1]]$area2
[1] 1021 1021


[[2]]
[[2]]$area1
[1] 1011 1013 1012

[[2]]$area2
[1] 1021 1021


[[3]]
[[3]]$area1
[1] 1012 1013 1013

[[3]]$area2
[1] 1022 1022


attr(,"class")
[1] "mfdb_bootstrap_group"

## End(Not run)

sCervino/mfdb documentation built on May 18, 2019, 1:31 p.m.