aggr_data function

Aggregate data

Aggregate data

Given a matrix of configurations (covariates and responses) unit-by-unit, this function finds the corresponding matrix of distinct configurations and the corresponding vector of frequencies (it does not work properly with missing data).

aggr_data(data, disp=FALSE, fort=FALSE)

Arguments

  • data: matrix of covariate and unit-by-unit response configurations
  • disp: to display partial results
  • fort: to use fortran routines when possible

Returns

  • data_dis: matrix of distinct configurations

  • freq: vector of corresponding frequencies

  • label: the index of each provided response configuration among the distinct ones

Author(s)

Francesco Bartolucci - University of Perugia (IT)

Examples

# draw a matrix of random responses and find distinct responses X = matrix(sample(5,100,replace=TRUE),50,2) out = aggr_data(X) # find the distinct responses and the corresponding vector of frequencies # for naep data data(naep) X = as.matrix(naep) out = aggr_data(X) length(out$freq)
  • Maintainer: Francesco Bartolucci
  • License: GPL (>= 2)
  • Last published: 2017-06-06

Useful links