search for: compaison

Displaying 2 results from an estimated 2 matches for "compaison".

Did you mean: comparison
2009 Oct 27
1
New vector based on if/else statement within for loop?
Hello, I am trying to create a new vector (w) that is based on comparing two vectors (P and Z). The compaison is simple (I created a for loop that reassigns w based on if statement), all Z values >= 24 and P values <=1, w=88 else w=77. I am not getting the correct results for w, see example code below. Any thoughts or suggestions on the correct method. Thank you, Doug P <- c(0,1,2,3,4,5,...
2008 Nov 10
1
comparing rows - a possible solution
...r-help as digest... ... The question was: > I compare each row of a matrix with each row of another matrix. > > testmat1 <- matrix(c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4) > testmat2 <- matrix(c(1,2,3,5,5,6,7,8,9,10,11,12,13,14,15,16), nrow=4) and it was asked for a compaison of the both matrix-objects and the result should be a vetor with boolean results. I would use this one: as.vector( testmat1 == testmat2 ) or maybe as.vector( t(testmat1) == t(testmat2) ) but the result as a matrix might also be interesting, so as.vector() could be thrown out, and one woul...