I am a beginner in R studio so hopefully someone can help me with this problem. The case: I want to make a if else loop and made the following code :
" for (i in 1:l){
for (j in 1:m){
if (is.na(quantilereturns[i,j]) < quantile(quantilereturns[,j], c(.1), na.rm=TRUE)) {
quantilereturns[i,j]
} else { (0) }
}
}"
Summary : I want to make a matrix with values that are smaller than the quantile of a certain vector in the matrix quantilereturns. So when they are smaller than the 10% quantile they get their original value otherwise it will be a zero. The code doesn't give any errors, but it doesn't change the values in the matrix either. Can someone help me?
Aucun commentaire:
Enregistrer un commentaire