Juan: No, I think there may be a bug: > duplicated(array(c(1,2,3,2,5,6),c(3,2)), MARGIN=1:2) [,1] [,2] [1,] FALSE TRUE [2,] FALSE FALSE [3,] FALSE FALSE ## This is wrong
## But if we first define the array... > a <- array(c(1,2,3,4,5,6), c(3,2)) > duplicated(a, MARGIN = 1:2) [,1] [,2] [1,] FALSE FALSE [2,] FALSE FALSE [3,] FALSE FALSE ## This is right I'll wait a bit before filing a bug report so that any error I may be making can be pointed out (note that my R version is NOT current, so I need to update). > sessionInfo() R version 3.5.2 (2018-12-20) Platform: x86_64-apple-darwin15.6.0 (64-bit) Running under: macOS Mojave 10.14.4 Matrix products: default BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib LAPACK: /Library/Frameworks/R.framework/Versions/3.5/Resources/lib/libRlapack.dylib locale: [1] en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] stats graphics grDevices utils datasets methods base loaded via a namespace (and not attached): [1] compiler_3.5.2 tools_3.5.2 Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Thu, May 9, 2019 at 8:10 AM Juan Gomez <juangomezdu...@gmail.com> wrote: > I think there is an error in duplicated() help page when it states that: > "The array method calculates for each element of the sub-array > specified by MARGIN if the remaining dimensions are identical to those > for an earlier (or later, when fromLast = TRUE) element (in row-major > order). " > Instead of: > "... (in column-major order)" > > For instance: > duplicated(array(c(1,2,3,2,5,6),c(3,2)), MARGIN=1:2) > [,1] [,2] > [1,] FALSE TRUE > [2,] FALSE FALSE > [3,] FALSE FALSE > > > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.