I'm sorry, I find your wording of your requirements hard to follow, and there are some inconsistencies you need to clarify.
e.g. you say you want to work with matrices, but then in your example code for data that you would like to automate, you were explicitly getting rid of matrices and making them dataframes (but naming them to yourselv as maxtrixn
matrix50=data.frame(matrix(unlist(a[[50]]), ncol = 10, byrow=F),stringsAsFactors=FALSE)
also you are losing me when you say
d1=map(a,~matrix(unlist(.))),
this omits to set ncol's so presumably its a complete guess the matrix dimensions.
perhaps you should rather bind_cols as I suggested, but then cast the result to matrix
library(tidyverse)
(d1 <- map(
a,
~ as.matrix(bind_cols(.))
))
# if you want to get results with some function that requires matrices you can iterate also
d1[[3]] <- "not a matrix"
d1
(r1 <- map(
d1,
function(x) {
if (is.matrix(x))
return("happy")
"sad"
}
))