Helper function to get PC loadings or components from raw data

get_PCA_loadings(
  df,
  category_col = "category",
  value_col = "value",
  SCALE = TRUE,
  number_of_features = 10,
  grouping_variables = c("country", "year")
)

Arguments

df

dataframe with decile data

category_col

column with categorical definitions for deciles

value_col

Name of values to be output.

SCALE

Boolean which defines if the PC analysis is to be scaled or not.

number_of_features

The number of features or dimensions in data. By default is set to 10 to calculate loadings/components for deciles.

grouping_variables

variables to group by