cor.gather all matrices in a list

25 Views Asked by At

I have the list data which contains 31 unnamed pairwise matrices. For each matrix, I would like to use cor.gather() to transform them into a three-column df. For a single matrix it'd look like:

matrix.to.df <- matrix %>%
  cor_gather(drop.na=TRUE)

But in the list is tricky, as I don't have much experience with functions. I know I want something like this:

lapply(names(list), function(x) NewVar(list[[x]], "y", x))

But I don't know how to merge the two. Thank you

0

There are 0 best solutions below