Learn R Programming

gRim (version 0.1.2)

CGstats: Mean, covariance and counts for grouped data

Description

CGstats provides what corresponds to calling cow.wt on different strata of data where the strata are defined by the combinations of factors in data.

Usage

CGstats(object, varnames = NULL, homogeneous = TRUE, simplify = TRUE)
## S3 method for class 'data.frame':
CGstats(object, varnames = NULL, homogeneous = TRUE, simplify = TRUE)

Arguments

object
varnames
homogeneous
simplify

Value

  • A list whose form depends on the type of input data and the varnames.

See Also

cov.wt

Examples

Run this code
data(milkcomp)
CGstats(milkcomp)
CGstats(milkcomp, c(1,2))
CGstats(milkcomp, c("lactime","treat"))
CGstats(milkcomp, c(3,4))
CGstats(milkcomp, c("fat","protein"))

CGstats(milkcomp, c(2,3,4), simplify=FALSE)
CGstats(milkcomp, c(2,3,4), homogeneous=FALSE)
CGstats(milkcomp, c(2,3,4), simplify=FALSE, homogeneous=FALSE)

Run the code above in your browser using DataLab