How to show row on the first column in tidy.prcomp loadings output?

Hello everyone,
I wanted to ask on how do you display the row column for broom::tidy(PCA, matrix="loadings") output?

broom::tidy(PCA)'s first column showed a column I am expecting to show in the first column of broom::tidy(PCA, matrix = "loadings").


PCA <- prcomp(USArrests, scale. = T)

broom::tidy(PCA) %>% #from this matrix.
  slice(1:10) %>% #pick the first 10 vector
  mutate(value = pull(slice(broom::tidy(PCA, matrix = "loadings")[,"value"], 1:10))) #and then use it to replace this matrix's first column

Is this possible?

Thank you very much.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.