Due to the big data matrix in my NGS data, I use l_ply to apply a multiplication to transform the signal matrix in a list of lists. However, this transformation didn't work with the original matrix unchanged. What's the problem?
siteName=c("s1","s2")
dataName=c("d3","d4","d5")
ML=list(list(matrix(1:12,4),matrix(13:24,4),matrix(25:36,4)),list(matrix(1:12,4),matrix(13:24,4),matrix(25:36,4)))
names(ML)=siteName
names(ML[[siteName[1]]])=dataName
names(ML[[siteName[2]]])=dataName
sfs=c(2,3,4)
names(sfs)=dataName
library(plyr)
scaleChIPSeq2=function(x)
{
l_ply(dataName,function(y){ ML[[x]][[y]] <- ML[[x]][[y]]*as.numeric(sfs[y])})
}
l_ply(siteName,scaleChIPSeq2)