Re: [R] Dimnames of array inside loop

From: M.Ribeiro <>
Date: Wed, 23 Jun 2010 08:17:52 -0700 (PDT)

any clue??

hello R-helpers,

I have an array

acuracia <- array(NA, dim = c(1, 1, A, B, C))

which is first defined and in the example above with dimensions 1x1xAxBxC. My array is then filled using 3 loops (I am not well familiar yet with lapply or sapply functions so I am still a loop-user):

for (i in 1:A){
for (j in 1:B){
for (k in 1:C){

acuracia[,,i,j,k] <- correlacao / (sqrt(ac))

then I want to put names using dimnames but filling the names each at a time after each iteration:

My first idea was to try

acuracia <- array(NA, dim = c(1, 1, A,B,C),dimnames = list("acc",NULL, paste("rep.", i, sep = " "), paste("variable: ", j), paste("mark.val = ", k))

but it did not work.
Can anybody help?
Thank you very much

View this message in context:
Sent from the R help mailing list archive at

______________________________________________ mailing list
PLEASE do read the posting guide
and provide commented, minimal, self-contained, reproducible code.
Received on Wed 23 Jun 2010 - 20:44:32 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Wed 23 Jun 2010 - 21:50:35 GMT.

Mailing list information is available at Please read the posting guide before posting to the list.

list of date sections of archive