covariance computes the covariance matrix and vectorize it.

covariance(population, variables)

Arguments

population

tbl with grouping (metadata) and observation variables.

variables

character vector specifying observation variables.

Value

data frame of 1 row comprising vectorized covariance matrix.

Examples

population <- tibble::tibble( x = rnorm(30), y = rnorm(30), z = rnorm(30) ) variables <- c("x", "y") covariance(population, variables)
#> x__x y__x y__y #> 1 0.9379415 0.3075673 0.907543