sub-.gmd: Subset Operator for Gaussian Mixture Data

Description Usage Arguments Value Examples

Description

Subset Operator for Gaussian Mixture Data

Usage

1
2
## S3 method for class 'gmd'
x[i, j, ..., drop = TRUE]

Arguments

x

An object of class gmd.

i

A valid expression giving instructions for subsetting observations.

j

Unused.

...

Unused.

drop

Unused.

Value

An object of the same class as the input object with only the subset of observations identified by the expression in argument i.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
N <- 100
M <- 4
w <- matrix(runif(N * M), N, M)
w <- w / rowSums(w)
s <- tidyr::crossing(
  observation = paste0("O", 1:N),
  component = paste0("C", 1:M)
) %>%
dplyr::mutate(mixing = as.numeric(t(w)))
d <- tibble::tibble(
  component = paste0("C", 1:M),
  mean = numeric(M),
  precision = 1:M
)
x <- gmd(s, d)
x[2]
x[2:4]
x[c(1, 3)]
x[-1]
x["O2"]
x[c("O1", "O3")]

astamm/game documentation built on June 5, 2019, 8:53 a.m.