Re: [R] Manipulating Arrays

2009-10-11 Thread ampc
Thanks baptiste. Works as expected. ampy ampc wrote: > > Manipulating Arrays > Using the below data: > > df <- structure(list(dim1 = structure(c(1L, 3L, 1L, 4L, 1L, 2L, 2L, > 2L, 3L, 1L, 4L, 3L, 4L, 4L, 3L, 2L), .Label = c("a1", "a2", "a3", > "a4"), class = "factor"), dim2 = structure(c(2L

Re: [R] Manipulating Arrays

2009-10-11 Thread baptiste auguie
Hi, the abind package can help you with the first query, ## add values library(abind) arr <- abind(arr,arr[1,,,] * 2 + 1,along=1) dim(arr) as for the second, maybe you can use negative indexing, ## remove values arr <- arr[-2,,,] HTH, baptiste 2009/10/11 ampc : > > Manipulating Arrays > Usin

[R] Manipulating Arrays

2009-10-10 Thread ampc
Manipulating Arrays Using the below data: df <- structure(list(dim1 = structure(c(1L, 3L, 1L, 4L, 1L, 2L, 2L, 2L, 3L, 1L, 4L, 3L, 4L, 4L, 3L, 2L), .Label = c("a1", "a2", "a3", "a4"), class = "factor"), dim2 = structure(c(2L, 1L, 2L, 2L, 4L, 3L, 1L, 3L, 1L, 3L, 2L, 4L, 3L, 4L, 1L, 4L), .Label =