[R] extrat non diagonal
malika yassa
y@@@@_m@lik@ @ending from y@hoo@fr
Wed Nov 14 15:24:01 CET 2018
hello
for examplei have this matrix
w2<-c(0.1,0.2,0.4,0.2,0.4,0.1)aa<-matrix(w1,nrow=3,ncol=3)aa
[,1] [,2] [,3]
[1,] 0.4 0.4 0.4
[2,] 0.1 0.1 0.1
[3,] 0.2 0.2 0.2
if i use this code
matrix(as.numeric(aa)[!as.numeric(aa) %in% diag(aa)],2,3)
i will obtaine this matrix[,1] [,2] [,3]
[1,] NA NA NA
[2,] NA NA NA
but me i want this matrix[,1] [,2] [,3]
[1,] 0.1 0.4 0.4
[2,] 0.2 0.2 0.1
thank you
[[alternative HTML version deleted]]
More information about the R-help
mailing list