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:
http://n4.nabble.com/Dimnames-of-array-inside-loop-tp1594215p1594215.html
Sent from the R help mailing list archive at Nabble.com.
I read the post http://n4.nabble.com/Error-setting-rowname-if-rowname-currently-NULL-td794579.html#a794579 where it says that the problem is that dimnames(acuracia) is Null ->equivalent to rownames(fred) is NULL (in the post) Then I tried to define all the dimnames first as random names to be then replaced in the loop but it did not work either? Does anyone have a clue? Thanks a lot -- View this message in context: http://n4.nabble.com/Dimnames-of-array-inside-loop-tp1594215p1598069.html Sent from the R help mailing list archive at Nabble.com.
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:
http://r.789695.n4.nabble.com/Dimnames-of-array-inside-loop-tp1594215p2265736.html
Sent from the R help mailing list archive at Nabble.com.