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 -1 -1
 1  1  1

-1 -1 -1
-1 -1 -1
-1 -1 -1
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to