diff --git a/.Rbuildignore b/.Rbuildignore index 97c7dbee587781349aa9529b8a3b300efeb00aa6..bdb1d434212d483ed088618eecc1873ec2e88206 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -4,3 +4,5 @@ .tar.gz .pdf ./.nc +# unit tests should be ignored when building the package for CRAN +^tests$ diff --git a/DESCRIPTION b/DESCRIPTION index 12a312837f13f01ab8b83e13a92e8516015d6686..09bc59cae0cefcd51c7d4fd5a3296fb38fc61d24 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,11 +1,12 @@ Package: multiApply Title: Apply Functions to Multiple Multidimensional Arrays or Vectors -Version: 2.1.3 +Version: 2.1.4 Authors@R: c( person("BSC-CNS", role = c("aut", "cph")), person("Nicolau", "Manubens", , "nicolau.manubens@bsc.es", role = "aut"), person("Alasdair", "Hunter", , "alasdair.hunter@bsc.es", role = "aut"), - person("Nuria", "Perez", , "nuria.perez@bsc.es", role = "cre")) + person("An-Chi", "Ho", , "an.ho@bsc.es", role = c("ctb", "cre")), + person("Nuria", "Perez", , "nuria.perez@bsc.es", role = "ctb")) Description: The base apply function and its variants, as well as the related functions in the 'plyr' package, typically apply user-defined functions to a single argument (or a list of vectorized arguments in the case of mapply). The @@ -29,9 +30,8 @@ Imports: plyr Suggests: testthat -License: Apache License 2.0 +License: GPL-3 URL: https://earth.bsc.es/gitlab/ces/multiApply BugReports: https://earth.bsc.es/gitlab/ces/multiApply/-/issues Encoding: UTF-8 -LazyData: true -RoxygenNote: 5.0.0 +RoxygenNote: 7.2.0 diff --git a/NAMESPACE b/NAMESPACE index f0319b712f8d71e70ca33dab0c6318523aee731c..502e253863c98d66bf57f3d437670d5bd3247017 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -7,3 +7,4 @@ importFrom(plyr,llply) importFrom(plyr,splat) importFrom(stats,setNames) importFrom(utils,capture.output) +importFrom(utils,head) diff --git a/NEWS.md b/NEWS.md new file mode 100644 index 0000000000000000000000000000000000000000..e364792fe9dc77fb631e13ea6a94c921c509b6fd --- /dev/null +++ b/NEWS.md @@ -0,0 +1,2 @@ +# multiApply 2.1.4 (Release date: 2023-03-27) +- Check if the output chunks all have the same dimension length. If not, return errors. diff --git a/R/Apply.R b/R/Apply.R index ecbdfd93db0aaea17a4946b672ead9f84f6c44a8..b04ee15add8851f3c38a282c0b26a1a1c1228b61 100644 --- a/R/Apply.R +++ b/R/Apply.R @@ -31,7 +31,7 @@ #' @importFrom foreach registerDoSEQ #' @importFrom doParallel registerDoParallel #' @importFrom plyr splat llply -#' @importFrom utils capture.output +#' @importFrom utils capture.output head #' @importFrom stats setNames Apply <- function(data, target_dims = NULL, fun, ..., output_dims = NULL, margins = NULL, diff --git a/README.md b/README.md index 6258c1935af75f5d79423cef756e4190c3561fdf..9dbd05c9022b18defc2bfd040b3eca8f2b559663 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,8 @@ -## multiApply [![build status](https://earth.bsc.es/gitlab/ces/multiApply/badges/master/build.svg)](https://earth.bsc.es/gitlab/ces/multiApply/commits/master) [![CRAN version](http://www.r-pkg.org/badges/version/multiApply)](https://cran.r-project.org/package=multiApply) [![coverage report](https://earth.bsc.es/gitlab/ces/multiApply/badges/master/coverage.svg)](https://earth.bsc.es/gitlab/ces/multiApply/commits/master) [![License: LGPL v3](https://img.shields.io/badge/License-LGPL%20v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0) [![CRAN RStudio Downloads](https://cranlogs.r-pkg.org/badges/multiApply)](https://cran.r-project.org/package=multiApply) +## multiApply +[![CRAN version](http://www.r-pkg.org/badges/version/multiApply)](https://CRAN.R-project.org/package=multiApply) +![coverage report](https://earth.bsc.es/gitlab/ces/multiApply/badges/master/coverage.svg) +[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) +[![CRAN RStudio Downloads](https://cranlogs.r-pkg.org/badges/multiApply)](https://CRAN.R-project.org/package=multiApply) This package includes the function `Apply` as its only function. It extends the `apply` function to applications in which a function needs to be applied simultaneously over multiple input arrays. Although this can be done manually with for loops and calls to the base `apply` function, it can often be a challenging task which can easily result in error-prone or memory-inefficient code. @@ -53,12 +57,6 @@ install.packages('multiApply') library(multiApply) ``` -Also, you can install the latest stable version from the GitHub repository as follows: - -```r -devtools::install_git('https://earth.bsc.es/gitlab/ces/multiApply') -``` - ### How to use This package consistis in a single function, `Apply`, which is used in a similar fashion as the base `apply`. Full documentation can be found in `?Apply`. diff --git a/man/Apply.Rd b/man/Apply.Rd index a368553101b7307567bf436584696e72824ef6d1..3fd2daefbe1574fd1580db96060cad30f1d201ac 100644 --- a/man/Apply.Rd +++ b/man/Apply.Rd @@ -4,9 +4,19 @@ \alias{Apply} \title{Apply Functions to Multiple Multidimensional Arrays or Vectors} \usage{ -Apply(data, target_dims = NULL, fun, ..., output_dims = NULL, - margins = NULL, use_attributes = NULL, extra_info = NULL, - guess_dim_names = TRUE, ncores = NULL, split_factor = 1) +Apply( + data, + target_dims = NULL, + fun, + ..., + output_dims = NULL, + margins = NULL, + use_attributes = NULL, + extra_info = NULL, + guess_dim_names = TRUE, + ncores = NULL, + split_factor = 1 +) } \arguments{ \item{data}{One or a list of vectors, matrices or arrays. They must be in the same order as expected by the function provided in the parameter 'fun'. The dimensions do not necessarily have to be ordered. If the 'target_dims' require a different order than the provided, \code{Apply} will automatically reorder the dimensions as needed.} @@ -55,4 +65,3 @@ test <- Apply(data, target = list(3, 3, NULL), test_fun) \references{ Wickham, H (2011), The Split-Apply-Combine Strategy for Data Analysis, Journal of Statistical Software. } - diff --git a/multiApply-manual.pdf b/multiApply-manual.pdf deleted file mode 100644 index 5a2f348b0e965429433fa55f22b4056849e6e587..0000000000000000000000000000000000000000 Binary files a/multiApply-manual.pdf and /dev/null differ