Skip to contents

Gets the length of a covariance structure or a pif_class

Arguments

x

A pif_class or a covariance_structure

Value

The number of entries in a covariance_structure_class or in a pif_class (for example in an ensemble composed of multiple fractions)

Examples

#Calculate the length of a single fraction
pif_lead_women <- paf(0.27, 2.2, quiet = TRUE, var_p = 0.001,
  var_beta = 0.015, label = "Women lead")
length(pif_lead_women)
#> [1] 1

#Calculate the length of an ensemble
pif_rad_women  <- paf(0.12, 1.2, quiet = TRUE, var_p = 0.001,
  var_beta = 0.022, label = "Women radiation")

pif_women      <- pif_ensemble(pif_lead_women, pif_rad_women,
  label = "Women", weights = c(0.8, 0.72),
  var_weights = matrix(c(0.3, 0.1, 0.1, 0.4), ncol = 2))

length(pif_women) #= 2 as it contains 2 fractions
#> [1] 2

#Calculate the length of a covariance structure (= # cols)
length(covariance_structure2(pif_lead_women, pif_rad_women))
#> [1] 2