#Mdarts is a matrix 2343x788 #frequencia is a vector 2343x1 # 9 in Mdarts[fri,frj] stands for my missing values which i want to replace by the value in the vector frequencia
Mdarts<-t(matrix(scan("C:/GWS/CNB/dartg.txt"),ncol=nindT,nrow=nm, byrow=T)) frequencia <- matrix(scan("C:/GWS/CNB/freq.txt"),ncol=1) for (fri in 1:nindT){ for (frj in 1:nm){ Mdarts[fri,frj] <- if (Mdarts[fri,frj] == 9) frequencia[frj] else Mdarts[fri,frj] Mdarts[fri,frj] <- Mdarts[fri,frj]/1-(frequencia[frj]^2) } } Is there a faster way to it? Maybe using any apply function? Thanks in advance -- View this message in context: http://www.nabble.com/Is-there-a-faster-way-to-do-it--tp26098223p26098223.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.