grouped.data {actuar} | R Documentation |
Creation of grouped data objects, allowing for consistent representation and manipulation of data presented in a frequency per group form.
grouped.data(..., right = TRUE, row.names = NULL, check.rows = FALSE, check.names = TRUE)
... |
these arguments are either of the form value or
tag = value . See Details. |
right |
logical, indicating if the intervals should be closed on the right (and open on the left) or vice versa. |
row.names, check.rows, check.names |
arguments identical to those
of data.frame . |
A grouped data object is a special form of data frame consisting of:
The first argument will be taken as the vector of group boundaries. This vector must be exactly one element longer than the other arguments, which will be taken as vectors of group frequencies. All arguments are coerced to data frames.
Missing (NA
) frequencies are replaced by zeros, with a
warning.
Extraction and replacement methods exist for grouped.data
objects, but working on non adjacent groups will most likely yield
useless results.
An object of class
c("grouped.data", "data.frame")
with
an environment containing the vector cj
of group boundaries.
Vincent Goulet vincent.goulet@act.ulaval.ca, Mathieu Pigeon and Louis-Philippe Pouliot
Klugman, S. A., Panjer, H. H. and Willmot, G. E. (1998), Loss Models, From Data to Decisions, Wiley.
[.grouped.data
for extraction and replacement methods,
data.frame
for usual data frame creation and
manipulation.
## Most common usage cj <- c(0, 25, 50, 100, 250, 500, 1000) nj <- c(30, 31, 57, 42, 45, 10) (x <- grouped.data(Group = cj, Frequency = nj)) class(x) x[, 1] # group boundaries x[, 2] # group frequencies ## Multiple frequency columns are supported x <- sample(1:100, 9) y <- sample(1:100, 9) grouped.data(cj = 1:10, nj.1 = x, nj.2 = y)