How can I save each element of a list in a in a separate .RData file?
Consider the following example:
# Generating a list containing 3 matrices
set.seed(1)
mylist=list(M1=matrix(LETTERS[sample(1:26,9)],3),M2=matrix(LETTERS[sample(1:26,9)],3),M3=matrix(LETTERS[sample(1:26,9)],3))
mylist[1:2]
# $M1
# [,1] [,2] [,3]
# [1,] "G"  "U"  "W" 
# [2,] "J"  "E"  "M" 
# [3,] "N"  "S"  "L" 
# 
# $M2
# [,1] [,2] [,3]
# [1,] "B"  "P"  "J" 
# [2,] "F"  "I"  "N" 
# [3,] "E"  "Q"  "R" 
# Transforming the list of matrices into a list of data frames
mylistdf=lapply(mylist,function(x)as.data.frame(x))
My best try (does not work)
lapply(mylistdf,function(x)save(mylistdf[x],file=paste0(getwd(),names(mylistdf)[x],'.RData')))
				
                        
You can loop using
namesof the list object andsave