Displaying 1 result from an estimated 1 matches for "excaclti".
Did you mean:
excaclty
2012 Nov 13
2
multiply each row in a matrix with the help of the for loop
Dear R users,
I have this program
aa<-array(rep(0,27),dim=c(3,3,3))
a<-matrix(rep(1,9),ncol=3)
n<-0
for (i in 1:3) {
a[i,]<-a[i,]*(-1)
n<-n+1
aa[,,n]<-a[i,]
}
but i real want to multiply each row with -1 according to for loop and after that to put it in the array.
I will give an example for what excaclty want
-1 -1 -1
1 1 1
1 1 1
-1 -1 -1
-1