count_event_position: Count different events in an 'fhx' object

Description Usage Arguments Value See Also Examples

View source: R/utils.R

Description

Count different events in an fhx object

Usage

1
2
3
4
5
6
7
count_event_position(
  x,
  injury_event = FALSE,
  position,
  drop_unknown = FALSE,
  groupby
)

Arguments

x

An fhx object.

injury_event

Optional boolean indicating whether injuries should be considered an "event". Default is FALSE.

position

Depreciated. This allowed users to specify which intra-ring positions to include in the summary output table. The default counts all types of event positions.

drop_unknown

Boolean. Defaults to FALSE. If TRUE will remove the "unknown_fs" and/or "unknown_fi" from rec_type.

groupby

Optional named list containing character vectors that are used to count the total number of different event types. The names given to each character vector give the group's name in the output data frame.

Value

A data frame with a columns giving the event or event group and values giving the corresponding count for each event type or group.

See Also

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
data(pgm)
count_event_position(pgm)

# As above, but considering injuries to be a type of event.
count_event_position(pgm, injury_event = TRUE)

# Often we only quantify known intra-ring positions.
# Remove the "unknown_fs" and/or "unknown_fi" with
count_event_position(pgm, drop_unknown = TRUE)

# Using custom "groupby" args in a named list, as
grplist <- list(
  foo = c("dormant_fs", "early_fs"),
  bar = c("middle_fs", "late_fs")
)
count_event_position(pgm, groupby = grplist)
# Note that if a position in the groupby list is
# not included in rec_type, forcats::fct_count()
# will throw a flag for an "Unknown levels in 'f':"

burnr documentation built on March 10, 2021, 5:07 p.m.