| splitbin {aods3} | R Documentation | 
Split Grouped Data Into Individual Data
Description
The function splits grouped binomial data and optional covariates to individual binary data. Two types of grouped data are managed by splitbin:
- Grouped data with weights; 
- Grouped data of form - cbind(success, failure).
When weights, successes or failures involve non-integer numbers, these numbers are rounded (using round()) before splitting.
Usage
splitbin(formula, data, id = "idbin")Arguments
| formula | A formula. The left-hand side describes the grouped data. The right-hand side describes the covariates. See examples for syntax. | 
| data | A data frame where all the variables described in  | 
| id | An optional character string naming the identifier (= grouping factor). Default to “idbin”. | 
Value
A data frame built according to the formula and function used in the call.
Examples
# grouped data with weights
z <- data.frame(
    m = c(0, 1, 0, 1),
    f1 = c("A", "A", "B", "B"),
    f2 = c("C", "D", "C", "D"),
    n = c(4, 2, 1, 3)
    )
z
splitbin(formula = n ~ f1, data = z)$tab
splitbin(formula = n ~ f1 + f2 + m , data = z)$tab
# grouped data of form "cbind(success, failure)"
z <- data.frame(
    m = c(4, 1),
    n = c(5, 3),
    f1 = c("A", "B"),
    f2 = c("C", "D")
    )
z
splitbin(formula = cbind(m, n - m) ~ 1, data = z)$tab
splitbin(formula = cbind(m, n - m) ~ f1 + f2, data = z)$tab
splitbin(formula = cbind(m, n - m) ~ f1 + f2, data = z)$tab
[Package aods3 version 0.4-1.2 Index]