Hi, I'm searching for a function to subistute Values in a Matrix to new Values. For example:
old value new value 1.1 6 1.2 7 . . . . . . 1.9 14 2.0 15 and 2.1 15.5 2.2 16 . . . . 2.9 19.5 3.0 20 There is a difference between the correlation old to new value For the present my code is like this: y <- matrix(c(1,2,1, 3,2,4, 1,1,1), ncol=3, byrow=TRUE) for (i in 1:3) { for (j in 1:3) { if y[i,j] = 1:2 substitute y[i,j] = 6:15 } } But I don't find a correct syntax for this term " if y[i,j] = 1:2 substitute y[i,j] = 6:15" and I'm not sure if my idea is to simple and it's more complex than I think. thanks. -- View this message in context: http://www.nabble.com/Substitute-Values-in-a-Matrix--tp19403197p19403197.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.