I have a list of matrices:
X1 <- mvrnorm(n=10, mu = rep(0, 50), Sigma = (cov.structure+diag(50)))
X2 <- mvrnorm(n=10, mu = rep(0, 50), Sigma = (cov.structure+diag(50)))
X3 <- mvrnorm(n=10, mu = rep(0, 50), Sigma = (cov.structure+diag(50)))
X4 <- mvrnorm(n=10, mu = rep(0, 50), Sigma = (cov.structure+diag(50)))
X <- list(X1,X2,X3,X4)
I have a sequence of threshold values
thresholds <- seq(from = 0.05, to = 0.95, by = 0.1)
I want a 0-1 list of the matrices, conditioning by each of the threshold values
I did this for one threshold value
lapply(X,function(x)(ifelse(x<thresholds[1],0,1)))
But I need to repeat this for the entire sequence of threshold values. I am expecting a return of list of dim(10,50,4,10) [as no length(thresholds=10]
Aucun commentaire:
Enregistrer un commentaire