Hello,

I have another question on accessing arrays:

| a<- array(0, c(10000, 100, 10))
| b <- c(1,4)
| for (i in 1:10000) { for (j in 1:100) { a[i,j,b] <- (1:10)[b] }}

Is there a way to replace the nested for loops by a faster operation?

I tried to use `a[1:10000, 1:100, b] <- (1:10)[b]' but that sets values
in the array differently.

Also I am wondering whether setting any of the `--min-vsize=vl --max-vsize=vu
--min-nsize=nl --max-nsize=nu --max-ppsize=N' parameters on the
commandline should make the `array(0, c(10000, 100, 10))' operation any
quicker.

Best,

Sven

______________________________________________
R-help@stat.math.ethz.ch 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