diff --git a/DESCRIPTION b/DESCRIPTION index a7bdd2bbee6cfae86e2723387005174816e77ed7..3d083af06b2dcf768c39b40b96208d618799a705 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -3,7 +3,10 @@ Title: Automatically Retrieve Multidimensional Distributed Data Sets Version: 0.0.2 Authors@R: c( person("BSC-CNS", role = c("aut", "cph")), - person("Nicolau", "Manubens", , "nicolau.manubens@bsc.es", role = c("aut", "cre"))) + person("Nicolau", "Manubens", , "nicolau.manubens@bsc.es", role = c("aut", "cre")), + person("Javier", "Vegas", , "javier.vegas@bsc.es", role = c("ctb")), + person("Pierre-Antoine", "Bretonniere", , "pierre-antoine.bretonniere@bsc.es", role = c("ctb")), + person("Roberto", "Serrano", , "rsnotivoli@gmal.com", role = c("ctb"))) Description: Tool to automatically fetch, transform and arrange subsets of multidimensional data sets (collections of files) stored in local and/or remote file systems or servers, using multicore capabilities where possible. The tool provides an interface to perceive a collection of data sets as a single large multidimensional data array, and enables the user to request for automatic retrieval, processing and arrangement of subsets of the large array. Wrapper functions to add support for custom file formats can be plugged in/out, making the tool suitable for any research field where large multidimensional data sets are involved. Depends: R (>= 2.14.1) diff --git a/R/Utils.R b/R/Utils.R index f4dd5e5325a8c8b2e7a9bb1babe450035e303dbe..6f7b6a17758e661fd42a1b59648c3a960cc6f2e5 100644 --- a/R/Utils.R +++ b/R/Utils.R @@ -474,13 +474,23 @@ chunk <- function(chunk, n_chunks, selectors) { noBreaks. = noBreaks, domain = domain) } +# Function to permute arrays of non-atomic elements (e.g. POSIXct) # Function to permute arrays of non-atomic elements (e.g. POSIXct) .aperm2 <- function(x, new_order) { - y <- array(1:length(x), dim = dim(x)) - y <- aperm(y, new_order) old_dims <- dim(x) - x <- x[as.vector(y)] + attr_bk <- attributes(x) + if ('dim' %in% names(attr_bk)) { + attr_bk[['dim']] <- NULL + } + if (is.numeric(x)) { + x <- aperm(x, new_order) + } else { + y <- array(1:length(x), dim = dim(x)) + y <- aperm(y, new_order) + x <- x[as.vector(y)] + } dim(x) <- old_dims[new_order] + attributes(x) <- c(attributes(x), attr_bk) x }