0s autopkgtest [19:10:38]: starting date and time: 2024-03-16 19:10:38+0000 0s autopkgtest [19:10:38]: git checkout: b506e79c ssh-setup/nova: fix ARCH having two lines of data 0s autopkgtest [19:10:38]: host juju-7f2275-prod-proposed-migration-environment-2; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work._jim2fe8/out --timeout-copy=6000 --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:r-base,src:curl,src:glib2.0,src:libpng1.6,src:libpsl,src:libtirpc,src:libxt,src:openssl,src:orthanc-python,src:readline,src:wp2latex --apt-upgrade r-cran-matrixstats --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 '--env=ADT_TEST_TRIGGERS=r-base/4.3.3-2build1 curl/8.5.0-2ubuntu7 glib2.0/2.79.3-3ubuntu5 libpng1.6/1.6.43-3 libpsl/0.21.2-1.1 libtirpc/1.3.4+ds-1.1 libxt/1:1.2.1-1.2 openssl/3.0.13-0ubuntu1 orthanc-python/4.1+ds-2build3 readline/8.2-3.1 wp2latex/4.4~ds-1build1' -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-2@bos02-arm64-17.secgroup --name adt-noble-arm64-r-cran-matrixstats-20240316-191038-juju-7f2275-prod-proposed-migration-environment-2 --image adt/ubuntu-noble-arm64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-2 --net-id=net_prod-proposed-migration -e TERM=linux -e ''"'"'http_proxy=http://squid.internal:3128'"'"'' -e ''"'"'https_proxy=http://squid.internal:3128'"'"'' -e ''"'"'no_proxy=127.0.0.1,127.0.1.1,login.ubuntu.com,localhost,localdomain,novalocal,internal,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,10.24.0.0/24,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com'"'"'' --mirror=http://ftpmaster.internal/ubuntu/ 257s autopkgtest [19:14:55]: testbed dpkg architecture: arm64 258s autopkgtest [19:14:56]: testbed apt version: 2.7.12 258s autopkgtest [19:14:56]: @@@@@@@@@@@@@@@@@@@@ test bed setup 259s Get:1 http://ftpmaster.internal/ubuntu noble-proposed InRelease [117 kB] 261s Get:2 http://ftpmaster.internal/ubuntu noble-proposed/main Sources [474 kB] 261s Get:3 http://ftpmaster.internal/ubuntu noble-proposed/universe Sources [3657 kB] 262s Get:4 http://ftpmaster.internal/ubuntu noble-proposed/restricted Sources [6540 B] 262s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/multiverse Sources [51.4 kB] 262s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 Packages [646 kB] 262s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 c-n-f Metadata [3144 B] 262s Get:8 http://ftpmaster.internal/ubuntu noble-proposed/restricted arm64 Packages [33.6 kB] 262s Get:9 http://ftpmaster.internal/ubuntu noble-proposed/restricted arm64 c-n-f Metadata [116 B] 262s Get:10 http://ftpmaster.internal/ubuntu noble-proposed/universe arm64 Packages [4013 kB] 263s Get:11 http://ftpmaster.internal/ubuntu noble-proposed/universe arm64 c-n-f Metadata [8528 B] 263s Get:12 http://ftpmaster.internal/ubuntu noble-proposed/multiverse arm64 Packages [55.5 kB] 263s Get:13 http://ftpmaster.internal/ubuntu noble-proposed/multiverse arm64 c-n-f Metadata [116 B] 282s Fetched 9065 kB in 8s (1122 kB/s) 283s Reading package lists... 294s Reading package lists... 295s Building dependency tree... 295s Reading state information... 298s Calculating upgrade... 300s The following packages will be REMOVED: 300s libglib2.0-0 libssl3 300s The following NEW packages will be installed: 300s libglib2.0-0t64 libssl3t64 xdg-user-dirs 300s The following packages have been kept back: 300s curl 300s The following packages will be upgraded: 300s gir1.2-glib-2.0 libglib2.0-data libtirpc-common openssl readline-common 300s 5 upgraded, 3 newly installed, 2 to remove and 1 not upgraded. 300s Need to get 4592 kB of archives. 300s After this operation, 211 kB of additional disk space will be used. 300s Get:1 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 gir1.2-glib-2.0 arm64 2.79.3-3ubuntu5 [182 kB] 301s Get:2 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libglib2.0-0t64 arm64 2.79.3-3ubuntu5 [1527 kB] 301s Get:3 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 openssl arm64 3.0.13-0ubuntu1 [983 kB] 301s Get:4 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libssl3t64 arm64 3.0.13-0ubuntu1 [1770 kB] 301s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libglib2.0-data all 2.79.3-3ubuntu5 [46.6 kB] 301s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libtirpc-common all 1.3.4+ds-1.1 [8018 B] 301s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 readline-common all 8.2-3.1 [56.4 kB] 301s Get:8 http://ftpmaster.internal/ubuntu noble/main arm64 xdg-user-dirs arm64 0.18-1 [18.1 kB] 304s Fetched 4592 kB in 1s (3365 kB/s) 306s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75850 files and directories currently installed.) 306s Preparing to unpack .../gir1.2-glib-2.0_2.79.3-3ubuntu5_arm64.deb ... 306s Unpacking gir1.2-glib-2.0:arm64 (2.79.3-3ubuntu5) over (2.79.2-1~ubuntu1) ... 307s dpkg: libglib2.0-0:arm64: dependency problems, but removing anyway as you requested: 307s udisks2 depends on libglib2.0-0 (>= 2.77.0). 307s shared-mime-info depends on libglib2.0-0 (>= 2.75.3). 307s python3-gi depends on libglib2.0-0 (>= 2.77.0). 307s python3-dbus depends on libglib2.0-0 (>= 2.16.0). 307s netplan.io depends on libglib2.0-0 (>= 2.70.0). 307s netplan-generator depends on libglib2.0-0 (>= 2.70.0). 307s libxmlb2:arm64 depends on libglib2.0-0 (>= 2.54.0). 307s libvolume-key1:arm64 depends on libglib2.0-0 (>= 2.18.0). 307s libudisks2-0:arm64 depends on libglib2.0-0 (>= 2.75.3). 307s libqrtr-glib0:arm64 depends on libglib2.0-0 (>= 2.56). 307s libqmi-proxy depends on libglib2.0-0 (>= 2.30.0). 307s libqmi-glib5:arm64 depends on libglib2.0-0 (>= 2.54.0). 307s libpolkit-gobject-1-0:arm64 depends on libglib2.0-0 (>= 2.38.0). 307s libpolkit-agent-1-0:arm64 depends on libglib2.0-0 (>= 2.38.0). 307s libnetplan0:arm64 depends on libglib2.0-0 (>= 2.75.3). 307s libmm-glib0:arm64 depends on libglib2.0-0 (>= 2.62.0). 307s libmbim-proxy depends on libglib2.0-0 (>= 2.56). 307s libmbim-glib4:arm64 depends on libglib2.0-0 (>= 2.56). 307s libjson-glib-1.0-0:arm64 depends on libglib2.0-0 (>= 2.75.3). 307s libjcat1:arm64 depends on libglib2.0-0 (>= 2.75.3). 307s libgusb2:arm64 depends on libglib2.0-0 (>= 2.75.3). 307s libgudev-1.0-0:arm64 depends on libglib2.0-0 (>= 2.38.0). 307s libgirepository-1.0-1:arm64 depends on libglib2.0-0 (>= 2.79.0). 307s libfwupd2:arm64 depends on libglib2.0-0 (>= 2.79.0). 307s libblockdev3:arm64 depends on libglib2.0-0 (>= 2.42.2). 307s libblockdev-utils3:arm64 depends on libglib2.0-0 (>= 2.75.3). 307s libblockdev-swap3:arm64 depends on libglib2.0-0 (>= 2.42.2). 307s libblockdev-part3:arm64 depends on libglib2.0-0 (>= 2.42.2). 307s libblockdev-nvme3:arm64 depends on libglib2.0-0 (>= 2.42.2). 307s libblockdev-mdraid3:arm64 depends on libglib2.0-0 (>= 2.42.2). 307s libblockdev-loop3:arm64 depends on libglib2.0-0 (>= 2.42.2). 307s libblockdev-fs3:arm64 depends on libglib2.0-0 (>= 2.42.2). 307s libblockdev-crypto3:arm64 depends on libglib2.0-0 (>= 2.42.2). 307s fwupd depends on libglib2.0-0 (>= 2.79.0). 307s bolt depends on libglib2.0-0 (>= 2.56.0). 307s 307s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75850 files and directories currently installed.) 307s Removing libglib2.0-0:arm64 (2.79.2-1~ubuntu1) ... 308s Selecting previously unselected package libglib2.0-0t64:arm64. 308s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75825 files and directories currently installed.) 308s Preparing to unpack .../libglib2.0-0t64_2.79.3-3ubuntu5_arm64.deb ... 308s libglib2.0-0t64.preinst: Removing /var/lib/dpkg/info/libglib2.0-0:arm64.postrm to avoid loss of /usr/share/glib-2.0/schemas/gschemas.compiled... 308s removed '/var/lib/dpkg/info/libglib2.0-0:arm64.postrm' 308s Unpacking libglib2.0-0t64:arm64 (2.79.3-3ubuntu5) ... 309s Preparing to unpack .../openssl_3.0.13-0ubuntu1_arm64.deb ... 309s Unpacking openssl (3.0.13-0ubuntu1) over (3.0.10-1ubuntu4) ... 310s dpkg: libssl3:arm64: dependency problems, but removing anyway as you requested: 310s wget depends on libssl3 (>= 3.0.0). 310s u-boot-tools depends on libssl3 (>= 3.0.0). 310s tnftp depends on libssl3 (>= 3.0.0). 310s tcpdump depends on libssl3 (>= 3.0.0). 310s systemd-resolved depends on libssl3 (>= 3.0.0). 310s systemd depends on libssl3 (>= 3.0.0). 310s sudo depends on libssl3 (>= 3.0.0). 310s sbsigntool depends on libssl3 (>= 3.0.0). 310s rsync depends on libssl3 (>= 3.0.0). 310s python3-cryptography depends on libssl3 (>= 3.0.0). 310s openssh-server depends on libssl3 (>= 3.0.10). 310s openssh-client depends on libssl3 (>= 3.0.10). 310s mtd-utils depends on libssl3 (>= 3.0.0). 310s mokutil depends on libssl3 (>= 3.0.0). 310s linux-headers-6.8.0-11-generic depends on libssl3 (>= 3.0.0). 310s libsystemd-shared:arm64 depends on libssl3 (>= 3.0.0). 310s libssh-4:arm64 depends on libssl3 (>= 3.0.0). 310s libsasl2-modules:arm64 depends on libssl3 (>= 3.0.0). 310s libsasl2-2:arm64 depends on libssl3 (>= 3.0.0). 310s libpython3.12-minimal:arm64 depends on libssl3 (>= 3.0.0). 310s libpython3.11-minimal:arm64 depends on libssl3 (>= 3.0.0). 310s libnvme1 depends on libssl3 (>= 3.0.0). 310s libkrb5-3:arm64 depends on libssl3 (>= 3.0.0). 310s libkmod2:arm64 depends on libssl3 (>= 3.0.0). 310s libfido2-1:arm64 depends on libssl3 (>= 3.0.0). 310s libcurl4:arm64 depends on libssl3 (>= 3.0.0). 310s libcryptsetup12:arm64 depends on libssl3 (>= 3.0.0). 310s kmod depends on libssl3 (>= 3.0.0). 310s dhcpcd-base depends on libssl3 (>= 3.0.0). 310s bind9-libs:arm64 depends on libssl3 (>= 3.0.0). 310s 310s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75850 files and directories currently installed.) 310s Removing libssl3:arm64 (3.0.10-1ubuntu4) ... 311s Selecting previously unselected package libssl3t64:arm64. 311s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75839 files and directories currently installed.) 311s Preparing to unpack .../libssl3t64_3.0.13-0ubuntu1_arm64.deb ... 311s Unpacking libssl3t64:arm64 (3.0.13-0ubuntu1) ... 312s Preparing to unpack .../libglib2.0-data_2.79.3-3ubuntu5_all.deb ... 312s Unpacking libglib2.0-data (2.79.3-3ubuntu5) over (2.79.2-1~ubuntu1) ... 312s Preparing to unpack .../libtirpc-common_1.3.4+ds-1.1_all.deb ... 312s Unpacking libtirpc-common (1.3.4+ds-1.1) over (1.3.4+ds-1build1) ... 313s Preparing to unpack .../readline-common_8.2-3.1_all.deb ... 313s Unpacking readline-common (8.2-3.1) over (8.2-3) ... 313s Selecting previously unselected package xdg-user-dirs. 313s Preparing to unpack .../xdg-user-dirs_0.18-1_arm64.deb ... 313s Unpacking xdg-user-dirs (0.18-1) ... 314s Setting up xdg-user-dirs (0.18-1) ... 314s Setting up libssl3t64:arm64 (3.0.13-0ubuntu1) ... 314s Setting up libtirpc-common (1.3.4+ds-1.1) ... 314s Setting up libglib2.0-0t64:arm64 (2.79.3-3ubuntu5) ... 314s No schema files found: doing nothing. 314s Setting up libglib2.0-data (2.79.3-3ubuntu5) ... 314s Setting up gir1.2-glib-2.0:arm64 (2.79.3-3ubuntu5) ... 314s Setting up openssl (3.0.13-0ubuntu1) ... 314s Setting up readline-common (8.2-3.1) ... 314s Processing triggers for man-db (2.12.0-3) ... 321s Processing triggers for install-info (7.1-3) ... 323s Processing triggers for libc-bin (2.39-0ubuntu2) ... 324s Reading package lists... 325s Building dependency tree... 325s Reading state information... 328s 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 329s Hit:1 http://ftpmaster.internal/ubuntu noble-proposed InRelease 329s Hit:2 http://ftpmaster.internal/ubuntu noble InRelease 329s Hit:3 http://ftpmaster.internal/ubuntu noble-updates InRelease 329s Hit:4 http://ftpmaster.internal/ubuntu noble-security InRelease 341s Reading package lists... 341s Reading package lists... 342s Building dependency tree... 342s Reading state information... 345s Calculating upgrade... 346s The following packages have been kept back: 346s curl 346s 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 347s Reading package lists... 348s Building dependency tree... 348s Reading state information... 351s 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 355s autopkgtest [19:16:33]: testbed running kernel: Linux 6.8.0-11-generic #11-Ubuntu SMP PREEMPT_DYNAMIC Wed Feb 14 02:53:31 UTC 2024 355s autopkgtest [19:16:33]: @@@@@@@@@@@@@@@@@@@@ apt-source r-cran-matrixstats 358s Get:1 http://ftpmaster.internal/ubuntu noble/universe r-cran-matrixstats 1.2.0-1 (dsc) [2230 B] 358s Get:2 http://ftpmaster.internal/ubuntu noble/universe r-cran-matrixstats 1.2.0-1 (tar) [211 kB] 358s Get:3 http://ftpmaster.internal/ubuntu noble/universe r-cran-matrixstats 1.2.0-1 (diff) [4752 B] 359s gpgv: Signature made Mon Jan 8 21:38:59 2024 UTC 359s gpgv: using RSA key F1F007320A035541F0A663CA578A0494D1C646D1 359s gpgv: issuer "tille@debian.org" 359s gpgv: Can't check signature: No public key 359s dpkg-source: warning: cannot verify inline signature for ./r-cran-matrixstats_1.2.0-1.dsc: no acceptable signature found 360s autopkgtest [19:16:38]: testing package r-cran-matrixstats version 1.2.0-1 360s autopkgtest [19:16:38]: build not needed 361s autopkgtest [19:16:39]: test run-unit-test: preparing testbed 365s Reading package lists... 366s Building dependency tree... 366s Reading state information... 368s Starting pkgProblemResolver with broken count: 0 369s Starting 2 pkgProblemResolver with broken count: 0 369s Done 371s The following additional packages will be installed: 371s curl fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono 371s fonts-glyphicons-halflings fonts-mathjax libblas3 libcairo2 libcurl4t64 371s libdatrie1 libdeflate0 libfontconfig1 libgfortran5 libgomp1 libgraphite2-3 371s libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 libjpeg8 libjs-bootstrap 371s libjs-highlight.js libjs-jquery libjs-jquery-datatables libjs-mathjax 371s liblapack3 liblerc4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 371s libpaper-utils libpaper1 libpixman-1-0 libpng16-16t64 libpsl5t64 371s libreadline8t64 libsharpyuv0 libsm6 libtcl8.6 libthai-data libthai0 libtiff6 371s libtirpc3t64 libtk8.6 libwebp7 libxcb-render0 libxcb-shm0 libxft2 371s libxrender1 libxss1 libxt6t64 node-normalize.css r-base-core 371s r-cran-base64enc r-cran-cli r-cran-colorspace r-cran-commonmark 371s r-cran-digest r-cran-evaluate r-cran-fansi r-cran-farver r-cran-ggplot2 371s r-cran-glue r-cran-gtable r-cran-highr r-cran-isoband r-cran-knitr 371s r-cran-labeling r-cran-lattice r-cran-lifecycle r-cran-magrittr 371s r-cran-markdown r-cran-mass r-cran-matrix r-cran-matrixstats r-cran-mgcv 371s r-cran-munsell r-cran-nlme r-cran-pillar r-cran-pkgconfig r-cran-r.cache 371s r-cran-r.devices r-cran-r.methodss3 r-cran-r.oo r-cran-r.rsp r-cran-r.utils 371s r-cran-r6 r-cran-rcolorbrewer r-cran-rlang r-cran-scales r-cran-tibble 371s r-cran-utf8 r-cran-vctrs r-cran-viridislite r-cran-withr r-cran-xfun 371s r-cran-yaml tcl tcl8.6 unzip x11-common xdg-utils zip 371s Suggested packages: 371s fonts-mathjax-extras fonts-stix libjs-mathjax-doc tk8.6 libjs-html5shiv 371s elpa-ess r-doc-info | r-doc-pdf r-mathlib r-base-html r-cran-kernsmooth 371s r-cran-kernlab r-cran-mvtnorm r-cran-vcd r-cran-shiny r-cran-shinyjs 371s r-cran-dplyr r-cran-png r-cran-jpeg r-cran-rmarkdown r-cran-viridis 371s r-cran-covr r-cran-magick r-cran-sf r-cran-bit64 r-cran-dbi 371s r-cran-formattable r-cran-nanotime r-cran-palmerpenguins r-cran-stringi 371s r-cran-survival r-cran-units r-cran-vdiffr r-cran-testthat r-cran-cairo 371s r-cran-codetools r-cran-bench r-cran-blob r-cran-brio r-cran-callr 371s r-cran-crayon r-cran-here r-cran-hms r-cran-htmltools r-cran-pkgbuild 371s r-cran-pkgload r-cran-purrr r-cran-tidyr tcl-tclreadline 371s Recommended packages: 371s javascript-common r-recommended r-base-dev r-doc-html r-cran-callr 371s r-cran-covr r-cran-crayon r-cran-htmltools r-cran-htmlwidgets r-cran-mockery 371s r-cran-processx r-cran-ps r-cran-rmarkdown r-cran-rprojroot 371s r-cran-rstudioapi r-cran-testthat r-cran-whoami r-cran-curl r-cran-xml2 371s r-cran-unitizer r-cran-dplyr r-cran-hexbin r-cran-hmisc r-cran-mapproj 371s r-cran-maps r-cran-multcomp r-cran-profvis r-cran-quantreg r-cran-ragg 371s r-cran-rpart r-cran-sf r-cran-svglite r-cran-vdiffr r-cran-dbi 371s r-cran-rsqlite r-cran-waldo r-cran-testit r-cran-bslib r-cran-codetools 371s r-cran-formatr r-cran-gridsvg r-cran-jpeg r-cran-magick r-cran-png 371s r-cran-reticulate r-cran-rgl r-cran-sass r-cran-tikzdevice r-cran-tinytex 371s r-cran-webshot node-highlight.js r-cran-lintr r-cran-tidyverse r-cran-rcurl 371s r-cran-lubridate libjs-remark-slide r-cran-fs r-cran-usethis r-cran-bit64 371s r-cran-dichromat r-cran-hms r-cran-stringi r-cran-data.table r-cran-mockr 371s r-cran-formattable r-cran-generics r-cran-pkgdown r-cran-zeallot r-cran-mime 371s r-cran-remotes r-cran-renv r-cran-jsonlite r-cran-runit 371s libfile-mimeinfo-perl libnet-dbus-perl libx11-protocol-perl x11-utils 371s x11-xserver-utils 372s The following packages will be REMOVED: 372s libcurl4 libpng16-16 libpsl5 libreadline8 libtirpc3 372s The following NEW packages will be installed: 372s autopkgtest-satdep fontconfig fontconfig-config fonts-dejavu-core 372s fonts-dejavu-mono fonts-glyphicons-halflings fonts-mathjax libblas3 372s libcairo2 libcurl4t64 libdatrie1 libdeflate0 libfontconfig1 libgfortran5 372s libgomp1 libgraphite2-3 libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 372s libjpeg8 libjs-bootstrap libjs-highlight.js libjs-jquery 372s libjs-jquery-datatables libjs-mathjax liblapack3 liblerc4 libpango-1.0-0 372s libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils libpaper1 libpixman-1-0 372s libpng16-16t64 libpsl5t64 libreadline8t64 libsharpyuv0 libsm6 libtcl8.6 372s libthai-data libthai0 libtiff6 libtirpc3t64 libtk8.6 libwebp7 libxcb-render0 372s libxcb-shm0 libxft2 libxrender1 libxss1 libxt6t64 node-normalize.css 372s r-base-core r-cran-base64enc r-cran-cli r-cran-colorspace r-cran-commonmark 372s r-cran-digest r-cran-evaluate r-cran-fansi r-cran-farver r-cran-ggplot2 372s r-cran-glue r-cran-gtable r-cran-highr r-cran-isoband r-cran-knitr 372s r-cran-labeling r-cran-lattice r-cran-lifecycle r-cran-magrittr 372s r-cran-markdown r-cran-mass r-cran-matrix r-cran-matrixstats r-cran-mgcv 372s r-cran-munsell r-cran-nlme r-cran-pillar r-cran-pkgconfig r-cran-r.cache 372s r-cran-r.devices r-cran-r.methodss3 r-cran-r.oo r-cran-r.rsp r-cran-r.utils 372s r-cran-r6 r-cran-rcolorbrewer r-cran-rlang r-cran-scales r-cran-tibble 372s r-cran-utf8 r-cran-vctrs r-cran-viridislite r-cran-withr r-cran-xfun 372s r-cran-yaml tcl tcl8.6 unzip x11-common xdg-utils zip 372s The following packages will be upgraded: 372s curl 372s 1 upgraded, 104 newly installed, 5 to remove and 0 not upgraded. 372s Need to get 82.0 MB/82.0 MB of archives. 372s After this operation, 184 MB of additional disk space will be used. 372s Get:1 /tmp/autopkgtest.LWEqT8/1-autopkgtest-satdep.deb autopkgtest-satdep arm64 0 [756 B] 372s Get:2 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libpsl5t64 arm64 0.21.2-1.1 [57.4 kB] 373s Get:3 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 curl arm64 8.5.0-2ubuntu7 [222 kB] 373s Get:4 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libcurl4t64 arm64 8.5.0-2ubuntu7 [332 kB] 373s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libpng16-16t64 arm64 1.6.43-3 [185 kB] 373s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libreadline8t64 arm64 8.2-3.1 [153 kB] 373s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libtirpc3t64 arm64 1.3.4+ds-1.1 [83.5 kB] 373s Get:8 http://ftpmaster.internal/ubuntu noble/main arm64 fonts-dejavu-mono all 2.37-8 [502 kB] 373s Get:9 http://ftpmaster.internal/ubuntu noble/main arm64 fonts-dejavu-core all 2.37-8 [835 kB] 373s Get:10 http://ftpmaster.internal/ubuntu noble/main arm64 fontconfig-config arm64 2.15.0-1ubuntu1 [37.0 kB] 373s Get:11 http://ftpmaster.internal/ubuntu noble/main arm64 libfontconfig1 arm64 2.15.0-1ubuntu1 [142 kB] 373s Get:12 http://ftpmaster.internal/ubuntu noble/main arm64 fontconfig arm64 2.15.0-1ubuntu1 [190 kB] 373s Get:13 http://ftpmaster.internal/ubuntu noble/universe arm64 fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-3 [118 kB] 373s Get:14 http://ftpmaster.internal/ubuntu noble/main arm64 fonts-mathjax all 2.7.9+dfsg-1 [2208 kB] 373s Get:15 http://ftpmaster.internal/ubuntu noble/main arm64 libblas3 arm64 3.12.0-3 [143 kB] 373s Get:16 http://ftpmaster.internal/ubuntu noble/main arm64 libpixman-1-0 arm64 0.42.2-1 [193 kB] 374s Get:17 http://ftpmaster.internal/ubuntu noble/main arm64 libxcb-render0 arm64 1.15-1 [16.1 kB] 374s Get:18 http://ftpmaster.internal/ubuntu noble/main arm64 libxcb-shm0 arm64 1.15-1 [5780 B] 374s Get:19 http://ftpmaster.internal/ubuntu noble/main arm64 libxrender1 arm64 1:0.9.10-1.1 [19.1 kB] 374s Get:20 http://ftpmaster.internal/ubuntu noble/main arm64 libcairo2 arm64 1.18.0-1 [550 kB] 374s Get:21 http://ftpmaster.internal/ubuntu noble/main arm64 libdatrie1 arm64 0.2.13-3 [21.7 kB] 374s Get:22 http://ftpmaster.internal/ubuntu noble/main arm64 libdeflate0 arm64 1.19-1 [43.4 kB] 374s Get:23 http://ftpmaster.internal/ubuntu noble/main arm64 libgfortran5 arm64 14-20240303-1ubuntu1 [444 kB] 374s Get:24 http://ftpmaster.internal/ubuntu noble/main arm64 libgomp1 arm64 14-20240303-1ubuntu1 [144 kB] 374s Get:25 http://ftpmaster.internal/ubuntu noble/main arm64 libgraphite2-3 arm64 1.3.14-2 [81.5 kB] 374s Get:26 http://ftpmaster.internal/ubuntu noble/main arm64 libharfbuzz0b arm64 8.3.0-2 [463 kB] 374s Get:27 http://ftpmaster.internal/ubuntu noble/main arm64 x11-common all 1:7.7+23ubuntu2 [23.4 kB] 374s Get:28 http://ftpmaster.internal/ubuntu noble/main arm64 libice6 arm64 2:1.0.10-1build2 [41.7 kB] 374s Get:29 http://ftpmaster.internal/ubuntu noble/main arm64 libjpeg-turbo8 arm64 2.1.5-2ubuntu1 [160 kB] 374s Get:30 http://ftpmaster.internal/ubuntu noble/main arm64 libjpeg8 arm64 8c-2ubuntu11 [2148 B] 374s Get:31 http://ftpmaster.internal/ubuntu noble/universe arm64 libjs-bootstrap all 3.4.1+dfsg-3 [129 kB] 374s Get:32 http://ftpmaster.internal/ubuntu noble/universe arm64 libjs-highlight.js all 9.18.5+dfsg1-2 [385 kB] 374s Get:33 http://ftpmaster.internal/ubuntu noble/main arm64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 374s Get:34 http://ftpmaster.internal/ubuntu noble/universe arm64 libjs-jquery-datatables all 1.11.5+dfsg-2 [146 kB] 374s Get:35 http://ftpmaster.internal/ubuntu noble/main arm64 liblapack3 arm64 3.12.0-3 [2241 kB] 374s Get:36 http://ftpmaster.internal/ubuntu noble/main arm64 liblerc4 arm64 4.0.0+ds-4ubuntu1 [153 kB] 374s Get:37 http://ftpmaster.internal/ubuntu noble/main arm64 libthai-data all 0.1.29-2 [158 kB] 374s Get:38 http://ftpmaster.internal/ubuntu noble/main arm64 libthai0 arm64 0.1.29-2 [18.1 kB] 374s Get:39 http://ftpmaster.internal/ubuntu noble/main arm64 libpango-1.0-0 arm64 1.51.0+ds-4 [226 kB] 374s Get:40 http://ftpmaster.internal/ubuntu noble/main arm64 libpangoft2-1.0-0 arm64 1.51.0+ds-4 [41.2 kB] 374s Get:41 http://ftpmaster.internal/ubuntu noble/main arm64 libpangocairo-1.0-0 arm64 1.51.0+ds-4 [27.6 kB] 375s Get:42 http://ftpmaster.internal/ubuntu noble/main arm64 libpaper1 arm64 1.1.29 [13.1 kB] 375s Get:43 http://ftpmaster.internal/ubuntu noble/main arm64 libpaper-utils arm64 1.1.29 [8480 B] 375s Get:44 http://ftpmaster.internal/ubuntu noble/main arm64 libsharpyuv0 arm64 1.3.2-0.4 [14.4 kB] 375s Get:45 http://ftpmaster.internal/ubuntu noble/main arm64 libsm6 arm64 2:1.2.3-1build2 [16.1 kB] 375s Get:46 http://ftpmaster.internal/ubuntu noble/main arm64 libtcl8.6 arm64 8.6.13+dfsg-2 [980 kB] 375s Get:47 http://ftpmaster.internal/ubuntu noble/main arm64 libjbig0 arm64 2.1-6.1ubuntu1 [28.9 kB] 375s Get:48 http://ftpmaster.internal/ubuntu noble/main arm64 libwebp7 arm64 1.3.2-0.4 [191 kB] 375s Get:49 http://ftpmaster.internal/ubuntu noble/main arm64 libtiff6 arm64 4.5.1+git230720-3ubuntu1 [226 kB] 375s Get:50 http://ftpmaster.internal/ubuntu noble/main arm64 libxft2 arm64 2.3.6-1 [43.3 kB] 375s Get:51 http://ftpmaster.internal/ubuntu noble/main arm64 libxss1 arm64 1:1.2.3-1build2 [8252 B] 375s Get:52 http://ftpmaster.internal/ubuntu noble/main arm64 libtk8.6 arm64 8.6.13-2 [760 kB] 375s Get:53 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libxt6t64 arm64 1:1.2.1-1.2 [168 kB] 375s Get:54 http://ftpmaster.internal/ubuntu noble/universe arm64 node-normalize.css all 8.0.1-5 [10.8 kB] 375s Get:55 http://ftpmaster.internal/ubuntu noble/main arm64 zip arm64 3.0-13 [172 kB] 375s Get:56 http://ftpmaster.internal/ubuntu noble/main arm64 unzip arm64 6.0-28ubuntu3 [171 kB] 375s Get:57 http://ftpmaster.internal/ubuntu noble/main arm64 xdg-utils all 1.1.3-4.1ubuntu3 [62.0 kB] 375s Get:58 http://ftpmaster.internal/ubuntu noble-proposed/universe arm64 r-base-core arm64 4.3.3-2build1 [26.8 MB] 377s Get:59 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-base64enc arm64 0.1-3-3 [27.4 kB] 377s Get:60 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-cli arm64 3.6.2-1 [1377 kB] 377s Get:61 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-colorspace arm64 2.1-0+dfsg-1 [1540 kB] 378s Get:62 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-commonmark arm64 1.9.1-1 [127 kB] 378s Get:63 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-digest arm64 0.6.34-1 [182 kB] 378s Get:64 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-evaluate all 0.23-1 [90.2 kB] 378s Get:65 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-fansi arm64 1.0.5-1 [616 kB] 378s Get:66 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-farver arm64 2.1.1-1 [1336 kB] 378s Get:67 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-glue arm64 1.7.0-1 [154 kB] 378s Get:68 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-rlang arm64 1.1.3-1 [1663 kB] 378s Get:69 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-lifecycle all 1.0.4+dfsg-1 [110 kB] 378s Get:70 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-gtable all 0.3.4+dfsg-1 [191 kB] 378s Get:71 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-isoband arm64 0.2.7-1 [1481 kB] 378s Get:72 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-mass arm64 7.3-60.0.1-1 [1119 kB] 378s Get:73 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-lattice arm64 0.22-5-1 [1342 kB] 378s Get:74 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-nlme arm64 3.1.164-1 [2259 kB] 378s Get:75 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-matrix arm64 1.6-5-1 [3776 kB] 379s Get:76 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-mgcv arm64 1.9-1-1 [3248 kB] 379s Get:77 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-labeling all 0.4.3-1 [62.1 kB] 379s Get:78 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-munsell all 0.5.0-2build1 [208 kB] 379s Get:79 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-r6 all 2.5.1-1 [99.0 kB] 379s Get:80 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-rcolorbrewer all 1.1-3-1build1 [55.4 kB] 379s Get:81 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-viridislite all 0.4.2-2 [1088 kB] 380s Get:82 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-scales all 1.3.0-1 [603 kB] 380s Get:83 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-magrittr arm64 2.0.3-1 [154 kB] 380s Get:84 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-utf8 arm64 1.2.4-1 [140 kB] 380s Get:85 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-vctrs arm64 0.6.5-1 [1327 kB] 380s Get:86 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-pillar all 1.9.0+dfsg-1 [464 kB] 380s Get:87 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-pkgconfig all 2.0.3-2build1 [19.7 kB] 380s Get:88 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-tibble arm64 3.2.1+dfsg-2 [415 kB] 380s Get:89 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-withr all 2.5.0-1 [225 kB] 380s Get:90 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-ggplot2 all 3.4.4+dfsg-1 [3411 kB] 380s Get:91 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-xfun arm64 0.41+dfsg-1 [415 kB] 380s Get:92 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-highr all 0.10+dfsg-1 [38.3 kB] 381s Get:93 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-yaml arm64 2.3.8-1 [107 kB] 381s Get:94 http://ftpmaster.internal/ubuntu noble/main arm64 libjs-mathjax all 2.7.9+dfsg-1 [5665 kB] 381s Get:95 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-knitr all 1.45+dfsg-1 [917 kB] 381s Get:96 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-markdown all 1.12+dfsg-1 [179 kB] 382s Get:97 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-matrixstats arm64 1.2.0-1 [475 kB] 382s Get:98 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-r.methodss3 all 1.8.2-1 [84.0 kB] 382s Get:99 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-r.oo all 1.26.0-1 [955 kB] 382s Get:100 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-r.utils all 2.12.3-1 [1386 kB] 382s Get:101 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-r.cache all 0.16.0-1 [113 kB] 382s Get:102 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-r.devices all 2.17.2+ds-1 [398 kB] 382s Get:103 http://ftpmaster.internal/ubuntu noble/main arm64 tcl8.6 arm64 8.6.13+dfsg-2 [14.6 kB] 382s Get:104 http://ftpmaster.internal/ubuntu noble/main arm64 tcl arm64 8.6.13 [3992 B] 382s Get:105 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-r.rsp all 0.46.0+ds-1 [1412 kB] 387s Preconfiguring packages ... 389s Fetched 82.0 MB in 11s (7334 kB/s) 389s dpkg: libpsl5:arm64: dependency problems, but removing anyway as you requested: 389s wget depends on libpsl5 (>= 0.16.0). 389s libcurl4:arm64 depends on libpsl5 (>= 0.16.0). 389s libcurl3-gnutls:arm64 depends on libpsl5 (>= 0.16.0). 389s 389s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75866 files and directories currently installed.) 389s Removing libpsl5:arm64 (0.21.2-1build1) ... 389s Selecting previously unselected package libpsl5t64:arm64. 390s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75861 files and directories currently installed.) 390s Preparing to unpack .../libpsl5t64_0.21.2-1.1_arm64.deb ... 390s Unpacking libpsl5t64:arm64 (0.21.2-1.1) ... 390s Preparing to unpack .../curl_8.5.0-2ubuntu7_arm64.deb ... 390s Unpacking curl (8.5.0-2ubuntu7) over (8.5.0-2ubuntu2) ... 391s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75867 files and directories currently installed.) 391s Removing libcurl4:arm64 (8.5.0-2ubuntu2) ... 391s Selecting previously unselected package libcurl4t64:arm64. 391s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75862 files and directories currently installed.) 391s Preparing to unpack .../libcurl4t64_8.5.0-2ubuntu7_arm64.deb ... 391s Unpacking libcurl4t64:arm64 (8.5.0-2ubuntu7) ... 391s dpkg: libpng16-16:arm64: dependency problems, but removing anyway as you requested: 391s libplymouth5:arm64 depends on libpng16-16 (>= 1.6.2). 391s libfreetype6:arm64 depends on libpng16-16 (>= 1.6.2-1). 391s 392s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75868 files and directories currently installed.) 392s Removing libpng16-16:arm64 (1.6.43-1) ... 392s Selecting previously unselected package libpng16-16t64:arm64. 392s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75858 files and directories currently installed.) 392s Preparing to unpack .../libpng16-16t64_1.6.43-3_arm64.deb ... 392s Unpacking libpng16-16t64:arm64 (1.6.43-3) ... 393s dpkg: libreadline8:arm64: dependency problems, but removing anyway as you requested: 393s parted depends on libreadline8 (>= 6.0). 393s libpython3.12-stdlib:arm64 depends on libreadline8 (>= 7.0~beta). 393s libpython3.11-stdlib:arm64 depends on libreadline8 (>= 7.0~beta). 393s gpgsm depends on libreadline8 (>= 6.0). 393s gpgconf depends on libreadline8 (>= 6.0). 393s gpg depends on libreadline8 (>= 6.0). 393s gawk depends on libreadline8 (>= 6.0). 393s fdisk depends on libreadline8 (>= 6.0). 393s 393s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75869 files and directories currently installed.) 393s Removing libreadline8:arm64 (8.2-3) ... 393s Selecting previously unselected package libreadline8t64:arm64. 393s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75857 files and directories currently installed.) 393s Preparing to unpack .../libreadline8t64_8.2-3.1_arm64.deb ... 393s Adding 'diversion of /lib/aarch64-linux-gnu/libhistory.so.8 to /lib/aarch64-linux-gnu/libhistory.so.8.usr-is-merged by libreadline8t64' 393s Adding 'diversion of /lib/aarch64-linux-gnu/libhistory.so.8.2 to /lib/aarch64-linux-gnu/libhistory.so.8.2.usr-is-merged by libreadline8t64' 393s Adding 'diversion of /lib/aarch64-linux-gnu/libreadline.so.8 to /lib/aarch64-linux-gnu/libreadline.so.8.usr-is-merged by libreadline8t64' 394s Adding 'diversion of /lib/aarch64-linux-gnu/libreadline.so.8.2 to /lib/aarch64-linux-gnu/libreadline.so.8.2.usr-is-merged by libreadline8t64' 394s Unpacking libreadline8t64:arm64 (8.2-3.1) ... 394s dpkg: libtirpc3:arm64: dependency problems, but removing anyway as you requested: 394s lsof depends on libtirpc3 (>= 1.0.2). 394s libpython3.12-stdlib:arm64 depends on libtirpc3 (>= 1.0.2). 394s libpython3.11-stdlib:arm64 depends on libtirpc3 (>= 1.0.2). 394s libnsl2:arm64 depends on libtirpc3 (>= 1.0.2). 394s iproute2 depends on libtirpc3 (>= 1.0.2). 394s 395s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75877 files and directories currently installed.) 395s Removing libtirpc3:arm64 (1.3.4+ds-1build1) ... 395s Selecting previously unselected package libtirpc3t64:arm64. 395s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75871 files and directories currently installed.) 395s Preparing to unpack .../00-libtirpc3t64_1.3.4+ds-1.1_arm64.deb ... 395s Adding 'diversion of /lib/aarch64-linux-gnu/libtirpc.so.3 to /lib/aarch64-linux-gnu/libtirpc.so.3.usr-is-merged by libtirpc3t64' 395s Adding 'diversion of /lib/aarch64-linux-gnu/libtirpc.so.3.0.0 to /lib/aarch64-linux-gnu/libtirpc.so.3.0.0.usr-is-merged by libtirpc3t64' 395s Unpacking libtirpc3t64:arm64 (1.3.4+ds-1.1) ... 396s Selecting previously unselected package fonts-dejavu-mono. 396s Preparing to unpack .../01-fonts-dejavu-mono_2.37-8_all.deb ... 396s Unpacking fonts-dejavu-mono (2.37-8) ... 396s Selecting previously unselected package fonts-dejavu-core. 396s Preparing to unpack .../02-fonts-dejavu-core_2.37-8_all.deb ... 396s Unpacking fonts-dejavu-core (2.37-8) ... 396s Selecting previously unselected package fontconfig-config. 396s Preparing to unpack .../03-fontconfig-config_2.15.0-1ubuntu1_arm64.deb ... 397s Unpacking fontconfig-config (2.15.0-1ubuntu1) ... 397s Selecting previously unselected package libfontconfig1:arm64. 397s Preparing to unpack .../04-libfontconfig1_2.15.0-1ubuntu1_arm64.deb ... 397s Unpacking libfontconfig1:arm64 (2.15.0-1ubuntu1) ... 397s Selecting previously unselected package fontconfig. 398s Preparing to unpack .../05-fontconfig_2.15.0-1ubuntu1_arm64.deb ... 398s Unpacking fontconfig (2.15.0-1ubuntu1) ... 398s Selecting previously unselected package fonts-glyphicons-halflings. 398s Preparing to unpack .../06-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-3_all.deb ... 398s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-3) ... 398s Selecting previously unselected package fonts-mathjax. 398s Preparing to unpack .../07-fonts-mathjax_2.7.9+dfsg-1_all.deb ... 398s Unpacking fonts-mathjax (2.7.9+dfsg-1) ... 400s Selecting previously unselected package libblas3:arm64. 400s Preparing to unpack .../08-libblas3_3.12.0-3_arm64.deb ... 400s Unpacking libblas3:arm64 (3.12.0-3) ... 400s Selecting previously unselected package libpixman-1-0:arm64. 400s Preparing to unpack .../09-libpixman-1-0_0.42.2-1_arm64.deb ... 400s Unpacking libpixman-1-0:arm64 (0.42.2-1) ... 400s Selecting previously unselected package libxcb-render0:arm64. 400s Preparing to unpack .../10-libxcb-render0_1.15-1_arm64.deb ... 400s Unpacking libxcb-render0:arm64 (1.15-1) ... 400s Selecting previously unselected package libxcb-shm0:arm64. 400s Preparing to unpack .../11-libxcb-shm0_1.15-1_arm64.deb ... 400s Unpacking libxcb-shm0:arm64 (1.15-1) ... 400s Selecting previously unselected package libxrender1:arm64. 400s Preparing to unpack .../12-libxrender1_1%3a0.9.10-1.1_arm64.deb ... 400s Unpacking libxrender1:arm64 (1:0.9.10-1.1) ... 401s Selecting previously unselected package libcairo2:arm64. 401s Preparing to unpack .../13-libcairo2_1.18.0-1_arm64.deb ... 401s Unpacking libcairo2:arm64 (1.18.0-1) ... 401s Selecting previously unselected package libdatrie1:arm64. 401s Preparing to unpack .../14-libdatrie1_0.2.13-3_arm64.deb ... 401s Unpacking libdatrie1:arm64 (0.2.13-3) ... 401s Selecting previously unselected package libdeflate0:arm64. 401s Preparing to unpack .../15-libdeflate0_1.19-1_arm64.deb ... 401s Unpacking libdeflate0:arm64 (1.19-1) ... 401s Selecting previously unselected package libgfortran5:arm64. 402s Preparing to unpack .../16-libgfortran5_14-20240303-1ubuntu1_arm64.deb ... 402s Unpacking libgfortran5:arm64 (14-20240303-1ubuntu1) ... 402s Selecting previously unselected package libgomp1:arm64. 402s Preparing to unpack .../17-libgomp1_14-20240303-1ubuntu1_arm64.deb ... 402s Unpacking libgomp1:arm64 (14-20240303-1ubuntu1) ... 402s Selecting previously unselected package libgraphite2-3:arm64. 402s Preparing to unpack .../18-libgraphite2-3_1.3.14-2_arm64.deb ... 402s Unpacking libgraphite2-3:arm64 (1.3.14-2) ... 402s Selecting previously unselected package libharfbuzz0b:arm64. 402s Preparing to unpack .../19-libharfbuzz0b_8.3.0-2_arm64.deb ... 403s Unpacking libharfbuzz0b:arm64 (8.3.0-2) ... 403s Selecting previously unselected package x11-common. 403s Preparing to unpack .../20-x11-common_1%3a7.7+23ubuntu2_all.deb ... 403s Unpacking x11-common (1:7.7+23ubuntu2) ... 403s Selecting previously unselected package libice6:arm64. 403s Preparing to unpack .../21-libice6_2%3a1.0.10-1build2_arm64.deb ... 403s Unpacking libice6:arm64 (2:1.0.10-1build2) ... 403s Selecting previously unselected package libjpeg-turbo8:arm64. 403s Preparing to unpack .../22-libjpeg-turbo8_2.1.5-2ubuntu1_arm64.deb ... 403s Unpacking libjpeg-turbo8:arm64 (2.1.5-2ubuntu1) ... 404s Selecting previously unselected package libjpeg8:arm64. 404s Preparing to unpack .../23-libjpeg8_8c-2ubuntu11_arm64.deb ... 404s Unpacking libjpeg8:arm64 (8c-2ubuntu11) ... 404s Selecting previously unselected package libjs-bootstrap. 404s Preparing to unpack .../24-libjs-bootstrap_3.4.1+dfsg-3_all.deb ... 404s Unpacking libjs-bootstrap (3.4.1+dfsg-3) ... 405s Selecting previously unselected package libjs-highlight.js. 405s Preparing to unpack .../25-libjs-highlight.js_9.18.5+dfsg1-2_all.deb ... 405s Unpacking libjs-highlight.js (9.18.5+dfsg1-2) ... 405s Selecting previously unselected package libjs-jquery. 405s Preparing to unpack .../26-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 405s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 406s Selecting previously unselected package libjs-jquery-datatables. 406s Preparing to unpack .../27-libjs-jquery-datatables_1.11.5+dfsg-2_all.deb ... 406s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2) ... 406s Selecting previously unselected package liblapack3:arm64. 406s Preparing to unpack .../28-liblapack3_3.12.0-3_arm64.deb ... 406s Unpacking liblapack3:arm64 (3.12.0-3) ... 406s Selecting previously unselected package liblerc4:arm64. 406s Preparing to unpack .../29-liblerc4_4.0.0+ds-4ubuntu1_arm64.deb ... 406s Unpacking liblerc4:arm64 (4.0.0+ds-4ubuntu1) ... 406s Selecting previously unselected package libthai-data. 406s Preparing to unpack .../30-libthai-data_0.1.29-2_all.deb ... 406s Unpacking libthai-data (0.1.29-2) ... 407s Selecting previously unselected package libthai0:arm64. 407s Preparing to unpack .../31-libthai0_0.1.29-2_arm64.deb ... 407s Unpacking libthai0:arm64 (0.1.29-2) ... 407s Selecting previously unselected package libpango-1.0-0:arm64. 407s Preparing to unpack .../32-libpango-1.0-0_1.51.0+ds-4_arm64.deb ... 407s Unpacking libpango-1.0-0:arm64 (1.51.0+ds-4) ... 407s Selecting previously unselected package libpangoft2-1.0-0:arm64. 407s Preparing to unpack .../33-libpangoft2-1.0-0_1.51.0+ds-4_arm64.deb ... 407s Unpacking libpangoft2-1.0-0:arm64 (1.51.0+ds-4) ... 407s Selecting previously unselected package libpangocairo-1.0-0:arm64. 407s Preparing to unpack .../34-libpangocairo-1.0-0_1.51.0+ds-4_arm64.deb ... 407s Unpacking libpangocairo-1.0-0:arm64 (1.51.0+ds-4) ... 408s Selecting previously unselected package libpaper1:arm64. 408s Preparing to unpack .../35-libpaper1_1.1.29_arm64.deb ... 408s Unpacking libpaper1:arm64 (1.1.29) ... 408s Selecting previously unselected package libpaper-utils. 408s Preparing to unpack .../36-libpaper-utils_1.1.29_arm64.deb ... 408s Unpacking libpaper-utils (1.1.29) ... 408s Selecting previously unselected package libsharpyuv0:arm64. 408s Preparing to unpack .../37-libsharpyuv0_1.3.2-0.4_arm64.deb ... 408s Unpacking libsharpyuv0:arm64 (1.3.2-0.4) ... 408s Selecting previously unselected package libsm6:arm64. 408s Preparing to unpack .../38-libsm6_2%3a1.2.3-1build2_arm64.deb ... 408s Unpacking libsm6:arm64 (2:1.2.3-1build2) ... 408s Selecting previously unselected package libtcl8.6:arm64. 409s Preparing to unpack .../39-libtcl8.6_8.6.13+dfsg-2_arm64.deb ... 409s Unpacking libtcl8.6:arm64 (8.6.13+dfsg-2) ... 409s Selecting previously unselected package libjbig0:arm64. 409s Preparing to unpack .../40-libjbig0_2.1-6.1ubuntu1_arm64.deb ... 410s Unpacking libjbig0:arm64 (2.1-6.1ubuntu1) ... 410s Selecting previously unselected package libwebp7:arm64. 410s Preparing to unpack .../41-libwebp7_1.3.2-0.4_arm64.deb ... 410s Unpacking libwebp7:arm64 (1.3.2-0.4) ... 410s Selecting previously unselected package libtiff6:arm64. 410s Preparing to unpack .../42-libtiff6_4.5.1+git230720-3ubuntu1_arm64.deb ... 410s Unpacking libtiff6:arm64 (4.5.1+git230720-3ubuntu1) ... 410s Selecting previously unselected package libxft2:arm64. 411s Preparing to unpack .../43-libxft2_2.3.6-1_arm64.deb ... 411s Unpacking libxft2:arm64 (2.3.6-1) ... 411s Selecting previously unselected package libxss1:arm64. 411s Preparing to unpack .../44-libxss1_1%3a1.2.3-1build2_arm64.deb ... 411s Unpacking libxss1:arm64 (1:1.2.3-1build2) ... 411s Selecting previously unselected package libtk8.6:arm64. 411s Preparing to unpack .../45-libtk8.6_8.6.13-2_arm64.deb ... 411s Unpacking libtk8.6:arm64 (8.6.13-2) ... 412s Selecting previously unselected package libxt6t64:arm64. 412s Preparing to unpack .../46-libxt6t64_1%3a1.2.1-1.2_arm64.deb ... 412s Unpacking libxt6t64:arm64 (1:1.2.1-1.2) ... 413s Selecting previously unselected package node-normalize.css. 413s Preparing to unpack .../47-node-normalize.css_8.0.1-5_all.deb ... 413s Unpacking node-normalize.css (8.0.1-5) ... 413s Selecting previously unselected package zip. 413s Preparing to unpack .../48-zip_3.0-13_arm64.deb ... 413s Unpacking zip (3.0-13) ... 413s Selecting previously unselected package unzip. 413s Preparing to unpack .../49-unzip_6.0-28ubuntu3_arm64.deb ... 413s Unpacking unzip (6.0-28ubuntu3) ... 414s Selecting previously unselected package xdg-utils. 414s Preparing to unpack .../50-xdg-utils_1.1.3-4.1ubuntu3_all.deb ... 414s Unpacking xdg-utils (1.1.3-4.1ubuntu3) ... 414s Selecting previously unselected package r-base-core. 414s Preparing to unpack .../51-r-base-core_4.3.3-2build1_arm64.deb ... 414s Unpacking r-base-core (4.3.3-2build1) ... 418s Selecting previously unselected package r-cran-base64enc. 418s Preparing to unpack .../52-r-cran-base64enc_0.1-3-3_arm64.deb ... 418s Unpacking r-cran-base64enc (0.1-3-3) ... 418s Selecting previously unselected package r-cran-cli. 418s Preparing to unpack .../53-r-cran-cli_3.6.2-1_arm64.deb ... 418s Unpacking r-cran-cli (3.6.2-1) ... 418s Selecting previously unselected package r-cran-colorspace. 418s Preparing to unpack .../54-r-cran-colorspace_2.1-0+dfsg-1_arm64.deb ... 418s Unpacking r-cran-colorspace (2.1-0+dfsg-1) ... 419s Selecting previously unselected package r-cran-commonmark. 419s Preparing to unpack .../55-r-cran-commonmark_1.9.1-1_arm64.deb ... 419s Unpacking r-cran-commonmark (1.9.1-1) ... 419s Selecting previously unselected package r-cran-digest. 419s Preparing to unpack .../56-r-cran-digest_0.6.34-1_arm64.deb ... 419s Unpacking r-cran-digest (0.6.34-1) ... 420s Selecting previously unselected package r-cran-evaluate. 420s Preparing to unpack .../57-r-cran-evaluate_0.23-1_all.deb ... 420s Unpacking r-cran-evaluate (0.23-1) ... 420s Selecting previously unselected package r-cran-fansi. 420s Preparing to unpack .../58-r-cran-fansi_1.0.5-1_arm64.deb ... 420s Unpacking r-cran-fansi (1.0.5-1) ... 420s Selecting previously unselected package r-cran-farver. 420s Preparing to unpack .../59-r-cran-farver_2.1.1-1_arm64.deb ... 420s Unpacking r-cran-farver (2.1.1-1) ... 420s Selecting previously unselected package r-cran-glue. 420s Preparing to unpack .../60-r-cran-glue_1.7.0-1_arm64.deb ... 420s Unpacking r-cran-glue (1.7.0-1) ... 421s Selecting previously unselected package r-cran-rlang. 421s Preparing to unpack .../61-r-cran-rlang_1.1.3-1_arm64.deb ... 421s Unpacking r-cran-rlang (1.1.3-1) ... 421s Selecting previously unselected package r-cran-lifecycle. 422s Preparing to unpack .../62-r-cran-lifecycle_1.0.4+dfsg-1_all.deb ... 422s Unpacking r-cran-lifecycle (1.0.4+dfsg-1) ... 423s Selecting previously unselected package r-cran-gtable. 423s Preparing to unpack .../63-r-cran-gtable_0.3.4+dfsg-1_all.deb ... 423s Unpacking r-cran-gtable (0.3.4+dfsg-1) ... 423s Selecting previously unselected package r-cran-isoband. 423s Preparing to unpack .../64-r-cran-isoband_0.2.7-1_arm64.deb ... 423s Unpacking r-cran-isoband (0.2.7-1) ... 424s Selecting previously unselected package r-cran-mass. 424s Preparing to unpack .../65-r-cran-mass_7.3-60.0.1-1_arm64.deb ... 424s Unpacking r-cran-mass (7.3-60.0.1-1) ... 424s Selecting previously unselected package r-cran-lattice. 424s Preparing to unpack .../66-r-cran-lattice_0.22-5-1_arm64.deb ... 425s Unpacking r-cran-lattice (0.22-5-1) ... 425s Selecting previously unselected package r-cran-nlme. 425s Preparing to unpack .../67-r-cran-nlme_3.1.164-1_arm64.deb ... 425s Unpacking r-cran-nlme (3.1.164-1) ... 425s Selecting previously unselected package r-cran-matrix. 425s Preparing to unpack .../68-r-cran-matrix_1.6-5-1_arm64.deb ... 425s Unpacking r-cran-matrix (1.6-5-1) ... 426s Selecting previously unselected package r-cran-mgcv. 427s Preparing to unpack .../69-r-cran-mgcv_1.9-1-1_arm64.deb ... 427s Unpacking r-cran-mgcv (1.9-1-1) ... 427s Selecting previously unselected package r-cran-labeling. 427s Preparing to unpack .../70-r-cran-labeling_0.4.3-1_all.deb ... 427s Unpacking r-cran-labeling (0.4.3-1) ... 427s Selecting previously unselected package r-cran-munsell. 427s Preparing to unpack .../71-r-cran-munsell_0.5.0-2build1_all.deb ... 427s Unpacking r-cran-munsell (0.5.0-2build1) ... 428s Selecting previously unselected package r-cran-r6. 428s Preparing to unpack .../72-r-cran-r6_2.5.1-1_all.deb ... 428s Unpacking r-cran-r6 (2.5.1-1) ... 428s Selecting previously unselected package r-cran-rcolorbrewer. 428s Preparing to unpack .../73-r-cran-rcolorbrewer_1.1-3-1build1_all.deb ... 428s Unpacking r-cran-rcolorbrewer (1.1-3-1build1) ... 429s Selecting previously unselected package r-cran-viridislite. 429s Preparing to unpack .../74-r-cran-viridislite_0.4.2-2_all.deb ... 429s Unpacking r-cran-viridislite (0.4.2-2) ... 429s Selecting previously unselected package r-cran-scales. 429s Preparing to unpack .../75-r-cran-scales_1.3.0-1_all.deb ... 429s Unpacking r-cran-scales (1.3.0-1) ... 429s Selecting previously unselected package r-cran-magrittr. 430s Preparing to unpack .../76-r-cran-magrittr_2.0.3-1_arm64.deb ... 430s Unpacking r-cran-magrittr (2.0.3-1) ... 430s Selecting previously unselected package r-cran-utf8. 430s Preparing to unpack .../77-r-cran-utf8_1.2.4-1_arm64.deb ... 430s Unpacking r-cran-utf8 (1.2.4-1) ... 430s Selecting previously unselected package r-cran-vctrs. 430s Preparing to unpack .../78-r-cran-vctrs_0.6.5-1_arm64.deb ... 430s Unpacking r-cran-vctrs (0.6.5-1) ... 431s Selecting previously unselected package r-cran-pillar. 431s Preparing to unpack .../79-r-cran-pillar_1.9.0+dfsg-1_all.deb ... 431s Unpacking r-cran-pillar (1.9.0+dfsg-1) ... 431s Selecting previously unselected package r-cran-pkgconfig. 431s Preparing to unpack .../80-r-cran-pkgconfig_2.0.3-2build1_all.deb ... 432s Unpacking r-cran-pkgconfig (2.0.3-2build1) ... 432s Selecting previously unselected package r-cran-tibble. 432s Preparing to unpack .../81-r-cran-tibble_3.2.1+dfsg-2_arm64.deb ... 432s Unpacking r-cran-tibble (3.2.1+dfsg-2) ... 432s Selecting previously unselected package r-cran-withr. 432s Preparing to unpack .../82-r-cran-withr_2.5.0-1_all.deb ... 432s Unpacking r-cran-withr (2.5.0-1) ... 433s Selecting previously unselected package r-cran-ggplot2. 433s Preparing to unpack .../83-r-cran-ggplot2_3.4.4+dfsg-1_all.deb ... 433s Unpacking r-cran-ggplot2 (3.4.4+dfsg-1) ... 434s Selecting previously unselected package r-cran-xfun. 434s Preparing to unpack .../84-r-cran-xfun_0.41+dfsg-1_arm64.deb ... 434s Unpacking r-cran-xfun (0.41+dfsg-1) ... 435s Selecting previously unselected package r-cran-highr. 435s Preparing to unpack .../85-r-cran-highr_0.10+dfsg-1_all.deb ... 435s Unpacking r-cran-highr (0.10+dfsg-1) ... 435s Selecting previously unselected package r-cran-yaml. 435s Preparing to unpack .../86-r-cran-yaml_2.3.8-1_arm64.deb ... 435s Unpacking r-cran-yaml (2.3.8-1) ... 435s Selecting previously unselected package libjs-mathjax. 435s Preparing to unpack .../87-libjs-mathjax_2.7.9+dfsg-1_all.deb ... 435s Unpacking libjs-mathjax (2.7.9+dfsg-1) ... 447s Selecting previously unselected package r-cran-knitr. 447s Preparing to unpack .../88-r-cran-knitr_1.45+dfsg-1_all.deb ... 447s Unpacking r-cran-knitr (1.45+dfsg-1) ... 447s Selecting previously unselected package r-cran-markdown. 447s Preparing to unpack .../89-r-cran-markdown_1.12+dfsg-1_all.deb ... 447s Unpacking r-cran-markdown (1.12+dfsg-1) ... 447s Selecting previously unselected package r-cran-matrixstats. 448s Preparing to unpack .../90-r-cran-matrixstats_1.2.0-1_arm64.deb ... 448s Unpacking r-cran-matrixstats (1.2.0-1) ... 448s Selecting previously unselected package r-cran-r.methodss3. 448s Preparing to unpack .../91-r-cran-r.methodss3_1.8.2-1_all.deb ... 448s Unpacking r-cran-r.methodss3 (1.8.2-1) ... 449s Selecting previously unselected package r-cran-r.oo. 449s Preparing to unpack .../92-r-cran-r.oo_1.26.0-1_all.deb ... 449s Unpacking r-cran-r.oo (1.26.0-1) ... 449s Selecting previously unselected package r-cran-r.utils. 449s Preparing to unpack .../93-r-cran-r.utils_2.12.3-1_all.deb ... 449s Unpacking r-cran-r.utils (2.12.3-1) ... 450s Selecting previously unselected package r-cran-r.cache. 450s Preparing to unpack .../94-r-cran-r.cache_0.16.0-1_all.deb ... 450s Unpacking r-cran-r.cache (0.16.0-1) ... 450s Selecting previously unselected package r-cran-r.devices. 451s Preparing to unpack .../95-r-cran-r.devices_2.17.2+ds-1_all.deb ... 451s Unpacking r-cran-r.devices (2.17.2+ds-1) ... 451s Selecting previously unselected package tcl8.6. 451s Preparing to unpack .../96-tcl8.6_8.6.13+dfsg-2_arm64.deb ... 451s Unpacking tcl8.6 (8.6.13+dfsg-2) ... 451s Selecting previously unselected package tcl. 451s Preparing to unpack .../97-tcl_8.6.13_arm64.deb ... 451s Unpacking tcl (8.6.13) ... 451s Selecting previously unselected package r-cran-r.rsp. 451s Preparing to unpack .../98-r-cran-r.rsp_0.46.0+ds-1_all.deb ... 451s Unpacking r-cran-r.rsp (0.46.0+ds-1) ... 452s Selecting previously unselected package autopkgtest-satdep. 452s Preparing to unpack .../99-1-autopkgtest-satdep.deb ... 452s Unpacking autopkgtest-satdep (0) ... 453s Setting up libgraphite2-3:arm64 (1.3.14-2) ... 453s Setting up libpixman-1-0:arm64 (0.42.2-1) ... 453s Setting up libsharpyuv0:arm64 (1.3.2-0.4) ... 453s Setting up libpaper1:arm64 (1.1.29) ... 457s 457s Creating config file /etc/papersize with new version 458s Setting up fonts-mathjax (2.7.9+dfsg-1) ... 458s Setting up liblerc4:arm64 (4.0.0+ds-4ubuntu1) ... 458s Setting up libjs-mathjax (2.7.9+dfsg-1) ... 458s Setting up libxrender1:arm64 (1:0.9.10-1.1) ... 458s Setting up libdatrie1:arm64 (0.2.13-3) ... 458s Setting up libtirpc3t64:arm64 (1.3.4+ds-1.1) ... 458s Setting up libxcb-render0:arm64 (1.15-1) ... 458s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-3) ... 458s Setting up unzip (6.0-28ubuntu3) ... 458s Setting up x11-common (1:7.7+23ubuntu2) ... 463s Setting up libpsl5t64:arm64 (0.21.2-1.1) ... 463s Setting up libdeflate0:arm64 (1.19-1) ... 463s Setting up libxcb-shm0:arm64 (1.15-1) ... 463s Setting up libpaper-utils (1.1.29) ... 463s Setting up libgomp1:arm64 (14-20240303-1ubuntu1) ... 463s Setting up libjbig0:arm64 (2.1-6.1ubuntu1) ... 463s Setting up zip (3.0-13) ... 463s Setting up libblas3:arm64 (3.12.0-3) ... 463s update-alternatives: using /usr/lib/aarch64-linux-gnu/blas/libblas.so.3 to provide /usr/lib/aarch64-linux-gnu/libblas.so.3 (libblas.so.3-aarch64-linux-gnu) in auto mode 463s Setting up fonts-dejavu-mono (2.37-8) ... 463s Setting up libpng16-16t64:arm64 (1.6.43-3) ... 463s Setting up libtcl8.6:arm64 (8.6.13+dfsg-2) ... 463s Setting up fonts-dejavu-core (2.37-8) ... 464s Setting up libjpeg-turbo8:arm64 (2.1.5-2ubuntu1) ... 464s Setting up libgfortran5:arm64 (14-20240303-1ubuntu1) ... 464s Setting up libwebp7:arm64 (1.3.2-0.4) ... 464s Setting up libreadline8t64:arm64 (8.2-3.1) ... 464s Setting up libjs-highlight.js (9.18.5+dfsg1-2) ... 464s Setting up libharfbuzz0b:arm64 (8.3.0-2) ... 464s Setting up libthai-data (0.1.29-2) ... 464s Setting up libxss1:arm64 (1:1.2.3-1build2) ... 464s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 464s Setting up node-normalize.css (8.0.1-5) ... 464s Setting up xdg-utils (1.1.3-4.1ubuntu3) ... 464s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 464s Setting up libjs-bootstrap (3.4.1+dfsg-3) ... 464s Setting up libjpeg8:arm64 (8c-2ubuntu11) ... 464s Setting up libice6:arm64 (2:1.0.10-1build2) ... 464s Setting up tcl8.6 (8.6.13+dfsg-2) ... 464s Setting up liblapack3:arm64 (3.12.0-3) ... 464s update-alternatives: using /usr/lib/aarch64-linux-gnu/lapack/liblapack.so.3 to provide /usr/lib/aarch64-linux-gnu/liblapack.so.3 (liblapack.so.3-aarch64-linux-gnu) in auto mode 464s Setting up libcurl4t64:arm64 (8.5.0-2ubuntu7) ... 464s Setting up fontconfig-config (2.15.0-1ubuntu1) ... 467s Setting up libjs-jquery-datatables (1.11.5+dfsg-2) ... 467s Setting up libthai0:arm64 (0.1.29-2) ... 467s Setting up libtiff6:arm64 (4.5.1+git230720-3ubuntu1) ... 467s Setting up tcl (8.6.13) ... 467s Setting up curl (8.5.0-2ubuntu7) ... 467s Setting up libfontconfig1:arm64 (2.15.0-1ubuntu1) ... 467s Setting up libsm6:arm64 (2:1.2.3-1build2) ... 467s Setting up fontconfig (2.15.0-1ubuntu1) ... 469s Regenerating fonts cache... done. 469s Setting up libxft2:arm64 (2.3.6-1) ... 469s Setting up libtk8.6:arm64 (8.6.13-2) ... 469s Setting up libpango-1.0-0:arm64 (1.51.0+ds-4) ... 469s Setting up libcairo2:arm64 (1.18.0-1) ... 469s Setting up libxt6t64:arm64 (1:1.2.1-1.2) ... 469s Setting up libpangoft2-1.0-0:arm64 (1.51.0+ds-4) ... 469s Setting up libpangocairo-1.0-0:arm64 (1.51.0+ds-4) ... 469s Setting up r-base-core (4.3.3-2build1) ... 471s 471s Creating config file /etc/R/Renviron with new version 472s Setting up r-cran-labeling (0.4.3-1) ... 472s Setting up r-cran-lattice (0.22-5-1) ... 472s Setting up r-cran-nlme (3.1.164-1) ... 472s Setting up r-cran-farver (2.1.1-1) ... 472s Setting up r-cran-viridislite (0.4.2-2) ... 472s Setting up r-cran-commonmark (1.9.1-1) ... 472s Setting up r-cran-r6 (2.5.1-1) ... 472s Setting up r-cran-magrittr (2.0.3-1) ... 472s Setting up r-cran-rlang (1.1.3-1) ... 472s Setting up r-cran-matrixstats (1.2.0-1) ... 472s Setting up r-cran-xfun (0.41+dfsg-1) ... 472s Setting up r-cran-withr (2.5.0-1) ... 472s Setting up r-cran-base64enc (0.1-3-3) ... 472s Setting up r-cran-digest (0.6.34-1) ... 472s Setting up r-cran-yaml (2.3.8-1) ... 472s Setting up r-cran-evaluate (0.23-1) ... 472s Setting up r-cran-highr (0.10+dfsg-1) ... 472s Setting up r-cran-fansi (1.0.5-1) ... 472s Setting up r-cran-mass (7.3-60.0.1-1) ... 472s Setting up r-cran-glue (1.7.0-1) ... 472s Setting up r-cran-cli (3.6.2-1) ... 472s Setting up r-cran-lifecycle (1.0.4+dfsg-1) ... 472s Setting up r-cran-r.methodss3 (1.8.2-1) ... 472s Setting up r-cran-pkgconfig (2.0.3-2build1) ... 472s Setting up r-cran-utf8 (1.2.4-1) ... 472s Setting up r-cran-colorspace (2.1-0+dfsg-1) ... 472s Setting up r-cran-markdown (1.12+dfsg-1) ... 472s Setting up r-cran-rcolorbrewer (1.1-3-1build1) ... 472s Setting up r-cran-isoband (0.2.7-1) ... 472s Setting up r-cran-gtable (0.3.4+dfsg-1) ... 472s Setting up r-cran-matrix (1.6-5-1) ... 472s Setting up r-cran-knitr (1.45+dfsg-1) ... 472s Setting up r-cran-mgcv (1.9-1-1) ... 472s Setting up r-cran-vctrs (0.6.5-1) ... 472s Setting up r-cran-pillar (1.9.0+dfsg-1) ... 472s Setting up r-cran-munsell (0.5.0-2build1) ... 472s Setting up r-cran-tibble (3.2.1+dfsg-2) ... 472s Setting up r-cran-r.oo (1.26.0-1) ... 472s Setting up r-cran-scales (1.3.0-1) ... 472s Setting up r-cran-r.utils (2.12.3-1) ... 472s Setting up r-cran-ggplot2 (3.4.4+dfsg-1) ... 472s Setting up r-cran-r.devices (2.17.2+ds-1) ... 472s Setting up r-cran-r.cache (0.16.0-1) ... 472s Setting up r-cran-r.rsp (0.46.0+ds-1) ... 472s Setting up autopkgtest-satdep (0) ... 472s Processing triggers for man-db (2.12.0-3) ... 479s Processing triggers for install-info (7.1-3) ... 480s Processing triggers for libc-bin (2.39-0ubuntu2) ... 523s (Reading database ... 86888 files and directories currently installed.) 523s Removing autopkgtest-satdep (0) ... 525s autopkgtest [19:19:23]: test run-unit-test: [----------------------- 526s 526s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 526s Copyright (C) 2024 The R Foundation for Statistical Computing 526s Platform: aarch64-unknown-linux-gnu (64-bit) 526s 526s R is free software and comes with ABSOLUTELY NO WARRANTY. 526s You are welcome to redistribute it under certain conditions. 526s Type 'license()' or 'licence()' for distribution details. 526s 526s R is a collaborative project with many contributors. 526s Type 'contributors()' for more information and 526s 'citation()' on how to cite R or R packages in publications. 526s 526s Type 'demo()' for some demos, 'help()' for on-line help, or 526s 'help.start()' for an HTML browser interface to help. 526s Type 'q()' to quit R. 526s 528s > library("matrixStats") 528s > 528s > allocArray_R <- function(nrow, ncol, value = NA) { 528s + array(data = value, dim = dim) 528s + } 528s > 528s > values <- list( 528s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 528s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 528s + .Machine$double.xmin, .Machine$double.xmax, 528s + .Machine$double.eps, .Machine$double.neg.eps, 528s + FALSE, TRUE, NA 528s + ) 528s > 528s > dim <- c(2L, 4L, 3L) 528s > for (value in values) { 528s + x0 <- allocArray_R(dim, value = value) 528s + x <- allocArray(dim, value = value) 528s + if (!identical(x, x0)) { 528s + str(list(dim = dim, value = value, x = x, x0 = x0)) 528s + stopifnot(identical(x, x0)) 528s + } 528s + } 528s > 528s 529s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 529s Copyright (C) 2024 The R Foundation for Statistical Computing 529s Platform: aarch64-unknown-linux-gnu (64-bit) 529s 529s R is free software and comes with ABSOLUTELY NO WARRANTY. 529s You are welcome to redistribute it under certain conditions. 529s Type 'license()' or 'licence()' for distribution details. 529s 529s R is a collaborative project with many contributors. 529s Type 'contributors()' for more information and 529s 'citation()' on how to cite R or R packages in publications. 529s 529s Type 'demo()' for some demos, 'help()' for on-line help, or 529s 'help.start()' for an HTML browser interface to help. 529s Type 'q()' to quit R. 529s 529s > library("matrixStats") 530s > 530s > allocMatrix_R <- function(nrow, ncol, value = NA) { 530s + matrix(data = value, nrow = nrow, ncol = ncol) 530s + } 530s > 530s > values <- list( 530s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 530s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 530s + .Machine$double.xmin, .Machine$double.xmax, 530s + .Machine$double.eps, .Machine$double.neg.eps, 530s + FALSE, TRUE, NA 530s + ) 530s > 530s > nrow <- 2L 530s > ncol <- 3L 530s > for (value in values) { 530s + x0 <- allocMatrix_R(nrow, ncol, value = value) 530s + x <- allocMatrix(nrow, ncol, value = value) 530s + if (!identical(x, x0)) { 530s + str(list(nrow = nrow, ncol = ncol, value = value, x = x, x0 = x0)) 530s + stopifnot(identical(x, x0)) 530s + } 530s + } 530s > 530s 530s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 530s Copyright (C) 2024 The R Foundation for Statistical Computing 530s Platform: aarch64-unknown-linux-gnu (64-bit) 530s 530s R is free software and comes with ABSOLUTELY NO WARRANTY. 530s You are welcome to redistribute it under certain conditions. 530s Type 'license()' or 'licence()' for distribution details. 530s 530s R is a collaborative project with many contributors. 530s Type 'contributors()' for more information and 530s 'citation()' on how to cite R or R packages in publications. 530s 530s Type 'demo()' for some demos, 'help()' for on-line help, or 530s 'help.start()' for an HTML browser interface to help. 530s Type 'q()' to quit R. 530s 531s > library("matrixStats") 531s > 531s > allocVector_R <- function(length, value = NA) { 531s + x <- vector(mode = typeof(value), length = length) 531s + if (!is.finite(value) || value != 0) x[] <- value 531s + x 531s + } 531s > 531s > values <- list( 531s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 531s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 531s + .Machine$double.xmin, .Machine$double.xmax, 531s + .Machine$double.eps, .Machine$double.neg.eps, 531s + FALSE, TRUE, NA 531s + ) 531s > 531s > n <- 10L 531s > for (value in values) { 531s + x0 <- allocVector_R(n, value = value) 531s + x <- allocVector(n, value = value) 531s + if (!identical(x, x0)) { 531s + str(list(n = n, value = value, x = x, x0 = x0)) 531s + stopifnot(identical(x, x0)) 531s + } 531s + } 531s > 532s 532s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 532s Copyright (C) 2024 The R Foundation for Statistical Computing 532s Platform: aarch64-unknown-linux-gnu (64-bit) 532s 532s R is free software and comes with ABSOLUTELY NO WARRANTY. 532s You are welcome to redistribute it under certain conditions. 532s Type 'license()' or 'licence()' for distribution details. 532s 532s R is a collaborative project with many contributors. 532s Type 'contributors()' for more information and 532s 'citation()' on how to cite R or R packages in publications. 532s 532s Type 'demo()' for some demos, 'help()' for on-line help, or 532s 'help.start()' for an HTML browser interface to help. 532s Type 'q()' to quit R. 532s 533s > library("matrixStats") 533s > 533s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 533s > # Setup 533s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 533s > data <- data.frame( 533s + logical = c(TRUE, FALSE, TRUE), 533s + integer = 1:3, 533s + double = seq(from = 1.0, to = 3.0, by = 1.0), 533s + complex = seq(from = 1.0, to = 3.0, by = 1.0) + 1.0i, 533s + character = letters[1:3], 533s + stringsAsFactors = FALSE 533s + ) 533s > 533s > modes <- names(data) 533s > 533s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 533s > # Special cases 533s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 533s > cat("NULL...\n") 533s NULL... 533s > stopifnot(identical(anyMissing(NULL), FALSE)) 533s > cat("NULL...done\n") 533s NULL...done 533s > 533s > cat("raw...\n") 533s raw... 533s > stopifnot(identical(anyMissing(as.raw(0:2)), FALSE)) 533s > cat("raw...done\n") 533s raw...done 533s > 533s > cat("list(NULL)...\n") 533s list(NULL)... 533s > stopifnot(identical(anyMissing(list(NULL)), FALSE)) 533s > cat("list(NULL)...done\n") 533s list(NULL)...done 533s > 533s > 533s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 533s > # Scalars, vectors, and matrices of various modes 533s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 533s > for (mode in modes) { 533s + cat(sprintf("Mode: %s...\n", mode)) 533s + values <- data[[mode]] 533s + 533s + # Scalars 533s + cat(" scalar\n") 533s + x <- values[1L] 533s + print(x) 533s + stopifnot(identical(anyMissing(x), FALSE)) 533s + is.na(x) <- TRUE 533s + print(x) 533s + stopifnot(identical(anyMissing(x), TRUE)) 533s + 533s + # Vectors 533s + cat(" vector\n") 533s + x <- values 533s + print(x) 533s + stopifnot(identical(anyMissing(x), FALSE)) 533s + is.na(x)[2L] <- TRUE 533s + print(x) 533s + stopifnot(identical(anyMissing(x), TRUE)) 533s + 533s + # Matrices 533s + cat(" matrix\n") 533s + x <- matrix(c(values, values), ncol = 2L) 533s + print(x) 533s + stopifnot(identical(anyMissing(x), FALSE)) 533s + is.na(x)[2L] <- TRUE 533s + print(x) 533s + stopifnot(identical(anyMissing(x), TRUE)) 533s + 533s + cat(sprintf("Mode: %s...done\n", mode)) 533s + } # for (mode ...) 534s Mode: logical... 534s scalar 534s [1] TRUE 534s [1] NA 534s vector 534s [1] TRUE FALSE TRUE 534s [1] TRUE NA TRUE 534s matrix 534s [,1] [,2] 534s [1,] TRUE TRUE 534s [2,] FALSE FALSE 534s [3,] TRUE TRUE 534s [,1] [,2] 534s [1,] TRUE TRUE 534s [2,] NA FALSE 534s [3,] TRUE TRUE 534s Mode: logical...done 534s Mode: integer... 534s scalar 534s [1] 1 534s [1] NA 534s vector 534s [1] 1 2 3 534s [1] 1 NA 3 534s matrix 534s [,1] [,2] 534s [1,] 1 1 534s [2,] 2 2 534s [3,] 3 3 534s [,1] [,2] 534s [1,] 1 1 534s [2,] NA 2 534s [3,] 3 3 534s Mode: integer...done 534s Mode: double... 534s scalar 534s [1] 1 534s [1] NA 534s vector 534s [1] 1 2 3 534s [1] 1 NA 3 534s matrix 534s [,1] [,2] 534s [1,] 1 1 534s [2,] 2 2 534s [3,] 3 3 534s [,1] [,2] 534s [1,] 1 1 534s [2,] NA 2 534s [3,] 3 3 534s Mode: double...done 534s Mode: complex... 534s scalar 534s [1] 1+1i 534s [1] NA 534s vector 534s [1] 1+1i 2+1i 3+1i 534s [1] 1+1i NA 3+1i 534s matrix 534s [,1] [,2] 534s [1,] 1+1i 1+1i 534s [2,] 2+1i 2+1i 534s [3,] 3+1i 3+1i 534s [,1] [,2] 534s [1,] 1+1i 1+1i 534s [2,] NA 2+1i 534s [3,] 3+1i 3+1i 534s Mode: complex...done 534s Mode: character... 534s scalar 534s [1] "a" 534s [1] NA 534s vector 534s [1] "a" "b" "c" 534s [1] "a" NA "c" 534s matrix 534s [,1] [,2] 534s [1,] "a" "a" 534s [2,] "b" "b" 534s [3,] "c" "c" 534s [,1] [,2] 534s [1,] "a" "a" 534s [2,] NA "b" 534s [3,] "c" "c" 534s Mode: character...done 534s > 534s > 534s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 534s > # Data frames 534s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 534s > cat("data.frame...\n") 534s data.frame... 534s > x <- data 534s > stopifnot(identical(anyMissing(x), FALSE)) 534s > for (mode in modes) { 534s + x <- data 534s + is.na(x[[mode]])[2L] <- TRUE 534s + print(x) 534s + stopifnot(identical(anyMissing(x), TRUE)) 534s + } # for (mode ...) 534s logical integer double complex character 534s 1 TRUE 1 1 1+1i a 534s 2 NA 2 2 2+1i b 534s 3 TRUE 3 3 3+1i c 534s logical integer double complex character 534s 1 TRUE 1 1 1+1i a 534s 2 FALSE NA 2 2+1i b 534s 3 TRUE 3 3 3+1i c 534s logical integer double complex character 534s 1 TRUE 1 1 1+1i a 534s 2 FALSE 2 NA 2+1i b 534s 3 TRUE 3 3 3+1i c 534s logical integer double complex character 534s 1 TRUE 1 1 1+1i a 534s 2 FALSE 2 2 NA b 534s 3 TRUE 3 3 3+1i c 534s logical integer double complex character 534s 1 TRUE 1 1 1+1i a 534s 2 FALSE 2 2 2+1i 534s 3 TRUE 3 3 3+1i c 534s > cat("data.frame...done\n") 534s data.frame...done 534s > 534s > 534s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 534s > # Lists 534s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 534s > cat("list...\n") 534s list... 534s > x <- as.list(data) 534s > stopifnot(identical(anyMissing(x), FALSE)) 534s > for (mode in modes) { 534s + x <- as.list(data) 534s + is.na(x[[mode]])[2L] <- TRUE 534s + print(x) 534s + stopifnot(identical(anyMissing(x), TRUE)) 534s + } # for (mode ...) 534s $logical 534s [1] TRUE NA TRUE 534s 534s $integer 534s [1] 1 2 3 534s 534s $double 534s [1] 1 2 3 534s 534s $complex 534s [1] 1+1i 2+1i 3+1i 534s 534s $character 534s [1] "a" "b" "c" 534s 534s $logical 534s [1] TRUE FALSE TRUE 534s 534s $integer 534s [1] 1 NA 3 534s 534s $double 534s [1] 1 2 3 534s 534s $complex 534s [1] 1+1i 2+1i 3+1i 534s 534s $character 534s [1] "a" "b" "c" 534s 534s $logical 534s [1] TRUE FALSE TRUE 534s 534s $integer 534s [1] 1 2 3 534s 534s $double 534s [1] 1 NA 3 534s 534s $complex 534s [1] 1+1i 2+1i 3+1i 534s 534s $character 534s [1] "a" "b" "c" 534s 534s $logical 534s [1] TRUE FALSE TRUE 534s 534s $integer 534s [1] 1 2 3 534s 534s $double 534s [1] 1 2 3 534s 534s $complex 534s [1] 1+1i NA 3+1i 534s 534s $character 534s [1] "a" "b" "c" 534s 534s $logical 534s [1] TRUE FALSE TRUE 534s 534s $integer 534s [1] 1 2 3 534s 534s $double 534s [1] 1 2 3 534s 534s $complex 534s [1] 1+1i 2+1i 3+1i 534s 534s $character 534s [1] "a" NA "c" 534s 534s > cat("list...done\n") 534s list...done 534s > 535s 535s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 535s Copyright (C) 2024 The R Foundation for Statistical Computing 535s Platform: aarch64-unknown-linux-gnu (64-bit) 535s 535s R is free software and comes with ABSOLUTELY NO WARRANTY. 535s You are welcome to redistribute it under certain conditions. 535s Type 'license()' or 'licence()' for distribution details. 535s 535s R is a collaborative project with many contributors. 535s Type 'contributors()' for more information and 535s 'citation()' on how to cite R or R packages in publications. 535s 535s Type 'demo()' for some demos, 'help()' for on-line help, or 535s 'help.start()' for an HTML browser interface to help. 535s Type 'q()' to quit R. 535s 536s > library("matrixStats") 536s > 536s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 536s > # Subsetted tests 536s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 536s > source("utils/validateIndicesFramework.R") 536s > x <- runif(4, min = -3, max = 3) 536s > x[2] <- NA 536s > for (mode in c("integer", "numeric")) { 536s + storage.mode(x) <- mode 536s + for (idxs in index_cases) { 536s + validateIndicesTestVector(x, idxs, 536s + ftest = anyMissing, fsure = function(x, ...) { 536s + anyValue(x, value = NA) 536s + }) 536s + } 536s + } 536s > 537s 537s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 537s Copyright (C) 2024 The R Foundation for Statistical Computing 537s Platform: aarch64-unknown-linux-gnu (64-bit) 537s 537s R is free software and comes with ABSOLUTELY NO WARRANTY. 537s You are welcome to redistribute it under certain conditions. 537s Type 'license()' or 'licence()' for distribution details. 537s 537s R is a collaborative project with many contributors. 537s Type 'contributors()' for more information and 537s 'citation()' on how to cite R or R packages in publications. 537s 537s Type 'demo()' for some demos, 'help()' for on-line help, or 537s 'help.start()' for an HTML browser interface to help. 537s Type 'q()' to quit R. 537s 538s > ## 1. Don't test with valgrind 538s > ## 2. Test only R (>= 3.0.2) because of that's what knitr requires 538s > if (getRversion() >= "3.0.2" && Sys.getenv("_R_CHECK_USE_VALGRIND_") == "") { 538s + 538s + ## 3. Make sure all suggested packages are installed / can be loaded 538s + pkgs <- c("base64enc", "ggplot2", "knitr", "markdown", "microbenchmark", 538s + "R.devices", "R.rsp") 538s + if (all(unlist(lapply(pkgs, FUN = requireNamespace)))) { 538s + html <- matrixStats:::benchmark("binCounts") 538s + print(html) 538s + } 538s + 538s + rm(list = "pkgs") 538s + 538s + } 538s Loading required namespace: base64enc 538s Loading required namespace: ggplot2 542s Loading required namespace: knitr 543s Loading required namespace: markdown 543s Loading required namespace: microbenchmark 543s Failed with error: ‘there is no package called ‘microbenchmark’’ 543s Loading required namespace: R.devices 544s Loading required namespace: R.rsp 545s > 545s 545s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 545s Copyright (C) 2024 The R Foundation for Statistical Computing 545s Platform: aarch64-unknown-linux-gnu (64-bit) 545s 545s R is free software and comes with ABSOLUTELY NO WARRANTY. 545s You are welcome to redistribute it under certain conditions. 545s Type 'license()' or 'licence()' for distribution details. 545s 545s R is a collaborative project with many contributors. 545s Type 'contributors()' for more information and 545s 'citation()' on how to cite R or R packages in publications. 545s 545s Type 'demo()' for some demos, 'help()' for on-line help, or 545s 'help.start()' for an HTML browser interface to help. 545s Type 'q()' to quit R. 545s 546s > library("matrixStats") 546s > library("stats") 546s > 546s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 546s > # Local functions 546s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 546s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 546s + n0 <- graphics::hist(x, breaks = bx, right = right, 546s + include.lowest = TRUE, plot = FALSE)$counts 546s + } 546s > 546s > 546s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 546s > # Non-sorted and sorted positions 546s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 546s > nx <- 1000L # Number of data points 546s > nb <- 200L # Number of bins 546s > 546s > # Uniformely distributed bins 546s > bx <- seq(from = 0, to = 1, length.out = nb + 1L) 546s > bx <- c(-1, bx, 2) 546s > 546s > # Sample data points 546s > set.seed(0xBEEF) 546s > x <- runif(nx, min = 0, max = 1) 546s > 546s > for (kk in 1:2) { 546s + n0 <- binCounts_hist(x, bx = bx) 546s + n1 <- binCounts(x, bx = bx) 546s + # Sanity check 546s + stopifnot(identical(n1, n0)) 546s + 546s + # Check reversed 546s + n1r <- rev(binCounts(-x, bx = rev(-bx), right = TRUE)) 546s + stopifnot(identical(n1r, n1)) 546s + 546s + # Retry with a sorted vector 546s + x <- sort(x) 546s + } # for (kk in 1:2) 547s > 547s > 547s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 547s > # Missing values 547s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 547s > x <- 1:40 547s > x[20] <- NA_integer_ 547s > nx <- length(x) 547s > 547s > # Bins 547s > bx <- c(0.5, 50.5, 100.5, 150.5, 200.5) 547s > 547s > y_smooth0 <- binCounts_hist(x, bx = bx) 547s > y_smooth <- binCounts(x, bx = bx) 547s > # Sanity check 547s > stopifnot(all.equal(y_smooth, y_smooth0)) 547s > 547s > 547s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 547s > # Border cases 547s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 547s > x <- 1:10 547s > bx <- min(x) - c(10, 1) 547s > y_smooth <- binCounts(x, bx = bx) 547s > stopifnot(all.equal(y_smooth, 0L)) 547s > bx <- range(x) 547s > y_smooth <- binCounts(x, bx = bx) 547s > stopifnot(all.equal(y_smooth, length(x) - 1L)) 547s > bx <- max(x) + c(1, 10) 547s > y_smooth <- binCounts(x, bx = bx) 547s > stopifnot(all.equal(y_smooth, 0L)) 547s > 547s > # Every second empty 547s > x <- 1:10 547s > bx <- rep(x, each = 2L) 547s > y_smooth <- binCounts(x, bx = bx) 547s > stopifnot(all.equal(y_smooth, rep(c(0L, 1L), length.out = length(bx) - 1L))) 547s > ## NOTE: binCounts_hist() does not give the same last bin count 547s > 547s > 547s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 547s > # Exception handling 547s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 547s > # Zero bin bounderies (invalid bin definition) 547s > bx <- double(0L) 547s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 547s > stopifnot(inherits(res, "try-error")) 547s > 547s > # One bin boundery (invalid bin definition) 547s > bx <- double(1L) 547s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 547s > stopifnot(inherits(res, "try-error")) 547s > 548s 548s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 548s Copyright (C) 2024 The R Foundation for Statistical Computing 548s Platform: aarch64-unknown-linux-gnu (64-bit) 548s 548s R is free software and comes with ABSOLUTELY NO WARRANTY. 548s You are welcome to redistribute it under certain conditions. 548s Type 'license()' or 'licence()' for distribution details. 548s 548s R is a collaborative project with many contributors. 548s Type 'contributors()' for more information and 548s 'citation()' on how to cite R or R packages in publications. 548s 548s Type 'demo()' for some demos, 'help()' for on-line help, or 548s 'help.start()' for an HTML browser interface to help. 548s Type 'q()' to quit R. 548s 549s > library("matrixStats") 549s > 549s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 549s > # Local functions 549s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 549s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 549s + n0 <- graphics::hist(x, breaks = bx, right = right, 549s + include.lowest = TRUE, plot = FALSE)$counts 549s + } 549s > 549s > 549s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 549s > # Subsetted tests 549s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 549s > source("utils/validateIndicesFramework.R") 549s > x <- runif(6, min = -6, max = 6) 549s > storage.mode(x) <- "integer" 549s > bx <- c(-6, 0, 3, 4, 10) 549s > for (idxs in index_cases) { 549s + validateIndicesTestVector(x, idxs, 549s + ftest = binCounts, fsure = binCounts_hist, 549s + bx = bx, right = FALSE) 549s + validateIndicesTestVector(x, idxs, 549s + ftest = binCounts, fsure = binCounts_hist, 549s + bx = bx, right = TRUE) 549s + } 549s > 549s 549s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 549s Copyright (C) 2024 The R Foundation for Statistical Computing 549s Platform: aarch64-unknown-linux-gnu (64-bit) 549s 549s R is free software and comes with ABSOLUTELY NO WARRANTY. 549s You are welcome to redistribute it under certain conditions. 549s Type 'license()' or 'licence()' for distribution details. 549s 549s R is a collaborative project with many contributors. 549s Type 'contributors()' for more information and 549s 'citation()' on how to cite R or R packages in publications. 549s 549s Type 'demo()' for some demos, 'help()' for on-line help, or 549s 'help.start()' for an HTML browser interface to help. 549s Type 'q()' to quit R. 549s 550s > library("matrixStats") 550s > library("stats") 550s > 550s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 550s > # Naive R implementation of binMeans() 550s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 550s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 550s + n_smooth <- length(bx) - 1L 550s + res <- double(n_smooth) 550s + counts <- rep(NaN, times = n_smooth) 550s + 550s + if (na.rm) { 550s + keep <- !is.na(x) & !is.na(y) 550s + x <- x[keep] 550s + y <- y[keep] 550s + } 550s + 550s + # For each bin... 550s + for (kk in seq_len(n_smooth)) { 550s + if (right) { 550s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 550s + } else { 550s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 550s + } 550s + y_kk <- y[idxs] 550s + res[kk] <- mean(y_kk) 550s + counts[kk] <- length(idxs) 550s + } # for (kk ...) 550s + 550s + if (count) attr(res, "count") <- counts 550s + res 550s + } 550s > 550s > 550s > 550s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 550s > # Case #1 550s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 550s > x <- 1:100 550s > nx <- length(x) 550s > y <- double(nx) 550s > y[1:25] <- 5 550s > y[51:75] <- -5 550s > y <- y + rnorm(nx) 550s > 550s > # Bins 550s > bx <- c(0.5, 25.5, 50.5, 75.5, 100.5) 550s > 550s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 551s > y_smooth <- binMeans(y, x = x, bx = bx) 551s > n_smooth <- binCounts(x, bx = bx) 551s > # Sanity check 551s > stopifnot(all.equal(y_smooth, y_smooth0)) 551s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 551s > 551s > y_smooth0r <- rev(binMeans0(y, x = -x, bx = rev(-bx), 551s + count = FALSE, right = TRUE)) 551s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx), 551s + count = FALSE, right = TRUE)) 551s > # Sanity check 551s > stopifnot(all.equal(y_smooth0r, y_smooth0, check.attributes = FALSE)) 551s > stopifnot(all.equal(y_smoothr, y_smooth0r)) 551s > 551s > 551s > # Integer input 551s > y <- as.integer(y) 551s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 551s > y_smooth <- binMeans(y, x = x, bx = bx) 551s > n_smooth <- binCounts(x, bx = bx) 551s > # Sanity check 551s > stopifnot(is.integer(y), 551s + all.equal(y_smooth, y_smooth0), 551s + all.equal(attr(y_smooth, "count"), n_smooth)) 551s > 551s > # Logical input 551s > y <- as.logical(y) 551s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 551s > y_smooth <- binMeans(y, x = x, bx = bx) 551s > n_smooth <- binCounts(x, bx = bx) 551s > # Sanity check 551s > stopifnot(is.logical(y), 551s + all.equal(y_smooth, y_smooth0), 551s + all.equal(attr(y_smooth, "count"), n_smooth)) 551s > 551s > 551s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 551s > # Case #2 551s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 551s > nx <- 1e3 551s > x <- runif(nx) 551s > y <- runif(nx) 551s > 551s > nb <- 10 551s > bx <- do.call(seq, c(as.list(range(x)), length.out = nb)) 551s > bx1 <- c(bx[-1], bx[nb] + 1) 551s > 551s > y_smooth0 <- binMeans0(y, x = x, bx = bx1) 551s > y_smooth <- binMeans(y, x = x, bx = bx1) 551s > n_smooth <- binCounts(x, bx = bx1) 551s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx1), right = TRUE)) 551s > 551s > # Sanity check 551s > stopifnot(all.equal(y_smooth, y_smooth0)) 551s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 551s > stopifnot(all.equal(y_smoothr, y_smooth, check.attributes = FALSE)) 551s > 551s > 551s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 551s > # Empty bins 551s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 551s > x <- c(6:8, 16:19) 551s > nx <- length(x) 551s > y <- runif(nx) 551s > bx <- c(0, 5, 10, 15, 20, 25) 551s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 551s > y_smooth <- binMeans(y, x = x, bx = bx) 551s > n_smooth <- binCounts(x, bx = bx) 551s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 551s > stopifnot(all.equal(y_smooth, y_smooth0)) 551s > 551s > 551s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 551s > # Missing values 551s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 551s > x <- 1:100 551s > x[50] <- NA_integer_ 551s > nx <- length(x) 551s > y <- double(nx) 551s > y[1:25] <- 5 551s > y[51:75] <- -5 551s > y[82:92] <- NA_real_ 551s > y <- y + rnorm(nx) 551s > 551s > # Bins 551s > bx <- c(0.5, 25.5, 75.5, 82.5, 100.5) 551s > 551s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 551s > y_smooth <- binMeans(y, x = x, bx = bx) 551s > # Sanity check 551s > stopifnot(all.equal(y_smooth, y_smooth0)) 551s > 551s > 551s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 551s > # Exception handling 551s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 551s > # Zero bin bounderies (invalid bin definition) 551s > bx <- double(0L) 551s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 551s > stopifnot(inherits(res, "try-error")) 551s > 551s > # One bin boundery (invalid bin definition) 551s > bx <- double(1L) 551s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 551s > stopifnot(inherits(res, "try-error")) 551s > 552s 552s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 552s Copyright (C) 2024 The R Foundation for Statistical Computing 552s Platform: aarch64-unknown-linux-gnu (64-bit) 552s 552s R is free software and comes with ABSOLUTELY NO WARRANTY. 552s You are welcome to redistribute it under certain conditions. 552s Type 'license()' or 'licence()' for distribution details. 552s 552s R is a collaborative project with many contributors. 552s Type 'contributors()' for more information and 552s 'citation()' on how to cite R or R packages in publications. 552s 552s Type 'demo()' for some demos, 'help()' for on-line help, or 552s 'help.start()' for an HTML browser interface to help. 552s Type 'q()' to quit R. 552s 552s > library("matrixStats") 552s > 552s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 552s > # Naive R implementation of binMeans() 552s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 552s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 552s + n_smooth <- length(bx) - 1L 552s + res <- double(n_smooth) 552s + counts <- rep(NaN, times = n_smooth) 552s + 552s + if (na.rm) { 552s + keep <- !is.na(x) & !is.na(y) 552s + x <- x[keep] 552s + y <- y[keep] 552s + } 552s + 552s + # For each bin... 552s + for (kk in seq_len(n_smooth)) { 552s + if (right) { 552s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 552s + } else { 552s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 552s + } 552s + y_kk <- y[idxs] 552s + res[kk] <- mean(y_kk) 552s + counts[kk] <- length(idxs) 553s + } # for (kk ...) 553s + 553s + if (count) attr(res, "count") <- counts 553s + res 553s + } 553s > 553s > 553s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 553s > # Subsetted tests 553s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 553s > source("utils/validateIndicesFramework.R") 553s > y <- runif(6, min = -6, max = 6) 553s > x <- runif(6, min = -6, max = 6) 553s > storage.mode(x) <- "integer" 553s > bx <- c(-6, 0, 3, 4, 10) 553s > for (idxs in index_cases) { 553s + for (na.rm in c(TRUE, FALSE)) { 553s + validateIndicesTestVector_w(y, x, idxs, 553s + ftest = binMeans, fsure = binMeans0, 553s + bx = bx, na.rm = na.rm, 553s + count = TRUE, right = FALSE) 553s + validateIndicesTestVector_w(y, x, idxs, 553s + ftest = binMeans, fsure = binMeans0, 553s + bx = bx, na.rm = na.rm, 553s + count = TRUE, right = TRUE) 553s + } 553s + } 553s > 554s 554s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 554s Copyright (C) 2024 The R Foundation for Statistical Computing 554s Platform: aarch64-unknown-linux-gnu (64-bit) 554s 554s R is free software and comes with ABSOLUTELY NO WARRANTY. 554s You are welcome to redistribute it under certain conditions. 554s Type 'license()' or 'licence()' for distribution details. 554s 554s R is a collaborative project with many contributors. 554s Type 'contributors()' for more information and 554s 'citation()' on how to cite R or R packages in publications. 554s 554s Type 'demo()' for some demos, 'help()' for on-line help, or 554s 'help.start()' for an HTML browser interface to help. 554s Type 'q()' to quit R. 554s 555s > library("matrixStats") 555s > 555s > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 555s + if (is.na(value)) { 555s + counts <- sum(is.na(x)) 555s + } else { 555s + counts <- sum(x == value, na.rm = na.rm) 555s + } 555s + as.integer(counts) 555s + } 555s > 555s > 555s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 555s > # Data type: integer and numeric 555s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 555s > for (mode in c("integer", "double")) { 555s + x <- runif(20 * 5, min = -3, max = 3) 555s + x[sample.int(length(x), size = 7)] <- 0 555s + storage.mode(x) <- mode 555s + 555s + for (na.rm in c(FALSE, TRUE)) { 555s + # Count zeros 555s + n0 <- count_R(x, value = 0, na.rm = na.rm) 555s + n1 <- count(x, value = 0, na.rm = na.rm) 555s + stopifnot(identical(n1, n0)) 555s + all <- allValue(x, value = 0, na.rm = na.rm) 555s + any <- anyValue(x, value = 0, na.rm = na.rm) 555s + 555s + # Count NAs 555s + n0 <- count_R(x, value = NA, na.rm = na.rm) 555s + n1 <- count(x, value = NA, na.rm = na.rm) 555s + stopifnot(identical(n1, n0)) 555s + all <- allValue(x, value = NA, na.rm = na.rm) 555s + any <- anyValue(x, value = NA, na.rm = na.rm) 555s + 555s + if (mode == "integer") { 555s + ux <- unique(as.vector(x)) 555s + n0 <- n1 <- integer(length(x)) 555s + for (value in ux) { 555s + n0 <- n0 + count_R(x, value = value, na.rm = na.rm) 555s + n1 <- n1 + count(x, value = value, na.rm = na.rm) 555s + stopifnot(identical(n1, n0)) 555s + } 555s + stopifnot(all(n0 == ncol(x))) 555s + } # if (mode == "integer") 555s + 555s + } # for (na.rm ...) 555s + } # for (mode ...) 556s > 556s > # All NAs 556s > na_list <- list(NA_integer_, NA_real_, NaN) 556s > for (na_value in na_list) { 556s + x <- rep(na_value, times = 10L) 556s + for (na.rm in c(FALSE, TRUE)) { 556s + n0 <- count_R(x, na.rm = na.rm) 556s + n1 <- count(x, na.rm = na.rm) 556s + stopifnot(identical(n1, n0)) 556s + 556s + # Count NAs 556s + n0 <- count_R(x, value = NA, na.rm = na.rm) 556s + n1 <- count(x, value = NA, na.rm = na.rm) 556s + stopifnot(identical(n1, n0)) 556s + any <- anyValue(x, value = NA, na.rm = na.rm) 556s + all <- allValue(x, value = NA, na.rm = na.rm) 556s + stopifnot(any) 556s + stopifnot(all) 556s + } 556s + } # for (na_value ...) 556s > 556s > 556s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 556s > # Data type: logical 556s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 556s > x <- logical(length = 10L) 556s > x[3:7] <- TRUE 556s > 556s > # Row/column counts 556s > for (na.rm in c(FALSE, TRUE)) { 556s + n0 <- count_R(x, na.rm = na.rm) 556s + n1 <- count(x, na.rm = na.rm) 556s + stopifnot(identical(n1, n0)) 556s + 556s + n_true <- count(x, value = TRUE, na.rm = na.rm) 556s + n_false <- count(x, value = FALSE, na.rm = na.rm) 556s + stopifnot(n_true + n_false == ncol(x)) 556s + 556s + # Count NAs 556s + n0 <- count_R(x, value = NA, na.rm = na.rm) 556s + n1 <- count(x, value = NA, na.rm = na.rm) 556s + stopifnot(identical(n1, n0)) 556s + } 556s > 557s 557s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 557s Copyright (C) 2024 The R Foundation for Statistical Computing 557s Platform: aarch64-unknown-linux-gnu (64-bit) 557s 557s R is free software and comes with ABSOLUTELY NO WARRANTY. 557s You are welcome to redistribute it under certain conditions. 557s Type 'license()' or 'licence()' for distribution details. 557s 557s R is a collaborative project with many contributors. 557s Type 'contributors()' for more information and 557s 'citation()' on how to cite R or R packages in publications. 557s 557s Type 'demo()' for some demos, 'help()' for on-line help, or 557s 'help.start()' for an HTML browser interface to help. 557s Type 'q()' to quit R. 557s 558s > library("matrixStats") 558s > 558s > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 558s + if (is.na(value)) { 558s + counts <- sum(is.na(x)) 558s + } else { 558s + counts <- sum(x == value, na.rm = na.rm) 558s + } 558s + as.integer(counts) 558s + } 558s > 558s > 558s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 558s > # Subsetted tests 558s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 558s > source("utils/validateIndicesFramework.R") 558s > x <- runif(6, min = -3, max = 3) 558s > storage.mode(x) <- "integer" 558s > for (idxs in index_cases) { 558s + validateIndicesTestVector(x, idxs, 558s + ftest = count, fsure = count_R, 558s + value = 0, na.rm = TRUE) 558s + validateIndicesTestVector(x, idxs, 558s + ftest = count, fsure = count_R, 558s + value = 0, na.rm = FALSE) 558s + validateIndicesTestVector(x, idxs, 558s + ftest = count, fsure = count_R, 558s + value = NA_integer_) 558s + } 559s > 560s 560s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 560s Copyright (C) 2024 The R Foundation for Statistical Computing 560s Platform: aarch64-unknown-linux-gnu (64-bit) 560s 560s R is free software and comes with ABSOLUTELY NO WARRANTY. 560s You are welcome to redistribute it under certain conditions. 560s Type 'license()' or 'licence()' for distribution details. 560s 560s R is a collaborative project with many contributors. 560s Type 'contributors()' for more information and 560s 'citation()' on how to cite R or R packages in publications. 560s 560s Type 'demo()' for some demos, 'help()' for on-line help, or 560s 'help.start()' for an HTML browser interface to help. 560s Type 'q()' to quit R. 560s 561s > library("matrixStats") 561s > 561s > diff2_R <- function(..., useNames = NA){ 561s + res <- diff(...) 561s + if (is.na(useNames) || !useNames) names(res) <- NULL 561s + res 561s + } 561s > 561s > set.seed(0x42) 561s > 561s > for (mode in c("integer", "double")) { 561s + x <- rnorm(10, sd = 5) 561s + storage.mode(x) <- mode 561s + str(x) 561s + 561s + for (has_na in c(FALSE, TRUE)) { 561s + for (setNames in c(TRUE, FALSE)) { 561s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 561s + if (has_na) { 561s + x[sample(1:10, size = 3)] <- NA 561s + } 561s + if (setNames) { 561s + names(x) <- LETTERS[1:10] 561s + } 561s + for (l in 1:3) { 561s + for (d in 1:4) { 561s + cat(sprintf("%s: NAs = %s, lag = %d, differences = %d, setNames = %d, useNames = %d\n", 561s + mode, has_na, l, d, setNames, useNames)) 561s + y0 <- diff2_R(x, lag = l, differences = d, useNames = useNames) 561s + str(y0) 561s + y1 <- diff2(x, lag = l, differences = d, useNames = useNames) 561s + str(y1) 561s + stopifnot(identical(y1, y0)) 561s + } 561s + } 561s + } 561s + } 561s + } # for (has_na ...) 561s + } 561s int [1:10] 11 1 2 0 -1 -3 -3 6 0 0 561s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 561s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 561s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 561s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 561s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 561s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 561s Named int [1:8] 11 -3 1 -1 2 9 -15 6 561s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 561s Named int [1:8] 11 -3 1 -1 2 9 -15 6 561s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 561s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 562s Named int [1:7] -14 4 -2 3 7 -24 21 562s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 562s Named int [1:7] -14 4 -2 3 7 -24 21 562s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 562s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 562s Named int [1:6] 18 -6 5 4 -31 45 562s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 562s Named int [1:6] 18 -6 5 4 -31 45 562s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 562s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 562s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 562s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 562s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 562s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 562s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 562s Named int [1:6] 6 -2 1 12 5 -15 562s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 562s Named int [1:6] 6 -2 1 12 5 -15 562s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 562s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 562s Named int [1:4] -5 14 4 -27 562s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 562s Named int [1:4] -5 14 4 -27 562s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 562s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 562s Named int [1:2] 9 -41 562s - attr(*, "names")= chr [1:2] "I" "J" 562s Named int [1:2] 9 -41 562s - attr(*, "names")= chr [1:2] "I" "J" 562s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 562s Named int [1:7] -11 -2 -5 -3 7 3 3 562s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 562s Named int [1:7] -11 -2 -5 -3 7 3 3 562s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 562s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 562s Named int [1:4] 8 9 8 6 562s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 562s Named int [1:4] 8 9 8 6 562s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 562s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 562s Named int -2 562s - attr(*, "names")= chr "J" 562s Named int -2 562s - attr(*, "names")= chr "J" 562s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 562s Named int(0) 562s - attr(*, "names")= chr(0) 562s Named int(0) 562s - attr(*, "names")= chr(0) 562s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 562s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 562s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 562s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 562s int [1:8] 11 -3 1 -1 2 9 -15 6 562s int [1:8] 11 -3 1 -1 2 9 -15 6 562s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 562s int [1:7] -14 4 -2 3 7 -24 21 562s int [1:7] -14 4 -2 3 7 -24 21 562s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 562s int [1:6] 18 -6 5 4 -31 45 562s int [1:6] 18 -6 5 4 -31 45 562s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 562s int [1:8] -9 -1 -3 -3 -2 9 3 -6 562s int [1:8] -9 -1 -3 -3 -2 9 3 -6 562s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 562s int [1:6] 6 -2 1 12 5 -15 562s int [1:6] 6 -2 1 12 5 -15 562s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 562s int [1:4] -5 14 4 -27 562s int [1:4] -5 14 4 -27 562s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 562s int [1:2] 9 -41 562s int [1:2] 9 -41 562s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 562s int [1:7] -11 -2 -5 -3 7 3 3 562s int [1:7] -11 -2 -5 -3 7 3 3 562s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 562s int [1:4] 8 9 8 6 562s int [1:4] 8 9 8 6 562s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 562s int -2 562s int -2 562s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 562s int(0) 562s int(0) 562s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 562s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 562s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 562s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 562s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 562s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 562s Named int [1:8] 11 -3 1 -1 2 9 -15 6 562s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 562s Named int [1:8] 11 -3 1 -1 2 9 -15 6 562s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 562s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 562s Named int [1:7] -14 4 -2 3 7 -24 21 562s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 562s Named int [1:7] -14 4 -2 3 7 -24 21 562s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 562s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 562s Named int [1:6] 18 -6 5 4 -31 45 562s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 562s Named int [1:6] 18 -6 5 4 -31 45 562s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 562s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 562s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 562s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 562s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 562s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 562s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 562s Named int [1:6] 6 -2 1 12 5 -15 562s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 562s Named int [1:6] 6 -2 1 12 5 -15 562s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 562s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 562s Named int [1:4] -5 14 4 -27 562s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 562s Named int [1:4] -5 14 4 -27 562s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 562s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 562s Named int [1:2] 9 -41 562s - attr(*, "names")= chr [1:2] "I" "J" 562s Named int [1:2] 9 -41 562s - attr(*, "names")= chr [1:2] "I" "J" 562s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 562s Named int [1:7] -11 -2 -5 -3 7 3 3 562s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 562s Named int [1:7] -11 -2 -5 -3 7 3 3 562s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 562s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 562s Named int [1:4] 8 9 8 6 562s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 562s Named int [1:4] 8 9 8 6 562s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 562s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 562s Named int -2 562s - attr(*, "names")= chr "J" 562s Named int -2 562s - attr(*, "names")= chr "J" 562s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 562s Named int(0) 562s - attr(*, "names")= chr(0) 562s Named int(0) 562s - attr(*, "names")= chr(0) 562s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 563s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 563s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 563s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 563s int [1:8] 11 -3 1 -1 2 9 -15 6 563s int [1:8] 11 -3 1 -1 2 9 -15 6 563s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 563s int [1:7] -14 4 -2 3 7 -24 21 563s int [1:7] -14 4 -2 3 7 -24 21 563s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 563s int [1:6] 18 -6 5 4 -31 45 563s int [1:6] 18 -6 5 4 -31 45 563s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 563s int [1:8] -9 -1 -3 -3 -2 9 3 -6 563s int [1:8] -9 -1 -3 -3 -2 9 3 -6 563s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 563s int [1:6] 6 -2 1 12 5 -15 563s int [1:6] 6 -2 1 12 5 -15 563s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 563s int [1:4] -5 14 4 -27 563s int [1:4] -5 14 4 -27 563s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 563s int [1:2] 9 -41 563s int [1:2] 9 -41 563s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 563s int [1:7] -11 -2 -5 -3 7 3 3 563s int [1:7] -11 -2 -5 -3 7 3 3 563s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 563s int [1:4] 8 9 8 6 563s int [1:4] 8 9 8 6 563s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 563s int -2 563s int -2 563s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 563s int(0) 563s int(0) 563s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 563s Named int [1:9] NA NA NA NA NA 0 9 -6 0 563s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 563s Named int [1:9] NA NA NA NA NA 0 9 -6 0 563s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 563s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 563s Named int [1:8] NA NA NA NA NA 9 -15 6 563s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 563s Named int [1:8] NA NA NA NA NA 9 -15 6 563s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 563s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 563s Named int [1:7] NA NA NA NA NA -24 21 563s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 563s Named int [1:7] NA NA NA NA NA -24 21 563s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 563s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 563s Named int [1:6] NA NA NA NA NA 45 563s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 563s Named int [1:6] NA NA NA NA NA 45 563s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 563s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 563s Named int [1:8] -9 NA NA NA NA 9 3 -6 563s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 563s Named int [1:8] -9 NA NA NA NA 9 3 -6 563s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 563s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 563s Named int [1:6] NA NA NA NA NA -15 563s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 563s Named int [1:6] NA NA NA NA NA -15 563s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 563s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 563s Named int [1:4] NA NA NA NA 563s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 563s Named int [1:4] NA NA NA NA 563s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 563s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 563s Named int [1:2] NA NA 563s - attr(*, "names")= chr [1:2] "I" "J" 563s Named int [1:2] NA NA 563s - attr(*, "names")= chr [1:2] "I" "J" 563s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 563s Named int [1:7] NA NA -5 NA NA 3 3 563s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 563s Named int [1:7] NA NA -5 NA NA 3 3 563s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 563s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 563s Named int [1:4] NA NA 8 NA 563s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 563s Named int [1:4] NA NA 8 NA 563s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 563s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 563s Named int NA 563s - attr(*, "names")= chr "J" 563s Named int NA 563s - attr(*, "names")= chr "J" 563s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 563s Named int(0) 563s - attr(*, "names")= chr(0) 563s Named int(0) 563s - attr(*, "names")= chr(0) 563s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 563s int [1:9] NA NA NA NA NA 0 9 NA NA 563s int [1:9] NA NA NA NA NA 0 9 NA NA 563s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 563s int [1:8] NA NA NA NA NA 9 NA NA 563s int [1:8] NA NA NA NA NA 9 NA NA 563s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 563s int [1:7] NA NA NA NA NA NA NA 563s int [1:7] NA NA NA NA NA NA NA 563s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 563s int [1:6] NA NA NA NA NA NA 563s int [1:6] NA NA NA NA NA NA 563s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 563s int [1:8] NA NA NA NA NA 9 NA -6 563s int [1:8] NA NA NA NA NA 9 NA -6 563s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 563s int [1:6] NA NA NA NA NA -15 563s int [1:6] NA NA NA NA NA -15 563s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 563s int [1:4] NA NA NA NA 563s int [1:4] NA NA NA NA 563s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 563s int [1:2] NA NA 563s int [1:2] NA NA 563s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 563s int [1:7] NA NA NA NA NA NA 3 563s int [1:7] NA NA NA NA NA NA 3 563s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 563s int [1:4] NA NA NA NA 563s int [1:4] NA NA NA NA 563s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 563s int NA 563s int NA 563s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 563s int(0) 563s int(0) 563s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 563s Named int [1:9] NA NA NA NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 563s Named int [1:9] NA NA NA NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 563s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 563s Named int [1:8] NA NA NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 563s Named int [1:8] NA NA NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 563s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 563s Named int [1:7] NA NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 563s Named int [1:7] NA NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 563s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 563s Named int [1:6] NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 563s Named int [1:6] NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 563s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 563s Named int [1:8] NA NA NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 563s Named int [1:8] NA NA NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 563s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 563s Named int [1:6] NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 563s Named int [1:6] NA NA NA NA NA NA 563s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 563s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 563s Named int [1:4] NA NA NA NA 563s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 563s Named int [1:4] NA NA NA NA 563s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 563s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 563s Named int [1:2] NA NA 563s - attr(*, "names")= chr [1:2] "I" "J" 563s Named int [1:2] NA NA 563s - attr(*, "names")= chr [1:2] "I" "J" 563s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 563s Named int [1:7] NA NA NA NA NA NA 3 563s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 563s Named int [1:7] NA NA NA NA NA NA 3 563s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 563s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 563s Named int [1:4] NA NA NA NA 563s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 563s Named int [1:4] NA NA NA NA 563s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 563s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 563s Named int NA 563s - attr(*, "names")= chr "J" 563s Named int NA 563s - attr(*, "names")= chr "J" 563s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 563s Named int(0) 563s - attr(*, "names")= chr(0) 563s Named int(0) 563s - attr(*, "names")= chr(0) 563s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 563s int [1:9] NA NA NA NA NA NA NA NA NA 563s int [1:9] NA NA NA NA NA NA NA NA NA 563s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 563s int [1:8] NA NA NA NA NA NA NA NA 563s int [1:8] NA NA NA NA NA NA NA NA 563s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 563s int [1:7] NA NA NA NA NA NA NA 563s int [1:7] NA NA NA NA NA NA NA 563s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 563s int [1:6] NA NA NA NA NA NA 563s int [1:6] NA NA NA NA NA NA 563s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 563s int [1:8] NA NA NA NA NA NA NA NA 563s int [1:8] NA NA NA NA NA NA NA NA 563s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 563s int [1:6] NA NA NA NA NA NA 563s int [1:6] NA NA NA NA NA NA 563s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 563s int [1:4] NA NA NA NA 563s int [1:4] NA NA NA NA 563s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 563s int [1:2] NA NA 564s int [1:2] NA NA 564s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 564s int [1:7] NA NA NA NA NA NA 3 564s int [1:7] NA NA NA NA NA NA 3 564s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 564s int [1:4] NA NA NA NA 564s int [1:4] NA NA NA NA 564s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 564s int NA 564s int NA 564s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 564s int(0) 564s int(0) 564s num [1:10] 2.586 -0.344 0.33 9.155 -3.254 ... 564s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 564s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 564s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 564s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 564s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 564s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 564s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 564s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 564s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 564s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 564s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 564s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 564s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 564s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 564s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 564s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 564s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 564s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 564s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 564s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 564s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 564s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 564s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 564s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 564s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 564s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 564s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 564s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 564s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 564s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 564s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 564s Named num [1:4] 0.368 42.988 15.396 -29.313 564s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 564s Named num [1:4] 0.368 42.988 15.396 -29.313 564s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 564s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 564s Named num [1:2] 15 -72.3 564s - attr(*, "names")= chr [1:2] "I" "J" 564s Named num [1:2] 15 -72.3 564s - attr(*, "names")= chr [1:2] "I" "J" 564s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 564s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 564s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 564s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 564s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 564s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 564s Named num [1:4] -23.52 7.92 11.38 23.27 564s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 564s Named num [1:4] -23.52 7.92 11.38 23.27 564s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 564s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 564s Named num 46.8 564s - attr(*, "names")= chr "J" 564s Named num 46.8 564s - attr(*, "names")= chr "J" 564s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 564s Named num(0) 564s - attr(*, "names")= chr(0) 564s Named num(0) 564s - attr(*, "names")= chr(0) 564s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 564s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 564s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 564s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 564s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 564s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 564s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 564s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 564s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 564s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 564s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 564s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 564s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 564s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 564s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 564s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 564s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 564s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 564s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 564s num [1:4] 0.368 42.988 15.396 -29.313 564s num [1:4] 0.368 42.988 15.396 -29.313 564s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 564s num [1:2] 15 -72.3 564s num [1:2] 15 -72.3 564s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 564s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 564s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 564s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 564s num [1:4] -23.52 7.92 11.38 23.27 564s num [1:4] -23.52 7.92 11.38 23.27 564s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 564s num 46.8 564s num 46.8 564s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 564s num(0) 564s num(0) 564s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 564s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 564s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 564s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 564s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 564s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 564s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 564s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 564s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 564s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 564s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 564s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 564s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 564s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 564s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 564s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 564s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 564s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 564s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 564s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 564s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 564s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 564s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 564s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 564s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 564s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 564s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 564s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 564s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 564s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 564s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 564s Named num [1:4] 0.368 42.988 15.396 -29.313 564s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 564s Named num [1:4] 0.368 42.988 15.396 -29.313 565s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 565s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 565s Named num [1:2] 15 -72.3 565s - attr(*, "names")= chr [1:2] "I" "J" 565s Named num [1:2] 15 -72.3 565s - attr(*, "names")= chr [1:2] "I" "J" 565s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 565s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 565s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 565s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 565s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 565s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 565s Named num [1:4] -23.52 7.92 11.38 23.27 565s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 565s Named num [1:4] -23.52 7.92 11.38 23.27 565s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 565s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 565s Named num 46.8 565s - attr(*, "names")= chr "J" 565s Named num 46.8 565s - attr(*, "names")= chr "J" 565s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 565s Named num(0) 565s - attr(*, "names")= chr(0) 565s Named num(0) 565s - attr(*, "names")= chr(0) 565s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 565s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 565s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 565s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 565s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 565s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 565s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 565s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 565s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 565s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 565s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 565s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 565s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 565s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 565s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 565s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 565s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 565s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 565s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 565s num [1:4] 0.368 42.988 15.396 -29.313 565s num [1:4] 0.368 42.988 15.396 -29.313 565s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 565s num [1:2] 15 -72.3 565s num [1:2] 15 -72.3 565s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 565s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 565s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 565s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 565s num [1:4] -23.52 7.92 11.38 23.27 565s num [1:4] -23.52 7.92 11.38 23.27 565s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 565s num 46.8 565s num 46.8 565s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 565s num(0) 565s num(0) 565s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 565s Named num [1:9] -2.929 0.673 8.826 NA NA ... 565s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 565s Named num [1:9] -2.929 0.673 8.826 NA NA ... 565s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 565s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 565s Named num [1:8] 3.6 8.15 NA NA NA ... 565s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 565s Named num [1:8] 3.6 8.15 NA NA NA ... 565s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 565s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 565s Named num [1:7] 4.55 NA NA NA NA ... 565s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 565s Named num [1:7] 4.55 NA NA NA NA ... 565s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 565s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 565s Named num [1:6] NA NA NA NA NA NA 565s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 565s Named num [1:6] NA NA NA NA NA NA 565s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 565s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 565s Named num [1:8] -2.26 9.5 NA NA NA ... 565s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 565s Named num [1:8] -2.26 9.5 NA NA NA ... 566s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 566s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 566s Named num [1:6] NA NA NA NA NA NA 566s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 566s Named num [1:6] NA NA NA NA NA NA 566s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 566s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 566s Named num [1:4] NA NA NA NA 566s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 566s Named num [1:4] NA NA NA NA 566s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 566s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 566s Named num [1:2] NA NA 566s - attr(*, "names")= chr [1:2] "I" "J" 566s Named num [1:2] NA NA 566s - attr(*, "names")= chr [1:2] "I" "J" 566s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 566s Named num [1:7] 6.57 NA NA -16.95 NA ... 566s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 566s Named num [1:7] 6.57 NA NA -16.95 NA ... 566s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 566s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 566s Named num [1:4] -23.5 NA NA 23.3 566s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 566s Named num [1:4] -23.5 NA NA 23.3 566s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 566s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 566s Named num 46.8 566s - attr(*, "names")= chr "J" 566s Named num 46.8 566s - attr(*, "names")= chr "J" 566s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 566s Named num(0) 566s - attr(*, "names")= chr(0) 566s Named num(0) 566s - attr(*, "names")= chr(0) 566s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 566s num [1:9] NA 0.673 8.826 NA NA ... 566s num [1:9] NA 0.673 8.826 NA NA ... 566s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 566s num [1:8] NA 8.15 NA NA NA ... 566s num [1:8] NA 8.15 NA NA NA ... 566s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 566s num [1:7] NA NA NA NA NA NA NA 566s num [1:7] NA NA NA NA NA NA NA 566s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 566s num [1:6] NA NA NA NA NA NA 566s num [1:6] NA NA NA NA NA NA 566s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 566s num [1:8] NA 9.5 NA NA NA ... 566s num [1:8] NA 9.5 NA NA NA ... 566s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 566s num [1:6] NA NA NA NA NA NA 566s num [1:6] NA NA NA NA NA NA 566s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 566s num [1:4] NA NA NA NA 566s num [1:4] NA NA NA NA 566s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 566s num [1:2] NA NA 566s num [1:2] NA NA 566s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 566s num [1:7] NA NA NA NA NA NA NA 566s num [1:7] NA NA NA NA NA NA NA 566s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 566s num [1:4] NA NA NA NA 566s num [1:4] NA NA NA NA 566s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 566s num NA 566s num NA 566s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 566s num(0) 566s num(0) 566s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 566s Named num [1:9] NA 0.673 8.826 NA NA ... 566s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 566s Named num [1:9] NA 0.673 8.826 NA NA ... 566s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 566s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 566s Named num [1:8] NA 8.15 NA NA NA ... 566s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 566s Named num [1:8] NA 8.15 NA NA NA ... 566s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 566s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 566s Named num [1:7] NA NA NA NA NA NA NA 566s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 566s Named num [1:7] NA NA NA NA NA NA NA 566s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 566s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 566s Named num [1:6] NA NA NA NA NA NA 566s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 566s Named num [1:6] NA NA NA NA NA NA 566s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 566s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 566s Named num [1:8] NA 9.5 NA NA NA ... 566s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 566s Named num [1:8] NA 9.5 NA NA NA ... 566s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 566s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 566s Named num [1:6] NA NA NA NA NA NA 566s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 566s Named num [1:6] NA NA NA NA NA NA 566s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 566s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 566s Named num [1:4] NA NA NA NA 566s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 566s Named num [1:4] NA NA NA NA 566s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 566s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 566s Named num [1:2] NA NA 566s - attr(*, "names")= chr [1:2] "I" "J" 566s Named num [1:2] NA NA 566s - attr(*, "names")= chr [1:2] "I" "J" 566s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 566s Named num [1:7] NA NA NA NA NA NA NA 566s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 566s Named num [1:7] NA NA NA NA NA NA NA 566s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 566s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 566s Named num [1:4] NA NA NA NA 566s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 566s Named num [1:4] NA NA NA NA 566s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 566s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 566s Named num NA 566s - attr(*, "names")= chr "J" 566s Named num NA 566s - attr(*, "names")= chr "J" 566s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 566s Named num(0) 566s - attr(*, "names")= chr(0) 566s Named num(0) 566s - attr(*, "names")= chr(0) 566s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 566s num [1:9] NA 0.673 8.826 NA NA ... 566s num [1:9] NA 0.673 8.826 NA NA ... 566s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 566s num [1:8] NA 8.15 NA NA NA ... 566s num [1:8] NA 8.15 NA NA NA ... 566s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 566s num [1:7] NA NA NA NA NA NA NA 566s num [1:7] NA NA NA NA NA NA NA 566s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 566s num [1:6] NA NA NA NA NA NA 566s num [1:6] NA NA NA NA NA NA 566s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 566s num [1:8] NA 9.5 NA NA NA ... 566s num [1:8] NA 9.5 NA NA NA ... 566s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 566s num [1:6] NA NA NA NA NA NA 566s num [1:6] NA NA NA NA NA NA 566s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 566s num [1:4] NA NA NA NA 566s num [1:4] NA NA NA NA 566s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 566s num [1:2] NA NA 566s num [1:2] NA NA 566s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 566s num [1:7] NA NA NA NA NA NA NA 566s num [1:7] NA NA NA NA NA NA NA 566s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 566s num [1:4] NA NA NA NA 566s num [1:4] NA NA NA NA 566s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 566s num NA 566s num NA 566s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 566s num(0) 566s num(0) 566s > 567s 567s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 567s Copyright (C) 2024 The R Foundation for Statistical Computing 567s Platform: aarch64-unknown-linux-gnu (64-bit) 567s 567s R is free software and comes with ABSOLUTELY NO WARRANTY. 567s You are welcome to redistribute it under certain conditions. 567s Type 'license()' or 'licence()' for distribution details. 567s 567s R is a collaborative project with many contributors. 567s Type 'contributors()' for more information and 567s 'citation()' on how to cite R or R packages in publications. 567s 567s Type 'demo()' for some demos, 'help()' for on-line help, or 567s 'help.start()' for an HTML browser interface to help. 567s Type 'q()' to quit R. 567s 567s > library("matrixStats") 567s > 567s > diff2_R <- function(..., useNames=NA){ 567s + res <- diff(...) 567s + if (is.na(useNames) || !useNames) names(res) <- NULL 567s + res 567s + } 567s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 567s > # Subsetted tests 567s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 567s > source("utils/validateIndicesFramework.R") 567s > x <- runif(6, min = -6, max = 6) 567s > for (setNames in c(TRUE, FALSE)) { 567s + if (setNames) names(x) <- LETTERS[1:6] 567s + else names(x) <- NULL 567s + for (l in 1:2) { 567s + for (d in 1:2) { 567s + for (idxs in index_cases) { 567s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 567s + validateIndicesTestVector(x, idxs, 567s + ftest = diff2, fsure = diff2_R, 567s + lag = l, differences = d, useNames = useNames) 567s + } 567s + } 567s + } 567s + } 567s + } 568s > 568s 568s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 568s Copyright (C) 2024 The R Foundation for Statistical Computing 568s Platform: aarch64-unknown-linux-gnu (64-bit) 568s 568s R is free software and comes with ABSOLUTELY NO WARRANTY. 568s You are welcome to redistribute it under certain conditions. 568s Type 'license()' or 'licence()' for distribution details. 568s 568s R is a collaborative project with many contributors. 568s Type 'contributors()' for more information and 568s 'citation()' on how to cite R or R packages in publications. 568s 568s Type 'demo()' for some demos, 'help()' for on-line help, or 568s 'help.start()' for an HTML browser interface to help. 568s Type 'q()' to quit R. 568s 569s > library("matrixStats") 569s > 569s > indexByRow_R1 <- function(dim, idxs = NULL, ...) { 569s + n <- prod(dim) 569s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 569s + if (!is.null(idxs)) 569s + x <- x[idxs] 569s + as.vector(x) 569s + } 569s > 569s > 569s > indexByRow_R2 <- function(dim, idxs = NULL, ...) { 569s + n <- prod(dim) 569s + if (is.null(idxs)) { 569s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 569s + as.vector(x) 569s + } else { 569s + idxs <- idxs - 1L 569s + cols <- idxs %/% dim[2L] 569s + rows <- idxs %% dim[2L] 569s + cols + dim[1L] * rows + 1L 569s + } 569s + } 569s > 569s > 569s > dim <- c(5L, 4L) 569s > x <- matrix(NA_integer_, nrow = dim[1L], ncol = dim[2L]) 569s > y <- t(x) 569s > idxs_by_cols <- seq_along(x) 569s > 569s > # Assign by columns 569s > x[idxs_by_cols] <- idxs_by_cols 569s > print(x) 569s [,1] [,2] [,3] [,4] 569s [1,] 1 6 11 16 569s [2,] 2 7 12 17 569s [3,] 3 8 13 18 569s [4,] 4 9 14 19 569s [5,] 5 10 15 20 569s > 569s > # Truth 569s > y0 <- t(x) 569s > idxs_by_rows <- as.vector(y0) 569s > 569s > # Assert 569s > idxs <- indexByRow(dim) 569s > stopifnot(all.equal(idxs, idxs_by_rows)) 569s > y <- x 569s > y[idxs_by_rows] <- idxs 569s > print(y) 569s [,1] [,2] [,3] [,4] 569s [1,] 1 6 11 16 569s [2,] 2 7 12 17 569s [3,] 3 8 13 18 569s [4,] 4 9 14 19 569s [5,] 5 10 15 20 569s > stopifnot(all(as.vector(y) == as.vector(x))) 569s > 569s > idxs_R1 <- indexByRow_R1(dim) 569s > stopifnot(all.equal(idxs_R1, idxs_by_rows)) 569s > 569s > idxs_R2 <- indexByRow_R2(dim) 569s > stopifnot(all.equal(idxs_R2, idxs_by_rows)) 569s > 569s > # Assert 569s > idxs_by_cols <- seq(from = 1, to = length(x), by = 3L) 569s > idxs_by_rows <- as.vector(t(x)[idxs_by_cols]) 569s > 569s > idxs <- indexByRow(dim, idxs = idxs_by_cols) 569s > stopifnot(all(idxs == idxs_by_rows)) 569s > 569s > idxs_R1 <- indexByRow_R1(dim, idxs = idxs_by_cols) 569s > stopifnot(all(idxs_R1 == idxs_by_rows)) 569s > 569s > idxs_R2 <- indexByRow_R2(dim, idxs = idxs_by_cols) 569s > stopifnot(all(idxs_R2 == idxs_by_rows)) 569s > 569s > 569s > ## DEFUNCT: Backward compatibility 569s > res <- tryCatch({ 569s + idxs1 <- indexByRow(x) 569s + }, error = identity) 569s > stopifnot(inherits(res, "error")) 569s > 569s > 569s > ## Exceptions: 569s > ## Too large matrices are not supported, which happens 569s > ## when prod(dim) > .Machine$integer.max 569s > dim_too_large <- c(.Machine$integer.max, 2L) 569s > res <- tryCatch({ 569s + idxs <- indexByRow(dim_too_large, idxs = 1L) 569s + }, error = identity) 569s > stopifnot(inherits(res, "error")) 569s > 569s > ## Non-positive indices are not supported 569s > res <- tryCatch({ 569s + idxs <- indexByRow(c(1,1), idxs = 0L) 569s + }, error = identity) 569s > stopifnot(inherits(res, "error")) 569s > 569s > res <- tryCatch({ 569s + idxs <- indexByRow(c(1,1), idxs = -1L) 569s + }, error = identity) 569s > stopifnot(inherits(res, "error")) 569s > 570s 570s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 570s Copyright (C) 2024 The R Foundation for Statistical Computing 570s Platform: aarch64-unknown-linux-gnu (64-bit) 570s 570s R is free software and comes with ABSOLUTELY NO WARRANTY. 570s You are welcome to redistribute it under certain conditions. 570s Type 'license()' or 'licence()' for distribution details. 570s 570s R is a collaborative project with many contributors. 570s Type 'contributors()' for more information and 570s 'citation()' on how to cite R or R packages in publications. 570s 570s Type 'demo()' for some demos, 'help()' for on-line help, or 570s 'help.start()' for an HTML browser interface to help. 570s Type 'q()' to quit R. 570s 571s > library("matrixStats") 571s > library("stats") 571s > 571s > logSumExp_R <- function(lx, na.rm = FALSE) { 571s + log(sum(exp(lx), na.rm = na.rm)) 571s + } 571s > 571s > ## R-help thread \emph{'[R] Beyond double-precision?'} on May 9, 2009. 571s > 571s > for (mode in c("integer", "double")) { 571s + cat("mode: ", mode, "\n", sep = "") 571s + 571s + set.seed(1) 571s + x <- runif(20, min = 1.0, max = 3.0) 571s + storage.mode(x) <- mode 571s + str(x) 571s + 571s + ## The logarithm of the harmonic mean 571s + y0 <- log(1 / mean(1 / x)) 571s + print(y0) ## -1.600885 571s + 571s + lx <- log(x) 571s + y1 <- log(length(x)) - logSumExp(-lx) 571s + print(y1) ## [1] -1.600885 571s + 571s + # Sanity check 571s + stopifnot(all.equal(y1, y0)) 571s + 571s + y2 <- log(length(x)) - logSumExp_R(-lx) 571s + # Sanity check 571s + stopifnot(all.equal(y2, y0)) 571s + } # for (mode ...) 571s mode: integer 572s int [1:20] 1 1 2 2 1 2 2 2 2 1 ... 572s [1] 0.3215836 572s [1] 0.3215836 572s mode: double 572s num [1:20] 1.53 1.74 2.15 2.82 1.4 ... 572s [1] 0.6673156 572s [1] 0.6673156 572s > 572s > 572s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 572s > # Missing values 572s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 572s > ## NA values 572s > lx <- c(1, 2, 3) 572s > lx[2] <- NA_real_ 572s > y0 <- logSumExp_R(lx, na.rm = FALSE) 572s > y <- logSumExp(lx, na.rm = FALSE) 572s > print(y) 572s [1] NA 572s > stopifnot(identical(y, NA_real_)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > y0 <- logSumExp_R(lx, na.rm = TRUE) 572s > y <- logSumExp(lx, na.rm = TRUE) 572s > print(y) 572s [1] 3.126928 572s > stopifnot(all.equal(y, y0)) 572s > 572s > ## NaN values 572s > lx <- c(1, 2, 3) 572s > lx[2] <- NaN 572s > y0 <- logSumExp_R(lx, na.rm = FALSE) 572s > y <- logSumExp(lx, na.rm = FALSE) 572s > print(y) 572s [1] NA 572s > stopifnot(identical(y, NA_real_)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > y0 <- logSumExp_R(lx, na.rm = TRUE) 572s > y <- logSumExp(lx, na.rm = TRUE) 572s > print(y) 572s [1] 3.126928 572s > stopifnot(all.equal(y, y0)) 572s > 572s > 572s > 572s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 572s > # Corner cases 572s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 572s > ## Zero-length vectors 572s > lx <- numeric(0L) 572s > y0 <- logSumExp_R(lx) 572s > y <- logSumExp(lx) 572s > print(y) 572s [1] -Inf 572s > stopifnot(identical(y, -Inf)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > ## Vectors of length one 572s > lx <- 1.0 572s > y0 <- logSumExp_R(lx) 572s > y <- logSumExp(lx) 572s > print(y) 572s [1] 1 572s > stopifnot(identical(y, lx)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > lx <- NA_real_ 572s > y0 <- logSumExp_R(lx, na.rm = TRUE) 572s > y <- logSumExp(lx, na.rm = TRUE) 572s > print(y) 572s [1] -Inf 572s > stopifnot(identical(y, -Inf)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > ## All missing values 572s > lx <- c(NA_real_, NA_real_) 572s > y0 <- logSumExp_R(lx, na.rm = TRUE) 572s > y <- logSumExp(lx, na.rm = TRUE) 572s > print(y) 572s [1] -Inf 572s > stopifnot(identical(y, -Inf)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > lx <- c(NA_real_, NA_real_) 572s > y0 <- logSumExp_R(lx, na.rm = FALSE) 572s > y <- logSumExp(lx, na.rm = FALSE) 572s > print(y) 572s [1] NA 572s > stopifnot(identical(y, NA_real_)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > 572s > ## +Inf values 572s > lx <- c(1, 2, +Inf) 572s > y0 <- logSumExp_R(lx) 572s > y <- logSumExp(lx) 572s > print(y) 572s [1] Inf 572s > stopifnot(identical(y, +Inf)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > ## First element is a missing value, cf. PR #33 572s > lx <- c(NA_real_, 1) 572s > y0 <- logSumExp_R(lx) 572s > print(y0) 572s [1] NA 572s > y <- logSumExp(lx, na.rm = FALSE) 572s > print(y) 572s [1] NA 572s > stopifnot(identical(y, NA_real_)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > y0 <- logSumExp_R(lx, na.rm = TRUE) 572s > print(y0) 572s [1] 1 572s > y <- logSumExp(lx, na.rm = TRUE) 572s > print(y) 572s [1] 1 572s > stopifnot(identical(y, 1)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > ## Multiple -Inf values, cf. issue #84 572s > lx <- c(-Inf, -Inf) 572s > y0 <- logSumExp_R(lx) 572s > y <- logSumExp(lx) 572s > print(y) 572s [1] -Inf 572s > stopifnot(identical(y, -Inf)) 572s > stopifnot(all.equal(y, y0)) 572s > 572s > lx <- c(-Inf, 5, -Inf) 572s > y0 <- logSumExp_R(lx) 572s > y <- logSumExp(lx) 572s > print(y) 572s [1] 5 572s > stopifnot(identical(y, 5)) 572s > stopifnot(all.equal(y, y0)) 572s > 573s 573s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 573s Copyright (C) 2024 The R Foundation for Statistical Computing 573s Platform: aarch64-unknown-linux-gnu (64-bit) 573s 573s R is free software and comes with ABSOLUTELY NO WARRANTY. 573s You are welcome to redistribute it under certain conditions. 573s Type 'license()' or 'licence()' for distribution details. 573s 573s R is a collaborative project with many contributors. 573s Type 'contributors()' for more information and 573s 'citation()' on how to cite R or R packages in publications. 573s 573s Type 'demo()' for some demos, 'help()' for on-line help, or 573s 'help.start()' for an HTML browser interface to help. 573s Type 'q()' to quit R. 573s 574s > library("matrixStats") 574s > 574s > logSumExp_R <- function(lx, na.rm = FALSE) { 574s + log(sum(exp(lx), na.rm = na.rm)) 574s + } 574s > 574s > 574s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 574s > # Subsetted tests 574s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 574s > source("utils/validateIndicesFramework.R") 574s > x <- runif(6, min = -6, max = 6) 574s > for (idxs in index_cases) { 574s + validateIndicesTestVector(x, idxs, 574s + ftest = logSumExp, fsure = logSumExp_R, 574s + na.rm = FALSE) 574s + validateIndicesTestVector(x, idxs, 574s + ftest = logSumExp, fsure = logSumExp_R, 574s + na.rm = TRUE) 574s + } 574s > 574s 574s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 574s Copyright (C) 2024 The R Foundation for Statistical Computing 574s Platform: aarch64-unknown-linux-gnu (64-bit) 574s 574s R is free software and comes with ABSOLUTELY NO WARRANTY. 574s You are welcome to redistribute it under certain conditions. 574s Type 'license()' or 'licence()' for distribution details. 574s 574s R is a collaborative project with many contributors. 574s Type 'contributors()' for more information and 574s 'citation()' on how to cite R or R packages in publications. 574s 574s Type 'demo()' for some demos, 'help()' for on-line help, or 574s 'help.start()' for an HTML browser interface to help. 574s Type 'q()' to quit R. 574s 575s > library("matrixStats") 575s > 575s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 575s > # Consistency checks 575s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 575s > set.seed(1) 575s > 575s > mean2_R <- function(x, na.rm = FALSE, idxs = NULL) { 575s + if (is.null(idxs)) { 575s + mean(x, na.rm = na.rm) 575s + } else { 575s + mean(x[idxs], na.rm = na.rm) 575s + } 575s + } # mean2_R() 575s > 575s > 575s > cat("Consistency checks:\n") 575s Consistency checks: 575s > for (kk in 1:20) { 575s + cat("Random test #", kk, "\n", sep = "") 575s + 575s + # Simulate data in a matrix of any shape 575s + n <- sample(100L, size = 1L) 575s + x <- rnorm(n, sd = 100) 575s + 575s + # Add NAs? 575s + if ((kk %% 4) %in% c(3, 0)) { 575s + cat("Adding NAs\n") 575s + nna <- sample(n, size = 1L) 575s + na_values <- c(NA_real_, NaN) 575s + t <- sample(na_values, size = nna, replace = TRUE) 575s + x[sample(length(x), size = nna)] <- t 575s + } 575s + 575s + # Integer or double? 575s + if ((kk %% 4) %in% c(2, 0)) { 575s + cat("Coercing to integers\n") 575s + storage.mode(x) <- "integer" 575s + } 575s + 575s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 575s + 575s + # Sum over all 575s + y0 <- mean2_R(x, na.rm = na.rm) 575s + y1 <- mean2(x, na.rm = na.rm) 575s + stopifnot(all.equal(y1, y0)) 575s + 575s + # Sum over subset 575s + nidxs <- sample(n, size = 1L) 575s + idxs <- sample(n, size = nidxs) 575s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 575s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 575s + stopifnot(all.equal(y1, y0)) 575s + 575s + if (storage.mode(x) == "integer") { 575s + storage.mode(x) <- "logical" 575s + 575s + y0 <- mean2_R(x, na.rm = na.rm) 575s + y1 <- mean2(x, na.rm = na.rm) 575s + stopifnot(all.equal(y1, y0)) 575s + 575s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 575s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 575s + stopifnot(all.equal(y1, y0)) 575s + } 575s + } # for (kk ...) 576s Random test #1 576s Random test #2 576s Coercing to integers 576s Random test #3 576s Adding NAs 576s Random test #4 576s Adding NAs 576s Coercing to integers 576s Random test #5 576s Random test #6 576s Coercing to integers 576s Random test #7 576s Adding NAs 576s Random test #8 576s Adding NAs 576s Coercing to integers 576s Random test #9 576s Random test #10 576s Coercing to integers 576s Random test #11 576s Adding NAs 576s Random test #12 576s Adding NAs 576s Coercing to integers 576s Random test #13 576s Random test #14 576s Coercing to integers 576s Random test #15 576s Adding NAs 576s Random test #16 576s Adding NAs 576s Coercing to integers 576s Random test #17 576s Random test #18 576s Coercing to integers 576s Random test #19 576s Adding NAs 576s Random test #20 576s Adding NAs 576s Coercing to integers 576s > 576s > 576s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 576s > # Special cases 576s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 576s > for (na.rm in c(FALSE, TRUE)) { 576s + # Averaging over zero elements (integers) 576s + x <- integer(0) 576s + s1 <- mean(x, na.rm = na.rm) 576s + s2 <- mean2(x, na.rm = na.rm) 576s + stopifnot(identical(s1, s2)) 576s + 576s + x <- 1:5 576s + idxs <- integer(0) 576s + s1 <- mean(x[idxs], na.rm = na.rm) 576s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 576s + stopifnot(identical(s1, s2)) 576s + 576s + # Averaging over NA_integer_:s 576s + x <- rep(NA_integer_, times = 5L) 576s + s1 <- mean(x, na.rm = na.rm) 576s + s2 <- mean2(x, na.rm = na.rm) 576s + stopifnot(identical(s1, s2)) 576s + 576s + x <- rep(NA_integer_, times = 5L) 576s + idxs <- 1:3 576s + s1 <- mean(x[idxs], na.rm = na.rm) 576s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 576s + stopifnot(identical(s1, s2)) 576s + 576s + 576s + # Averaging over zero elements (doubles) 576s + x <- double(0) 576s + s1 <- mean(x) 576s + s2 <- mean2(x) 576s + stopifnot(identical(s1, s2)) 576s + 576s + x <- as.double(1:10) 576s + idxs <- integer(0) 576s + s1 <- mean(x[idxs]) 576s + s2 <- mean2(x, idxs = idxs) 576s + stopifnot(identical(s1, s2)) 576s + 576s + # Averaging over NA_real_:s 576s + x <- rep(NA_real_, times = 5L) 576s + s1 <- mean(x, na.rm = na.rm) 576s + s2 <- mean2(x, na.rm = na.rm) 576s + stopifnot(identical(s1, s2)) 576s + 576s + x <- rep(NA_real_, times = 5L) 576s + idxs <- 1:3 576s + s1 <- mean(x[idxs], na.rm = na.rm) 576s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 576s + stopifnot(identical(s1, s2)) 576s + 576s + # Averaging over -Inf:s 576s + x <- rep(-Inf, times = 3L) 576s + s1 <- mean(x, na.rm = na.rm) 576s + s2 <- mean2(x, na.rm = na.rm) 576s + stopifnot(identical(s1, s2)) 576s + 576s + # Averaging over +Inf:s 576s + x <- rep(+Inf, times = 3L) 576s + s1 <- mean(x, na.rm = na.rm) 576s + s2 <- mean2(x, na.rm = na.rm) 576s + stopifnot(identical(s1, s2)) 576s + 576s + # Averaging over mix of -Inf:s and +Inf:s 576s + x <- rep(c(-Inf, +Inf), times = 3L) 576s + s1 <- mean(x, na.rm = na.rm) 576s + s2 <- mean2(x, na.rm = na.rm) 576s + stopifnot(identical(s1, s2)) 576s + 576s + # Averaging over mix of -Inf:s and +Inf:s and numerics 576s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 576s + s1 <- mean(x, na.rm = na.rm) 576s + s2 <- mean2(x, na.rm = na.rm) 576s + stopifnot(identical(s1, s2)) 576s + 576s + # Averaging over mix of NaN, NA, +Inf, and numerics 576s + x <- c(NaN, NA, +Inf, 3.14) 576s + s1 <- mean(x, na.rm = na.rm) 576s + s2 <- mean2(x, na.rm = na.rm) 576s + if (na.rm) { 576s + stopifnot(identical(s2, s1)) 576s + } else { 576s + stopifnot(is.na(s1), is.na(s2)) 576s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 576s + ## returned here (as one would expect). NaN might very well be returned, 576s + ## when both NA and NaN are involved. This is an accepted feature in R, 576s + ## which is documented in help("is.nan"). See also 576s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 576s + ## Thus, we cannot guarantee that s1 is identical to s0. 576s + } 576s + 576s + # Averaging over mix of NaN, NA_real_, +Inf, and numerics 576s + x <- c(NA_real_, NaN, +Inf, 3.14) 576s + s1 <- mean(x, na.rm = na.rm) 576s + s2 <- mean2(x, na.rm = na.rm) 576s + if (na.rm) { 576s + stopifnot(identical(s2, s1)) 576s + } else { 576s + stopifnot(is.na(s1), is.na(s2)) 576s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 576s + ## returned here (as one would expect). NaN might very well be returned, 576s + ## when both NA and NaN are involved. This is an accepted feature in R, 576s + ## which is documented in help("is.nan"). See also 576s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 576s + ## Thus, we cannot guarantee that s1 is identical to s0. 576s + } 576s + } 576s > 576s > 576s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 576s > # Argument 'idxs' 576s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 576s > x <- 1:5 576s > idxs_list <- list( 576s + integer = 1:3, 576s + double = as.double(1:3), 576s + logical = (x <= 3) 576s + ) 576s > 576s > for (idxs in idxs_list) { 576s + cat("idxs:\n") 576s + str(idxs) 576s + s1 <- mean(x[idxs], na.rm = TRUE) 576s + s2 <- mean2(x, idxs = idxs, na.rm = TRUE) 576s + stopifnot(identical(s1, s2)) 576s + } 577s idxs: 577s int [1:3] 1 2 3 577s idxs: 577s num [1:3] 1 2 3 577s idxs: 577s logi [1:5] TRUE TRUE TRUE FALSE FALSE 577s > 577s 577s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 577s Copyright (C) 2024 The R Foundation for Statistical Computing 577s Platform: aarch64-unknown-linux-gnu (64-bit) 577s 577s R is free software and comes with ABSOLUTELY NO WARRANTY. 577s You are welcome to redistribute it under certain conditions. 577s Type 'license()' or 'licence()' for distribution details. 577s 577s R is a collaborative project with many contributors. 577s Type 'contributors()' for more information and 577s 'citation()' on how to cite R or R packages in publications. 577s 577s Type 'demo()' for some demos, 'help()' for on-line help, or 577s 'help.start()' for an HTML browser interface to help. 577s Type 'q()' to quit R. 577s 578s > library("matrixStats") 578s > 578s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 578s > # Subsetted tests 578s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 578s > source("utils/validateIndicesFramework.R") 578s > x <- runif(6, min = -6, max = 6) 578s > storage.mode(x) <- "integer" 578s > for (idxs in index_cases) { 578s + validateIndicesTestVector(x, idxs, 578s + ftest = mean2, fsure = mean, 578s + na.rm = FALSE) 578s + validateIndicesTestVector(x, idxs, 578s + ftest = mean2, fsure = mean, 578s + na.rm = TRUE) 578s + } 579s > 579s 579s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 579s Copyright (C) 2024 The R Foundation for Statistical Computing 579s Platform: aarch64-unknown-linux-gnu (64-bit) 579s 579s R is free software and comes with ABSOLUTELY NO WARRANTY. 579s You are welcome to redistribute it under certain conditions. 579s Type 'license()' or 'licence()' for distribution details. 579s 579s R is a collaborative project with many contributors. 579s Type 'contributors()' for more information and 579s 'citation()' on how to cite R or R packages in publications. 579s 579s Type 'demo()' for some demos, 'help()' for on-line help, or 579s 'help.start()' for an HTML browser interface to help. 579s Type 'q()' to quit R. 579s 580s > library("matrixStats") 581s > 581s > for (mode in c("integer", "double")) { 581s + cat("mode: ", mode, "\n", sep = "") 581s + 581s + # Empty vector 581s + x <- 0 581s + storage.mode(x) <- mode 581s + y <- prod(x, na.rm = TRUE) 581s + print(y) 581s + z <- product(x, na.rm = TRUE) 581s + print(z) 581s + stopifnot(all.equal(z, y)) 581s + 581s + # Test negative values 581s + x <- c(1, -4, 2) 581s + storage.mode(x) <- mode 581s + y <- prod(x, na.rm = TRUE) 581s + print(y) 581s + z <- product(x, na.rm = TRUE) 581s + print(z) 581s + stopifnot(all.equal(z, y)) 581s + 581s + # Test missing values 581s + x <- c(1, NA, NaN, 2) 581s + storage.mode(x) <- mode 581s + y <- prod(x, na.rm = TRUE) 581s + print(y) 581s + z <- product(x, na.rm = TRUE) 581s + print(z) 581s + stopifnot(all.equal(z, y)) 581s + 581s + x <- c(1, NA, NaN, 2) 581s + storage.mode(x) <- mode 581s + y <- prod(x, na.rm = FALSE) 581s + print(y) 581s + z <- product(x, na.rm = FALSE) 581s + print(z) 581s + stopifnot(all(is.na(z), is.na(y))) 581s + 581s + x <- c(1, NaN, 2) 581s + storage.mode(x) <- mode 581s + y <- prod(x, na.rm = FALSE) 581s + print(y) 581s + stopifnot(is.na(y)) 581s + z <- product(x, na.rm = FALSE) 581s + print(z) 581s + stopifnot(is.na(z)) 581s + 581s + } # for (mode ...) 581s mode: integer 581s [1] 0 581s [1] 0 581s [1] -8 581s [1] -8 581s [1] 2 581s [1] 2 581s [1] NA 581s [1] NA 581s [1] NA 581s [1] NA 581s mode: double 581s [1] 0 581s [1] 0 581s [1] -8 581s [1] -8 581s [1] 2 581s [1] 2 581s [1] NA 581s [1] NA 581s [1] NaN 581s [1] NA 581s > 581s > 581s > # NAs following 0s 581s > x <- c(0L, NA_integer_) 581s > y <- prod(x, na.rm = FALSE) 581s > print(y) 581s [1] NA 581s > z <- product(x, na.rm = FALSE) 581s > print(z) 581s [1] NA 581s > stopifnot(identical(z, y)) 581s > 582s 582s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 582s Copyright (C) 2024 The R Foundation for Statistical Computing 582s Platform: aarch64-unknown-linux-gnu (64-bit) 582s 582s R is free software and comes with ABSOLUTELY NO WARRANTY. 582s You are welcome to redistribute it under certain conditions. 582s Type 'license()' or 'licence()' for distribution details. 582s 582s R is a collaborative project with many contributors. 582s Type 'contributors()' for more information and 582s 'citation()' on how to cite R or R packages in publications. 582s 582s Type 'demo()' for some demos, 'help()' for on-line help, or 582s 'help.start()' for an HTML browser interface to help. 582s Type 'q()' to quit R. 582s 583s > library("matrixStats") 584s > 584s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 584s > # Subsetted tests 584s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 584s > source("utils/validateIndicesFramework.R") 584s > x <- runif(6, min = -6, max = 6) 584s > storage.mode(x) <- "integer" 584s > for (idxs in index_cases) { 584s + validateIndicesTestVector(x, idxs, 584s + ftest = product, fsure = prod, 584s + na.rm = TRUE) 584s + validateIndicesTestVector(x, idxs, 584s + ftest = product, fsure = prod, 584s + na.rm = FALSE) 584s + } 584s > 586s 586s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 586s Copyright (C) 2024 The R Foundation for Statistical Computing 586s Platform: aarch64-unknown-linux-gnu (64-bit) 586s 586s R is free software and comes with ABSOLUTELY NO WARRANTY. 586s You are welcome to redistribute it under certain conditions. 586s Type 'license()' or 'licence()' for distribution details. 586s 586s R is a collaborative project with many contributors. 586s Type 'contributors()' for more information and 586s 'citation()' on how to cite R or R packages in publications. 586s 586s Type 'demo()' for some demos, 'help()' for on-line help, or 586s 'help.start()' for an HTML browser interface to help. 586s Type 'q()' to quit R. 586s 587s > library("matrixStats") 587s > library("utils") ## utils::str 587s > 587s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 587s > # Local functions 587s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 587s > psortKM_R <- function(x, k, m) { 587s + x <- sort(x) 587s + x[(k - m + 1):k] 587s + } 587s > 587s > psortKM_R2 <- function(x, k, m) { 587s + partial <- (k - m + 1):k 587s + x <- sort.int(x, partial = partial) 587s + x[partial] 587s + } 587s > 587s > 587s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 587s > # Consistency checks 587s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 587s > set.seed(1) 587s > 587s > cat("Consistency checks:\n") 587s Consistency checks: 587s > x <- 1:30 587s > x[18:20] <- 20 587s > y <- sample(x) 587s > cat("x:\n") 587s x: 587s > str(x) 587s num [1:30] 1 2 3 4 5 6 7 8 9 10 ... 587s > cat("sample(x):\n") 587s sample(x): 587s > str(y) 587s num [1:30] 25 4 7 1 2 23 11 14 20 20 ... 587s > 587s > for (k in c(1L, 2L, 20L, 21L, length(x))) { 587s + for (m in 1:min(5L, k)) { 587s + px0 <- psortKM_R(x, k = k, m = m) 587s + px0b <- psortKM_R2(x, k = k, m = m) 587s + stopifnot(identical(px0b, px0)) 587s + px1 <- matrixStats:::.psortKM(x, k = k, m = m) 587s + cat(sprintf(".psortKM(x, k = %d, m = %d):\n", k, m)) 587s + print(px1) 587s + stopifnot(identical(px1, px0)) 587s + 587s + py0 <- psortKM_R(y, k = k, m = m) 587s + py0b <- psortKM_R2(y, k = k, m = m) 587s + stopifnot(identical(py0b, py0)) 587s + py1 <- matrixStats:::.psortKM(y, k = k, m = m) 587s + cat(sprintf(".psortKM(y, k = %d, m = %d):\n", k, m)) 587s + print(py1) 587s + stopifnot(identical(py1, py0)) 587s + stopifnot(identical(py1, px1)) 587s + } # for (m ...) 587s + } # for (k ...) 587s .psortKM(x, k = 1, m = 1): 587s [1] 1 587s .psortKM(y, k = 1, m = 1): 587s [1] 1 587s .psortKM(x, k = 2, m = 1): 587s [1] 2 587s .psortKM(y, k = 2, m = 1): 587s [1] 2 587s .psortKM(x, k = 2, m = 2): 587s [1] 1 2 587s .psortKM(y, k = 2, m = 2): 587s [1] 1 2 587s .psortKM(x, k = 20, m = 1): 587s [1] 20 587s .psortKM(y, k = 20, m = 1): 587s [1] 20 587s .psortKM(x, k = 20, m = 2): 587s [1] 20 20 587s .psortKM(y, k = 20, m = 2): 587s [1] 20 20 587s .psortKM(x, k = 20, m = 3): 587s [1] 20 20 20 587s .psortKM(y, k = 20, m = 3): 587s [1] 20 20 20 587s .psortKM(x, k = 20, m = 4): 587s [1] 17 20 20 20 587s .psortKM(y, k = 20, m = 4): 587s [1] 17 20 20 20 587s .psortKM(x, k = 20, m = 5): 587s [1] 16 17 20 20 20 587s .psortKM(y, k = 20, m = 5): 587s [1] 16 17 20 20 20 587s .psortKM(x, k = 21, m = 1): 587s [1] 21 587s .psortKM(y, k = 21, m = 1): 587s [1] 21 587s .psortKM(x, k = 21, m = 2): 587s [1] 20 21 587s .psortKM(y, k = 21, m = 2): 587s [1] 20 21 587s .psortKM(x, k = 21, m = 3): 587s [1] 20 20 21 587s .psortKM(y, k = 21, m = 3): 587s [1] 20 20 21 587s .psortKM(x, k = 21, m = 4): 587s [1] 20 20 20 21 587s .psortKM(y, k = 21, m = 4): 587s [1] 20 20 20 21 587s .psortKM(x, k = 21, m = 5): 587s [1] 17 20 20 20 21 587s .psortKM(y, k = 21, m = 5): 587s [1] 17 20 20 20 21 587s .psortKM(x, k = 30, m = 1): 587s [1] 30 587s .psortKM(y, k = 30, m = 1): 587s [1] 30 587s .psortKM(x, k = 30, m = 2): 587s [1] 29 30 587s .psortKM(y, k = 30, m = 2): 587s [1] 29 30 587s .psortKM(x, k = 30, m = 3): 587s [1] 28 29 30 587s .psortKM(y, k = 30, m = 3): 587s [1] 28 29 30 587s .psortKM(x, k = 30, m = 4): 587s [1] 27 28 29 30 587s .psortKM(y, k = 30, m = 4): 587s [1] 27 28 29 30 587s .psortKM(x, k = 30, m = 5): 587s [1] 26 27 28 29 30 587s .psortKM(y, k = 30, m = 5): 587s [1] 26 27 28 29 30 587s > 587s 587s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 587s Copyright (C) 2024 The R Foundation for Statistical Computing 587s Platform: aarch64-unknown-linux-gnu (64-bit) 587s 587s R is free software and comes with ABSOLUTELY NO WARRANTY. 587s You are welcome to redistribute it under certain conditions. 587s Type 'license()' or 'licence()' for distribution details. 587s 587s R is a collaborative project with many contributors. 587s Type 'contributors()' for more information and 587s 'citation()' on how to cite R or R packages in publications. 587s 587s Type 'demo()' for some demos, 'help()' for on-line help, or 587s 'help.start()' for an HTML browser interface to help. 587s Type 'q()' to quit R. 587s 588s > library("matrixStats") 588s > 588s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = NA) { 588s + if (is.na(value)) { 588s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 588s + } else { 588s + y <- x == value 588s + 588s + # Preserve dimnames attribute 588s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 588s + if (!isTRUE(all.equal(dim(y), dim))) { 588s + dim(y) <- dim 588s + dimnames(y) <- dimnames(x) 588s + } 588s + 588s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 588s + } 588s + if (is.na(useNames) || !useNames) names(res) <- NULL 588s + res 588s + } 588s > 588s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = NA) { 588s + if (is.na(value)) { 588s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 588s + } else { 588s + y <- x == value 588s + 588s + # Preserve dimnames attribute 588s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 588s + if (!isTRUE(all.equal(dim(y), dim))) { 588s + dim(y) <- dim 588s + dimnames(y) <- dimnames(x) 588s + } 588s + 588s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 588s + } 588s + if (is.na(useNames) || !useNames) names(res) <- NULL 588s + res 588s + } 588s > 588s > rowAnyMissings_R <- function(x, ..., useNames = NA) { 588s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 588s + if (is.na(useNames) || !useNames) names(res) <- NULL 588s + res 588s + } 588s > 588s > 588s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 588s > # Data type: logical 588s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 588s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 588s > x[7:8, 2:3] <- TRUE 588s > x[1:3, ] <- TRUE 588s > x[, 1] <- TRUE 588s > x[4, ] <- FALSE 588s > x[, 4] <- FALSE 588s > x[2, ] <- FALSE 588s > x[3, ] <- TRUE 588s > 588s > # To check names attribute 588s > dimnames <- list(letters[1:10], LETTERS[1:4]) 588s > 588s > for (kk in 1:3) { 588s + if (kk == 2) { 588s + x[2, 2] <- NA 588s + } else if (kk == 3) { 588s + x[, 2] <- NA 588s + x[2, ] <- NA 588s + } 588s + 588s + # Test with and without dimnames on x 588s + for (setDimnames in c(TRUE, FALSE)) { 588s + dimnames(x) <- if (setDimnames) dimnames else NULL 588s + 588s + for (na.rm in c(FALSE, TRUE)) { 588s + # Check names attribute 588s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 588s + m0 <- rowAlls_R(x, na.rm = na.rm, useNames = useNames) 588s + m1 <- rowAlls(x, na.rm = na.rm, useNames = useNames) 588s + m2 <- colAlls(t(x), na.rm = na.rm, useNames = useNames) 588s + str(list("all()", m0 = m0, m1 = m1, m2 = m2)) 588s + stopifnot(identical(m1, m0)) 588s + stopifnot(identical(m2, m0)) 588s + 588s + m0 <- rowAnys_R(x, na.rm = na.rm, useNames = useNames) 588s + m1 <- rowAnys(x, na.rm = na.rm, useNames = useNames) 588s + m2 <- colAnys(t(x), na.rm = na.rm, useNames = useNames) 588s + str(list("any()", m0 = m0, m1 = m1, m2 = m2)) 588s + stopifnot(identical(m1, m0)) 588s + stopifnot(identical(m2, m0)) 588s + 588s + m0 <- rowAnyMissings_R(x, useNames = useNames) 588s + m1 <- rowAnyMissings(x, useNames = useNames) 588s + m2 <- colAnyMissings(t(x), useNames = useNames) 588s + str(list("anyMissing()", m0 = m0, m1 = m1, m2 = m2)) 588s + stopifnot(identical(m1, m0)) 588s + stopifnot(identical(m2, m0)) 588s + } 588s + } 588s + } 588s + } # for (kk ...) 589s List of 4 589s $ : chr "all()" 589s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s List of 4 589s $ : chr "any()" 589s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s List of 4 589s $ : chr "anyMissing()" 589s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s List of 4 589s $ : chr "all()" 589s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s List of 4 589s $ : chr "any()" 589s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s List of 4 589s $ : chr "anyMissing()" 589s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s List of 4 589s $ : chr "all()" 589s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s List of 4 589s $ : chr "any()" 589s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s List of 4 589s $ : chr "anyMissing()" 589s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 589s List of 4 589s $ : chr "all()" 589s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s List of 4 589s $ : chr "any()" 589s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s List of 4 589s $ : chr "anyMissing()" 589s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s List of 4 589s $ : chr "all()" 589s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s List of 4 589s $ : chr "any()" 589s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 589s List of 4 589s $ : chr "anyMissing()" 589s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 589s List of 4 589s $ : chr "all()" 589s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 589s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s List of 4 590s $ : chr "any()" 590s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 590s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 590s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 590s List of 4 590s $ : chr "anyMissing()" 590s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 590s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 590s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 590s List of 4 590s $ : chr "all()" 590s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s List of 4 590s $ : chr "any()" 590s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 590s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 590s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 590s List of 4 590s $ : chr "anyMissing()" 590s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 590s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 590s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 590s List of 4 590s $ : chr "all()" 590s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s List of 4 590s $ : chr "any()" 590s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 590s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 590s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 590s List of 4 590s $ : chr "anyMissing()" 590s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 590s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 590s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 590s List of 4 590s $ : chr "all()" 590s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s List of 4 590s $ : chr "any()" 590s $ m0: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s $ m1: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s $ m2: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s List of 4 590s $ : chr "anyMissing()" 590s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s List of 4 590s $ : chr "all()" 590s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s List of 4 590s $ : chr "any()" 590s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 590s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 590s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 590s List of 4 590s $ : chr "anyMissing()" 590s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 590s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 590s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 590s List of 4 590s $ : chr "all()" 590s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s List of 4 590s $ : chr "any()" 590s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 590s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 590s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s List of 4 591s $ : chr "anyMissing()" 591s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s List of 4 591s $ : chr "all()" 591s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "any()" 591s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s List of 4 591s $ : chr "anyMissing()" 591s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "all()" 591s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "any()" 591s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 591s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 591s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 591s List of 4 591s $ : chr "anyMissing()" 591s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "all()" 591s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "any()" 591s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 591s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 591s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 591s List of 4 591s $ : chr "anyMissing()" 591s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "all()" 591s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "any()" 591s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s List of 4 591s $ : chr "anyMissing()" 591s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "all()" 591s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "any()" 591s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 591s List of 4 591s $ : chr "anyMissing()" 591s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "all()" 591s $ m0: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m1: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m2: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s List of 4 591s $ : chr "any()" 591s $ m0: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m1: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m2: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s List of 4 591s $ : chr "anyMissing()" 591s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s List of 4 591s $ : chr "all()" 591s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 591s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 591s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 591s List of 4 591s $ : chr "any()" 591s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 591s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 591s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 591s List of 4 591s $ : chr "anyMissing()" 591s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 591s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 591s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 591s List of 4 591s $ : chr "all()" 591s $ m0: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m1: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s $ m2: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 591s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 591s List of 4 591s $ : chr "any()" 592s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 592s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 592s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 592s List of 4 592s $ : chr "anyMissing()" 592s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 592s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 592s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 592s List of 4 592s $ : chr "all()" 592s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 592s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 592s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 592s List of 4 592s $ : chr "any()" 592s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s List of 4 592s $ : chr "anyMissing()" 592s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s List of 4 592s $ : chr "all()" 592s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 592s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 592s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 592s List of 4 592s $ : chr "any()" 592s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 592s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 592s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 592s List of 4 592s $ : chr "anyMissing()" 592s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s List of 4 592s $ : chr "all()" 592s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 592s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 592s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 592s List of 4 592s $ : chr "any()" 592s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 592s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 592s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 592s List of 4 592s $ : chr "anyMissing()" 592s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s List of 4 592s $ : chr "all()" 592s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 592s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 592s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 592s List of 4 592s $ : chr "any()" 592s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s List of 4 592s $ : chr "anyMissing()" 592s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s List of 4 592s $ : chr "all()" 592s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 592s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 592s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 592s List of 4 592s $ : chr "any()" 592s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 592s List of 4 592s $ : chr "anyMissing()" 592s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 592s > 592s > 592s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 592s > # Data type: integer 592s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 592s > x <- matrix(rep(1:6, length.out = 4 * 5), nrow = 4L, ncol = 5L) 592s > x[2, ] <- 7L 592s > x[3, 1] <- 7L 592s > x[2:3, 3:4] <- NA_integer_ 592s > 592s > # To check names attribute 592s > dimnames <- list(letters[1:4], LETTERS[1:5]) 592s > 592s > # Row/column counts 592s > value <- 7L 592s > 592s > # Test with and without dimnames on x 592s > for (setDimnames in c(TRUE, FALSE)) { 592s + dimnames(x) <- if (setDimnames) dimnames else NULL 592s + for (na.rm in c(FALSE, TRUE)) { 592s + # Check names attribute 592s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 592s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 592s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 592s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 592s + stopifnot(identical(r1, r0)) 592s + stopifnot(identical(r2, r1)) 592s + if (!is.na(useNames) && !useNames && !setDimnames) { 592s + for (rr in seq_len(nrow(x))) { 592s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 592s + stopifnot(identical(c, r1[rr])) 592s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 592s + stopifnot(identical(c, r1[rr])) 592s + } 592s + } 592s + 592s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 592s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 592s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 592s + stopifnot(identical(r1, r0)) 592s + stopifnot(identical(r2, r1)) 592s + if (!is.na(useNames) && !useNames && !setDimnames) { 592s + for (rr in seq_len(nrow(x))) { 592s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 592s + stopifnot(identical(c, r1[rr])) 592s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 592s + stopifnot(identical(c, r1[rr])) 592s + } 592s + } 592s + } 592s + } 592s + } 593s > 593s > 593s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 593s > # rowAlls(x) et al. on numeric 'x' with logical 'value' 593s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 593s > x <- matrix(0, nrow = 4L, ncol = 5L) 593s > x[2:4, 2] <- (1:3) / 4 593s > x[2, 2:4] <- (1:3) / 4 593s > x[3:4, 3] <- (3:4) / 4 593s > x[3, 3:4] <- (3:4) / 4 593s > x[1:4, 5] <- (1:4) / 5 593s > x[4, 4] <- NA_real_ 593s > 593s > # To check names attribute 593s > dimnames <- list(letters[1:4], LETTERS[1:5]) 593s > 593s > for (value in c(TRUE, FALSE)) { 593s + for (na.rm in c(FALSE, TRUE)) { 593s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 593s + y <- rowAnys(x, na.rm = na.rm, value = value) 593s + stopifnot(identical(y, y0)) 593s + # Check names attribute 593s + dimnames(x) <- dimnames 593s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 593s + stopifnot(all.equal(y, y0)) 593s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 593s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 593s + stopifnot(all.equal(y, y0)) 593s + dimnames(x) <- NULL 593s + 593s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 593s + y <- colAnys(x, na.rm = na.rm, value = value) 593s + stopifnot(identical(y, y0)) 593s + # Check names attribute 593s + dimnames(x) <- dimnames 593s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 593s + stopifnot(all.equal(y, y0)) 593s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 593s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 593s + stopifnot(all.equal(y, y0)) 593s + dimnames(x) <- NULL 593s + 593s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 593s + y <- rowAlls(x, na.rm = na.rm, value = value) 593s + stopifnot(identical(y, y0)) 593s + # Check names attribute 593s + dimnames(x) <- dimnames 593s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 593s + stopifnot(all.equal(y, y0)) 593s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 593s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 593s + stopifnot(all.equal(y, y0)) 593s + dimnames(x) <- NULL 593s + 593s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 593s + y <- colAlls(x, na.rm = na.rm, value = value) 593s + stopifnot(identical(y, y0)) 593s + print(y0) 593s + # Check names attribute 593s + dimnames(x) <- dimnames 593s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 593s + stopifnot(all.equal(y, y0)) 593s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 593s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 593s + stopifnot(all.equal(y, y0)) 593s + dimnames(x) <- NULL 593s + } ## for (na.rm ...) 593s + } ## for(value ...) 594s [1] FALSE FALSE FALSE FALSE TRUE 594s [1] FALSE FALSE FALSE FALSE TRUE 594s [1] TRUE FALSE FALSE FALSE FALSE 594s [1] TRUE FALSE FALSE FALSE FALSE 594s > 594s > 594s > 594s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 594s > # Data type: character (not sure if this should be supported) 594s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 594s > all_R <- function(x, value = TRUE, ...) { 594s + if (is.na(value)) { 594s + all(is.na(x), ...) 594s + } else { 594s + all(x == value, ...) 594s + } 594s + } 594s > 594s > any_R <- function(x, value = TRUE, ...) { 594s + if (is.na(value)) { 594s + any(is.na(x), ...) 594s + } else { 594s + any(x == value, ...) 594s + } 594s + } 594s > 594s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 594s > x[2, ] <- "g" 594s > x[2:4, 3:4] <- NA_character_ 594s > 594s > # To check names attribute 594s > dimnames <- list(letters[1:10], LETTERS[1:5]) 594s > 594s > # Test with and without dimnames on x 594s > for (setDimnames in c(TRUE, FALSE)) { 594s + dimnames(x) <- if (setDimnames) dimnames else NULL 594s + 594s + # Row/column counts 594s + for (value in c("g", NA_character_)) { 594s + for (na.rm in c(FALSE, TRUE)) { 594s + # Check names attribute 594s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 594s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 594s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 594s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 594s + stopifnot(identical(r1, r0)) 594s + stopifnot(identical(r2, r1)) 594s + if (!is.na(useNames) && !useNames && !setDimnames) { 594s + for (rr in seq_len(nrow(x))) { 594s + c0 <- all_R(x[rr, ], value, na.rm = na.rm) 594s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 594s + stopifnot(identical(c, r1[rr])) 594s + stopifnot(identical(c, c0)) 594s + } 594s + } 594s + 594s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 594s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 594s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 594s + stopifnot(identical(r1, r0)) 594s + stopifnot(identical(r2, r1)) 594s + if (!is.na(useNames) && !useNames && !setDimnames) { 594s + for (rr in seq_len(nrow(x))) { 594s + c0 <- any_R(x[rr, ], value, na.rm = na.rm) 594s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 594s + stopifnot(identical(c, c0)) 594s + stopifnot(identical(c, r1[rr])) 594s + } 594s + } 594s + } 594s + } 594s + } 594s + } 594s > 594s > 594s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 594s > # NA 0 test 594s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 594s > x <- matrix(0, nrow = 3L, ncol = 3L) 594s > x[1, ] <- c(NA_real_, NA_real_, 0) 594s > x[3, ] <- c(1, 0, 1) 594s > 594s > dimnames <- list(letters[1:3], LETTERS[1:3]) 594s > 594s > # Test with and without dimnames on x 594s > for (setDimnames in c(TRUE, FALSE)) { 594s + dimnames(x) <- if (setDimnames) dimnames else NULL 594s + # Check names attribute 594s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 594s + r0 <- rowAnys_R(x, value = 0, useNames = useNames) 594s + r1 <- rowAnys(x, value = 0, useNames = useNames) 594s + stopifnot(identical(r0, r1)) 594s + } 594s + } 594s > 595s 595s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 595s Copyright (C) 2024 The R Foundation for Statistical Computing 595s Platform: aarch64-unknown-linux-gnu (64-bit) 595s 595s R is free software and comes with ABSOLUTELY NO WARRANTY. 595s You are welcome to redistribute it under certain conditions. 595s Type 'license()' or 'licence()' for distribution details. 595s 595s R is a collaborative project with many contributors. 595s Type 'contributors()' for more information and 595s 'citation()' on how to cite R or R packages in publications. 595s 595s Type 'demo()' for some demos, 'help()' for on-line help, or 595s 'help.start()' for an HTML browser interface to help. 595s Type 'q()' to quit R. 595s 596s > library("matrixStats") 596s > 596s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = NA) { 596s + if (is.na(value)) { 596s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 596s + } else { 596s + y <- x == value 596s + 596s + # Preserve dimnames attribute 596s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 596s + if (!isTRUE(all.equal(dim(y), dim))) { 596s + dim(y) <- dim 596s + dimnames(y) <- dimnames(x) 596s + } 596s + 596s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 596s + } 596s + if (is.na(useNames) || !useNames) names(res) <- NULL 596s + res 596s + } 596s > 596s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = NA) { 596s + if (is.na(value)) { 596s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 596s + } else { 596s + y <- x == value 596s + 596s + # Preserve dimnames attribute 596s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 596s + if (!isTRUE(all.equal(dim(y), dim))) { 596s + dim(y) <- dim 596s + dimnames(y) <- dimnames(x) 596s + } 596s + 596s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 596s + } 596s + if (is.na(useNames) || !useNames) names(res) <- NULL 596s + res 596s + } 596s > 596s > rowAnyMissings_R <- function(x, ..., useNames = NA) { 596s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 596s + if (is.na(useNames) || !useNames) names(res) <- NULL 596s + res 596s + } 596s > 596s > 596s > all_R <- function(x, value = TRUE, ...) { 596s + if (is.na(value)) { 596s + all(is.na(x), ...) 596s + } else { 596s + all(x == value, ...) 596s + } 596s + } 596s > 596s > any_R <- function(x, value = TRUE, ...) { 596s + if (is.na(value)) { 596s + any(is.na(x), ...) 596s + } else { 596s + any(x == value, ...) 596s + } 596s + } 596s > 596s > 596s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 596s > # Subsetted tests 596s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 596s > source("utils/validateIndicesFramework.R") 596s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 596s > storage.mode(x) <- "integer" 596s > x[2:3, ] <- NA_integer_ 596s > x[2, 1] <- 0L 596s > x[4:5, ] <- 0L 596s > x[4, 6] <- NA_integer_ 596s > 596s > # To check names attribute 596s > dimnames <- list(letters[1:6], LETTERS[1:6]) 596s > 596s > # Test with and without dimnames on x 596s > for (setDimnames in c(TRUE, FALSE)) { 596s + if (setDimnames) dimnames(x) <- dimnames 596s + else dimnames(x) <- NULL 596s + 596s + count <- 0L 596s + for (rows in index_cases) { 596s + for (cols in index_cases) { 596s + count <- count + 1L 596s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 596s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 596s + useNames <- useNames[count %% length(useNames) + 1] 596s + 596s + validateIndicesTestMatrix(x, rows, cols, 596s + ftest = rowAlls, fsure = rowAlls_R, 596s + value = 0, na.rm = TRUE, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + ftest = rowAlls, fsure = rowAlls_R, 596s + value = 0, na.rm = FALSE, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + ftest = rowAlls, fsure = rowAlls_R, 596s + value = NA_integer_, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + fcoltest = colAlls, fsure = rowAlls_R, 596s + value = 0, na.rm = TRUE, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + fcoltest = colAlls, fsure = rowAlls_R, 596s + value = 0, na.rm = FALSE, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + fcoltest = colAlls, fsure = rowAlls_R, 596s + value = NA_integer_, useNames = useNames) 596s + 596s + validateIndicesTestMatrix(x, rows, cols, 596s + ftest = rowAnys, fsure = rowAnys_R, 596s + value = 0, na.rm = TRUE, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + ftest = rowAnys, fsure = rowAnys_R, 596s + value = 0, na.rm = FALSE, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + ftest = rowAnys, fsure = rowAnys_R, 596s + value = NA_integer_, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + fcoltest = colAnys, fsure = rowAnys_R, 596s + value = 0, na.rm = TRUE, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + fcoltest = colAnys, fsure = rowAnys_R, 596s + value = 0, na.rm = FALSE, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + fcoltest = colAnys, fsure = rowAnys_R, 596s + value = NA_integer_, useNames = useNames) 596s + 596s + validateIndicesTestMatrix(x, rows, cols, 596s + ftest = rowAnyMissings, 596s + fsure = rowAnyMissings_R, useNames = useNames) 596s + validateIndicesTestMatrix(x, rows, cols, 596s + fcoltest = colAnyMissings, 596s + fsure = rowAnyMissings_R, useNames = useNames) 596s + } 596s + } 596s + } 616s > 616s > for (rr in seq_len(nrow(x))) { 616s + for (idxs in index_cases) { 616s + validateIndicesTestVector(x[rr, ], idxs, 616s + ftest = allValue, fsure = all_R, 616s + value = 0, na.rm = TRUE) 616s + validateIndicesTestVector(x[rr, ], idxs, 616s + ftest = allValue, fsure = all_R, 616s + value = 0, na.rm = FALSE) 616s + validateIndicesTestVector(x[rr, ], idxs, 616s + ftest = allValue, fsure = all_R, 616s + value = NA_integer_) 616s + 616s + validateIndicesTestVector(x[rr, ], idxs, 616s + ftest = anyValue, fsure = any_R, 616s + value = 0, na.rm = TRUE) 616s + validateIndicesTestVector(x[rr, ], idxs, 616s + ftest = anyValue, fsure = any_R, 616s + value = 0, na.rm = FALSE) 616s + validateIndicesTestVector(x[rr, ], idxs, 616s + ftest = anyValue, fsure = any_R, 616s + value = NA_integer_) 616s + } 616s + } 618s > 618s > 618s > storage.mode(x) <- "character" 618s > # Test with and without dimnames on x 618s > for (setDimnames in c(TRUE, FALSE)) { 618s + if (setDimnames) dimnames(x) <- dimnames 618s + else dimnames(x) <- NULL 618s + for (rows in index_cases) { 618s + for (cols in index_cases) { 618s + # Check names attribute 618s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 618s + validateIndicesTestMatrix(x, rows, cols, 618s + ftest = rowAlls, fsure = rowAlls_R, 618s + value = "0", na.rm = TRUE, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + ftest = rowAlls, fsure = rowAlls_R, 618s + value = "0", na.rm = FALSE, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + ftest = rowAlls, fsure = rowAlls_R, 618s + value = NA_character_, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + fcoltest = colAlls, fsure = rowAlls_R, 618s + value = "0", na.rm = TRUE, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + fcoltest = colAlls, fsure = rowAlls_R, 618s + value = "0", na.rm = FALSE, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + fcoltest = colAlls, fsure = rowAlls_R, 618s + value = NA_character_, useNames = useNames) 618s + 618s + validateIndicesTestMatrix(x, rows, cols, 618s + ftest = rowAnys, fsure = rowAnys_R, 618s + value = "0", na.rm = TRUE, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + ftest = rowAnys, fsure = rowAnys_R, 618s + value = "0", na.rm = FALSE, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + ftest = rowAnys, fsure = rowAnys_R, 618s + value = NA_character_, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + fcoltest = colAnys, fsure = rowAnys_R, 618s + value = "0", na.rm = TRUE, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + fcoltest = colAnys, fsure = rowAnys_R, 618s + value = "0", na.rm = FALSE, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + fcoltest = colAnys, fsure = rowAnys_R, 618s + value = NA_character_, useNames = useNames) 618s + 618s + validateIndicesTestMatrix(x, rows, cols, 618s + ftest = rowAnyMissings, 618s + fsure = rowAnyMissings_R, useNames = useNames) 618s + validateIndicesTestMatrix(x, rows, cols, 618s + fcoltest = colAnyMissings, 618s + fsure = rowAnyMissings_R, useNames = useNames) 618s + } 618s + } 618s + } 618s + } 653s > 653s > for (rr in seq_len(nrow(x))) { 653s + for (idxs in index_cases) { 653s + validateIndicesTestVector(x[rr, ], idxs, 653s + ftest = allValue, fsure = all_R, 653s + value = "0", na.rm = TRUE) 653s + validateIndicesTestVector(x[rr, ], idxs, 653s + ftest = allValue, fsure = all_R, 653s + value = "0", na.rm = FALSE) 653s + validateIndicesTestVector(x[rr, ], idxs, 653s + ftest = allValue, fsure = all_R, 653s + value = NA_integer_) 653s + 653s + validateIndicesTestVector(x[rr, ], idxs, 653s + ftest = anyValue, fsure = any_R, 653s + value = "0", na.rm = TRUE) 653s + validateIndicesTestVector(x[rr, ], idxs, 653s + ftest = anyValue, fsure = any_R, 653s + value = "0", na.rm = FALSE) 653s + validateIndicesTestVector(x[rr, ], idxs, 653s + ftest = anyValue, fsure = any_R, 653s + value = NA_integer_) 653s + } 653s + } 653s > 654s 654s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 654s Copyright (C) 2024 The R Foundation for Statistical Computing 654s Platform: aarch64-unknown-linux-gnu (64-bit) 654s 654s R is free software and comes with ABSOLUTELY NO WARRANTY. 654s You are welcome to redistribute it under certain conditions. 654s Type 'license()' or 'licence()' for distribution details. 654s 654s R is a collaborative project with many contributors. 654s Type 'contributors()' for more information and 654s 'citation()' on how to cite R or R packages in publications. 654s 654s Type 'demo()' for some demos, 'help()' for on-line help, or 654s 'help.start()' for an HTML browser interface to help. 654s Type 'q()' to quit R. 654s 655s > library("matrixStats") 655s > 655s > X <- matrix(rnorm(20 * 6), nrow = 20, ncol = 6) 655s > rownames(X) <- LETTERS[1:nrow(X)] 655s > colnames(X) <- letters[1:ncol(X)] 655s > print(X) 655s a b c d e f 655s A 1.07326573 -0.088699015 1.56656894 -0.9358541 -0.22083242 -0.41076033 655s B -1.09751131 0.797220253 0.26226451 -0.1529989 -1.78654114 1.53877290 655s C 1.96407049 1.532980331 -1.74748423 -2.3490654 -0.36049575 0.39997173 655s D 0.65446056 -1.108654540 -0.18721818 1.7013571 1.15780597 0.55475018 655s E -0.98395252 0.028867929 -0.68378299 1.8078415 1.32891656 0.10541775 655s F -0.64972627 0.084992943 -1.39445552 -0.1326834 -1.40006803 0.91328460 655s G -0.69253218 0.160549187 -1.02022026 0.3566929 -2.38675576 0.67633605 655s H 0.11714090 -0.489855801 1.50924841 -0.7376881 0.08316214 -0.08253617 655s I 0.61912519 -0.003220554 -1.25613317 1.3146103 0.12115881 0.01086374 655s J 0.58705786 0.818218157 -0.14115439 -0.4949682 1.81614025 1.97436496 655s K -2.02151023 1.189041975 0.06016302 0.1676082 -0.54830340 -1.06988927 655s L -1.12315317 -0.334284821 0.05761103 -1.1089662 -0.05652822 -0.92571603 655s M -1.57817117 0.936021584 -0.36902206 1.3796328 1.07520063 -0.18977278 655s N -0.44506039 -0.153864847 -1.10861650 -2.8460863 -0.88718618 -0.35391444 655s O -1.03710341 0.944413133 0.82765262 -0.1376867 1.45469570 -1.69282834 655s P -0.46789578 -0.656570740 -0.25466560 -0.4158836 -0.51498253 -1.36538447 655s Q 0.15656416 0.660206039 -0.70060236 -1.8904722 -0.23444198 0.66716522 655s R -0.70379259 0.122362128 1.07954187 -1.1420435 0.61080144 2.95621949 655s S 0.06275807 -1.128019108 0.32160587 -0.3550328 -0.85551059 0.43785678 655s T 1.68471163 0.442035544 0.08383949 -0.3672138 1.96507181 -0.01810931 655s > 655s > 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > # Apply rowMeans() for 3 sets of 2 columns 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > nbr_of_sets <- 3L 655s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 655s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 655s > print(S) 655s s1 s2 s3 655s [1,] 1 3 5 655s [2,] 2 4 6 655s > 655s > Z <- rowAvgsPerColSet(X, S = S) 655s > print(Z) 655s s1 s2 s3 655s A 0.49228336 0.31535740 -0.3157963740 655s B -0.15014553 0.05463282 -0.1238841171 655s C 1.74852541 -2.04827483 0.0197379930 655s D -0.22709699 0.75706945 0.8562780771 655s E -0.47754230 0.56202923 0.7171671506 655s F -0.28236666 -0.76356944 -0.2433917142 655s G -0.26599150 -0.33176369 -0.8552098572 655s H -0.18635745 0.38578014 0.0003129848 655s I 0.30795232 0.02923856 0.0660112744 655s J 0.70263801 -0.31806131 1.8952526081 655s K -0.41623413 0.11388560 -0.8090963355 655s L -0.72871900 -0.52567760 -0.4911221248 655s M -0.32107479 0.50530539 0.4427139277 655s N -0.29946262 -1.97735142 -0.6205503096 655s O -0.04634514 0.34498295 -0.1190663175 655s P -0.56223326 -0.33527459 -0.9401834991 655s Q 0.40838510 -1.29553728 0.2163616167 655s R -0.29071523 -0.03125083 1.7835104633 655s S -0.53263052 -0.01671348 -0.2088269043 655s T 1.06337359 -0.14168715 0.9734812459 655s > 655s > # Validation 655s > Z0 <- cbind(s1 = rowMeans(X[, 1:2]), s2 = rowMeans(X[, 3:4]), 655s + s3 = rowMeans(X[, 5:6])) 655s > stopifnot(identical(drop(Z), Z0)) 655s > 655s > 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > # Apply colMeans() for 5 sets of 4 rows 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > nbr_of_sets <- 5L 655s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 655s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 655s > print(S) 655s s1 s2 s3 s4 s5 655s [1,] 1 5 9 13 17 655s [2,] 2 6 10 14 18 655s [3,] 3 7 11 15 19 655s [4,] 4 8 12 16 20 655s > 655s > Z <- colAvgsPerRowSet(X, S = S) 655s > print(Z) 655s a b c d e f 655s s1 0.6485714 0.28321176 -0.02646724 -0.43414034 -0.3025158 0.520683621 655s s2 -0.5522675 -0.05386144 -0.39730259 0.32354071 -0.5936863 0.403125556 655s s3 -0.4846201 0.41743869 -0.31987838 -0.03042899 0.3331169 -0.002594147 655s s4 -0.8820577 0.26749978 -0.22616288 -0.50500595 0.2819319 -0.900475007 655s s5 0.3000603 0.02414615 0.19609622 -0.93869059 0.3714802 1.010783042 655s > 655s > # Validation 655s > Z0 <- rbind(s1 = colMeans(X[1:4, ]), s2 = colMeans(X[5:8, ]), 655s + s3 = colMeans(X[9:12, ]), s4 = colMeans(X[13:16, ]), 655s + s5 = colMeans(X[17:20, ])) 655s > stopifnot(identical(drop(Z), Z0)) 655s > 655s > 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > # When there is only one "complete" set 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > nbr_of_sets <- 1L 655s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 655s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 655s > print(S) 655s s1 655s [1,] 1 655s [2,] 2 655s [3,] 3 655s [4,] 4 655s [5,] 5 655s [6,] 6 655s > 655s > Z <- rowAvgsPerColSet(X, S = S, FUN = rowMeans) 655s > print(Z) 655s s1 655s A 0.16394813 655s B -0.07313228 655s C -0.09333714 655s D 0.46208351 655s E 0.26721803 655s F -0.42977594 655s G -0.48432168 655s H 0.06657856 655s I 0.13440072 655s J 0.75994310 655s K -0.37048162 655s L -0.58183957 655s M 0.20898151 655s N -0.96578812 655s O 0.05985717 655s P -0.61256378 655s Q -0.22359685 655s R 0.48718147 655s S -0.25272363 655s T 0.63172256 655s > 655s > Z0 <- rowMeans(X) 655s > stopifnot(identical(drop(Z), Z0)) 655s > 655s > 655s > nbr_of_sets <- 1L 655s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 655s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 655s > print(S) 655s s1 655s [1,] 1 655s [2,] 2 655s [3,] 3 655s [4,] 4 655s [5,] 5 655s [6,] 6 655s [7,] 7 655s [8,] 8 655s [9,] 9 655s [10,] 10 655s [11,] 11 655s [12,] 12 655s [13,] 13 655s [14,] 14 655s [15,] 15 655s [16,] 16 655s [17,] 17 655s [18,] 18 655s [19,] 19 655s [20,] 20 655s > 655s > Z <- colAvgsPerRowSet(X, S = S, FUN = colMeans) 655s > print(Z) 655s a b c d e f 655s s1 -0.1940627 0.187687 -0.154743 -0.316945 0.01806537 0.2063046 655s > 655s > Z0 <- colMeans(X) 655s > stopifnot(identical(drop(Z), Z0)) 655s > 655s > 655s > 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > # Use weights 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > nbr_of_sets <- 3L 655s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 655s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 655s > print(S) 655s s1 s2 s3 655s [1,] 1 3 5 655s [2,] 2 4 6 655s > 655s > W <- matrix(runif(length(X)), nrow = nrow(X), ncol = ncol(X)) 655s > Z1 <- rowAvgsPerColSet(X, W = W, S = S, FUN = rowWeightedMeans) 655s > print(Z1) 655s s1 s2 s3 655s A 0.49228336 0.31535740 -0.3157963740 655s B -0.15014553 0.05463282 -0.1238841171 655s C 1.74852541 -2.04827483 0.0197379930 655s D -0.22709699 0.75706945 0.8562780771 655s E -0.47754230 0.56202923 0.7171671506 655s F -0.28236666 -0.76356944 -0.2433917142 655s G -0.26599150 -0.33176369 -0.8552098572 655s H -0.18635745 0.38578014 0.0003129848 655s I 0.30795232 0.02923856 0.0660112744 655s J 0.70263801 -0.31806131 1.8952526081 655s K -0.41623413 0.11388560 -0.8090963355 655s L -0.72871900 -0.52567760 -0.4911221248 655s M -0.32107479 0.50530539 0.4427139277 655s N -0.29946262 -1.97735142 -0.6205503096 655s O -0.04634514 0.34498295 -0.1190663175 655s P -0.56223326 -0.33527459 -0.9401834991 655s Q 0.40838510 -1.29553728 0.2163616167 655s R -0.29071523 -0.03125083 1.7835104633 655s S -0.53263052 -0.01671348 -0.2088269043 655s T 1.06337359 -0.14168715 0.9734812459 655s > Z2 <- colAvgsPerRowSet(X, W = W, S = S, FUN = colWeightedMeans) 655s > print(Z2) 655s a b c d e f 655s s1 -0.01212279 0.35426062 0.9144167 -0.5444265 -1.00368678 0.5640063 655s s2 1.30926552 0.21216290 -0.9673512 -0.3238542 0.39865511 0.4773610 655s s3 -0.81683939 0.05693044 -1.0391193 0.8375790 -0.03557574 0.5093512 655s > 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > # Result should always be a matrix, including when nrow(X) <= 1 655s > # (https://github.com/HenrikBengtsson/matrixStats/issues/108) 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > X <- matrix(1:3, nrow = 1L, ncol = 3L) 655s > S <- matrix(1, nrow = 1L, ncol = 1L) 655s > Z1 <- rowAvgsPerColSet(X, S = S) 655s > stopifnot(is.matrix(Z1)) 655s > Z2 <- rowAvgsPerColSet(X, S = S, rows = 0) 655s > stopifnot(is.matrix(Z2)) 655s > 655s > 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > # Works with many, one or zero columns / rows 655s > # (https://github.com/HenrikBengtsson/matrixStats/issues/172) 655s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 655s > S <- cbind(1:2, 3:4, 5:6) 655s > X <- matrix(rnorm(2 * 6), nrow = 6, ncol = 2) 655s > Z2 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 655s > Z2_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 655s + colSums2(X[S[,2], ,drop=FALSE]), 655s + colSums2(X[S[,3], ,drop=FALSE])) 655s > stopifnot(identical(Z2, Z2_ref)) 655s > X <- matrix(rnorm(6), nrow = 6, ncol = 1) 655s > Z1 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 655s > Z1_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 655s + colSums2(X[S[,2], ,drop=FALSE]), 655s + colSums2(X[S[,3], ,drop=FALSE])) 655s > stopifnot(identical(Z1, Z1_ref)) 655s > X <- matrix(numeric(0), nrow = 6, ncol = 0) 655s > Z0 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 655s > Z0_ref <- matrix(numeric(0), nrow = ncol(S), ncol = 0) 655s > stopifnot(identical(Z0, unname(Z0_ref))) 655s > 655s > 655s > S <- rbind(1:4, 5:8) 655s > X <- matrix(rnorm(n = 2 * 8), nrow = 2, ncol = 8) 655s > Z2 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 655s > Z2_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 655s + rowMeans2(X[,S[,2],drop=FALSE]), 655s + rowMeans2(X[,S[,3],drop=FALSE]), 655s + rowMeans2(X[,S[,4],drop=FALSE])) 655s > stopifnot(identical(Z2, Z2_ref)) 655s > X <- matrix(rnorm(n = 8), nrow = 1, ncol = 8) 655s > Z1 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 655s > Z1_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 655s + rowMeans2(X[,S[,2],drop=FALSE]), 655s + rowMeans2(X[,S[,3],drop=FALSE]), 655s + rowMeans2(X[,S[,4],drop=FALSE])) 655s > stopifnot(identical(Z1, Z1_ref)) 655s > X <- matrix(numeric(0), nrow = 0, ncol = 8) 655s > Z0 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 655s > Z0_ref <- matrix(numeric(0), nrow = 0, ncol = ncol(S)) 655s > stopifnot(identical(Z0, Z0_ref)) 655s > 655s 655s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 655s Copyright (C) 2024 The R Foundation for Statistical Computing 655s Platform: aarch64-unknown-linux-gnu (64-bit) 655s 655s R is free software and comes with ABSOLUTELY NO WARRANTY. 655s You are welcome to redistribute it under certain conditions. 655s Type 'license()' or 'licence()' for distribution details. 655s 655s R is a collaborative project with many contributors. 655s Type 'contributors()' for more information and 655s 'citation()' on how to cite R or R packages in publications. 655s 655s Type 'demo()' for some demos, 'help()' for on-line help, or 655s 'help.start()' for an HTML browser interface to help. 655s Type 'q()' to quit R. 655s 656s > library("matrixStats") 656s > 656s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 656s > # Subsetted tests 656s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 656s > source("utils/validateIndicesFramework.R") 656s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 656s > #W <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 656s > for (rows in index_cases) { 656s + for (cols in index_cases) { 656s + if (is.null(rows)) { 656s + rows <- seq_len(nrow(x)) 656s + rows_finite <- rows 656s + } else { 656s + rows_finite <- rows[is.finite(rows)] 656s + } 656s + 656s + if (is.null(cols)) { 656s + cols <- seq_len(ncol(x)) 656s + cols_finite <- cols 656s + } else { 656s + cols_finite <- cols[is.finite(cols)] 656s + } 656s + 656s + suppressWarnings({ 656s + actual <- tryCatch({ 656s + rowAvgsPerColSet(x, rows = rows, S = matrix(cols, ncol = 1), 656s + FUN = rowMeans) 656s + }, error = function(c) "error") 656s + expect <- tryCatch({ 656s + rowMeans(x[rows, cols_finite, drop = FALSE], na.rm = TRUE) 656s + }, error = function(c) "error") 656s + }) 656s + stopifnot(all.equal(as.vector(actual), expect)) 656s + 656s + suppressWarnings({ 656s + actual <- tryCatch({ 656s + colAvgsPerRowSet(x, cols = cols, S = matrix(rows, ncol = 1), 656s + FUN = colMeans) 656s + }, error = function(c) "error") 656s + expect <- tryCatch({ 656s + colMeans(x[rows_finite, cols, drop = FALSE], na.rm = TRUE) 656s + }, error = function(c) "error") 656s + }) 656s + stopifnot(all.equal(as.vector(actual), expect)) 656s + } 656s + } 657s > 658s 658s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 658s Copyright (C) 2024 The R Foundation for Statistical Computing 658s Platform: aarch64-unknown-linux-gnu (64-bit) 658s 658s R is free software and comes with ABSOLUTELY NO WARRANTY. 658s You are welcome to redistribute it under certain conditions. 658s Type 'license()' or 'licence()' for distribution details. 658s 658s R is a collaborative project with many contributors. 658s Type 'contributors()' for more information and 658s 'citation()' on how to cite R or R packages in publications. 658s 658s Type 'demo()' for some demos, 'help()' for on-line help, or 658s 'help.start()' for an HTML browser interface to help. 658s Type 'q()' to quit R. 658s 659s > library("matrixStats") 659s > 659s > x <- matrix(1:27, ncol = 3) 659s > 659s > # To check names attribute 659s > dimnames <- list(letters[1:9], LETTERS[1:3]) 659s > 659s > rowCollapse_R <- function(x, idxs, ..., useNames = NA) { 659s + res <- x[, idxs] 659s + # Preserve names attribute? 659s + if (is.na(useNames) || !useNames) names(res) <- NULL 659s + res 659s + } 659s > 659s > idxs <- 1L 659s > # Test with and without dimnames on x 659s > for (setDimnames in c(TRUE, FALSE)) { 659s + if (setDimnames) dimnames(x) <- dimnames 659s + else dimnames(x) <- NULL 659s + # Check names attribute 659s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 659s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 659s + y <- rowCollapse(x, idxs, useNames = useNames) 659s + stopifnot(identical(y, y_truth)) 659s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 659s + stopifnot(identical(y2, y)) 659s + } 659s + } 659s > 659s > idxs <- 2L 659s > # Test with and without dimnames on x 659s > for (setDimnames in c(TRUE, FALSE)) { 659s + if (setDimnames) dimnames(x) <- dimnames 659s + else dimnames(x) <- NULL 659s + # Check names attribute 659s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 659s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 659s + y <- rowCollapse(x, idxs, useNames = useNames) 659s + stopifnot(identical(y, y_truth)) 659s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 659s + stopifnot(identical(y2, y)) 659s + } 659s + } 660s > 660s > 660s > rowCollapse_R <- function(x, idxs, ..., useNames = NA) { 660s + res <- c(x[1:5, 1], x[6:9, 3]) 660s + # Preserve names attribute? 660s + if (is.na(useNames) || !useNames) names(res) <- NULL 660s + res 660s + } 660s > 660s > idxs <- c(1, 1, 1, 1, 1, 3, 3, 3, 3) 660s > # Test with and without dimnames on x 660s > for (setDimnames in c(TRUE, FALSE)) { 660s + if (setDimnames) dimnames(x) <- dimnames 660s + else dimnames(x) <- NULL 660s + # Check names attribute 660s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 660s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 660s + y <- rowCollapse(x, idxs, useNames = useNames) 660s + stopifnot(identical(y, y_truth)) 660s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 660s + stopifnot(identical(y2, y)) 660s + } 660s + } 660s > 660s > 660s > rowCollapse_R <- function(x, idxs, ..., useNames = NA) { 660s + res <- c(x[1, 1], x[2, 2], x[3, 3], x[4, 1], x[5, 2], 660s + x[6, 3], x[7, 1], x[8, 2], x[9, 3]) 660s + # Preserve names attribute? 660s + if (isTRUE(useNames)) { 660s + names <- rownames(x) 660s + if (!is.null(names)) names(res) <- names 660s + } 660s + res 660s + } 660s > 660s > idxs <- 1:3 660s > # Test with and without dimnames on x 660s > for (setDimnames in c(TRUE, FALSE)) { 660s + if (setDimnames) dimnames(x) <- dimnames 660s + else dimnames(x) <- NULL 660s + # Check names attribute 660s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 660s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 660s + y <- rowCollapse(x, idxs, useNames = useNames) 660s + stopifnot(identical(y, y_truth)) 660s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 660s + stopifnot(identical(y2, y)) 660s + } 660s + } 660s > 660s 660s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 660s Copyright (C) 2024 The R Foundation for Statistical Computing 660s Platform: aarch64-unknown-linux-gnu (64-bit) 660s 660s R is free software and comes with ABSOLUTELY NO WARRANTY. 660s You are welcome to redistribute it under certain conditions. 660s Type 'license()' or 'licence()' for distribution details. 660s 660s R is a collaborative project with many contributors. 660s Type 'contributors()' for more information and 660s 'citation()' on how to cite R or R packages in publications. 660s 660s Type 'demo()' for some demos, 'help()' for on-line help, or 660s 'help.start()' for an HTML browser interface to help. 660s Type 'q()' to quit R. 660s 660s > library("matrixStats") 660s > 660s > rowCollapse_R <- function(x, idxs, ..., useNames = NA) { 660s + ans <- c() 660s + storage.mode(ans) <- storage.mode(x) 660s + for (ii in seq_len(length(idxs))) { 660s + ans[ii] <- x[ii, idxs[ii]] 660s + } 660s + 660s + # Preserve names attribute 660s + if (isTRUE(useNames)) { 660s + names <- rownames(x) 660s + if (!is.null(names)) names(ans) <- names 660s + } 660s + 660s + ans 660s + } 660s > 660s > 660s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 660s > # Subsetted tests 660s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 660s > source("utils/validateIndicesFramework.R") 660s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 660s > storage.mode(x) <- "integer" 660s > 660s > # To check names attribute 660s > dimnames <- list(letters[1:6], LETTERS[1:6]) 660s > 660s > for (rows in index_cases) { 660s + if (is.null(rows)) rows <- seq_len(nrow(x)) 660s + 660s + for (idxs in list(2L, seq_len(6L))) { 660s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 660s + suppressWarnings({ 660s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 660s + error = function(c) "error") 660s + expect <- tryCatch({ 660s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 660s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 660s + }, error = function(c) "error") 660s + }) 660s + stopifnot(all.equal(actual, expect)) 660s + 660s + suppressWarnings({ 660s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 660s + error = function(c) "error") 660s + }) 660s + stopifnot(all.equal(actual, expect)) 660s + 660s + # Check names attribute 660s + dimnames(x) <- dimnames 660s + suppressWarnings({ 660s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 660s + error = function(c) "error") 660s + expect <- tryCatch({ 660s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 660s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 660s + }, error = function(c) "error") 660s + }) 660s + stopifnot(all.equal(actual, expect)) 660s + 660s + suppressWarnings({ 660s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 660s + error = function(c) "error") 660s + }) 660s + stopifnot(all.equal(actual, expect)) 661s + 661s + dimnames(x) <- NULL 661s + } 661s + } 661s + } 661s > 662s 662s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 662s Copyright (C) 2024 The R Foundation for Statistical Computing 662s Platform: aarch64-unknown-linux-gnu (64-bit) 662s 662s R is free software and comes with ABSOLUTELY NO WARRANTY. 662s You are welcome to redistribute it under certain conditions. 662s Type 'license()' or 'licence()' for distribution details. 662s 662s R is a collaborative project with many contributors. 662s Type 'contributors()' for more information and 662s 'citation()' on how to cite R or R packages in publications. 662s 662s Type 'demo()' for some demos, 'help()' for on-line help, or 662s 'help.start()' for an HTML browser interface to help. 662s Type 'q()' to quit R. 662s 662s > library("matrixStats") 663s > 663s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 663s + if (is.na(value)) { 663s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 663s + sum(is.na(x)) 663s + ) 663s + } else { 663s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 663s + sum(x == value, na.rm = na.rm) 663s + ) 663s + } 663s + # Preserve names attribute 663s + names <- names(counts) 663s + counts <- as.integer(counts) 663s + if (isTRUE(useNames) && !is.null(names)) names(counts) <- names 663s + counts 663s + } 663s > 663s > 663s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 663s > # Data type: integer and numeric 663s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 663s > for (mode in c("integer", "double")) { 663s + x <- matrix(runif(10 * 5, min = -3, max = 3), nrow = 10L, ncol = 5L) 663s + x[sample.int(length(x), size = 7L)] <- 0 663s + storage.mode(x) <- mode 663s + 663s + dimnames = list(letters[1:10], LETTERS[1:5]) 663s + 663s + # Test with and without dimnames on x 663s + for (setDimnames in c(TRUE, FALSE)) { 663s + if (setDimnames) dimnames(x) <- dimnames 663s + else dimnames(x) <- NULL 663s + for (na.rm in c(FALSE, TRUE)) { 663s + # Check names attribute 663s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 663s + # Count zeros 663s + r0 <- rowCounts_R(x, value = 0, na.rm = na.rm, useNames = useNames) 663s + r1 <- rowCounts(x, value = 0, na.rm = na.rm, useNames = useNames) 663s + r2 <- colCounts(t(x), value = 0, na.rm = na.rm, useNames = useNames) 663s + stopifnot(identical(r1, r0)) 663s + stopifnot(identical(r2, r0)) 663s + 663s + # Count NAs 663s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 663s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 663s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 663s + stopifnot(identical(r1, r0)) 663s + stopifnot(identical(r2, r0)) 663s + 663s + if (mode == "integer") { 663s + ux <- unique(as.vector(x)) 663s + r0 <- r1 <- r2 <- integer(nrow(x)) 663s + for (value in ux) { 663s + r0 <- r0 + rowCounts_R(x, value = value, na.rm = na.rm, useNames = useNames) 663s + r1 <- r1 + rowCounts(x, value = value, na.rm = na.rm, useNames = useNames) 663s + r2 <- r2 + colCounts(t(x), value = value, na.rm = na.rm, useNames = useNames) 663s + stopifnot(identical(r1, r0)) 663s + stopifnot(identical(r2, r0)) 663s + } 663s + stopifnot(all(r0 == ncol(x))) 663s + } # if (mode == "integer") 663s + } # for (useNames ...) 663s + } # for (na.rm ...) 663s + } # for (setDimnames ...) 663s + } # for (mode ...) 663s > 663s > 663s > # All NAs 663s > na_list <- list(NA_integer_, NA_real_, NaN) 663s > for (na_value in na_list) { 663s + x <- matrix(na_value, nrow = 10L, ncol = 5L) 663s + # Test with and without dimnames on x 663s + for (setDimnames in c(TRUE, FALSE)) { 663s + if (setDimnames) dimnames(x) <- dimnames 663s + else dimnames(x) <- NULL 663s + for (na.rm in c(FALSE, TRUE)) { 663s + # Check names attribute 663s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 663s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 663s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 663s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 663s + stopifnot(identical(r1, r0)) 663s + stopifnot(identical(r2, r0)) 663s + 663s + # Count NAs 663s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 663s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 663s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 663s + stopifnot(all(r0 == ncol(x))) 663s + stopifnot(identical(r1, r0)) 663s + stopifnot(identical(r2, r0)) 663s + } 663s + } 663s + } 663s + } # for (na_value ...) 663s > 663s > 663s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 663s > # Data type: logical 663s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 663s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 663s > x[7:8, 2:3] <- TRUE 663s > x[1:3, ] <- TRUE 663s > x[, 1] <- TRUE 663s > x[4, ] <- FALSE 663s > x[, 4] <- FALSE 663s > x[2, ] <- FALSE 663s > x[3, ] <- TRUE 663s > 663s > # To check names attribute 663s > dimnames <- list(letters[1:10], LETTERS[1:4]) 663s > 663s > # Test with and without dimnames on x 663s > for (setDimnames in c(TRUE, FALSE)) { 663s + if (setDimnames) dimnames(x) <- dimnames 663s + else dimnames(x) <- NULL 663s + # Row/column counts 663s + for (na.rm in c(FALSE, TRUE)) { 663s + # Check names attribute 663s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 663s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 663s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 663s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 663s + stopifnot(identical(r1, r0)) 663s + stopifnot(identical(r2, r0)) 663s + 663s + r_true <- rowCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 663s + r_false <- rowCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 663s + stopifnot(r_true + r_false == ncol(x)) 663s + 663s + c_true <- colCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 663s + c_false <- colCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 663s + stopifnot(c_true + c_false == nrow(x)) 663s + 663s + # Count NAs 663s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 663s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 663s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 663s + stopifnot(identical(r1, r0)) 663s + stopifnot(identical(r2, r0)) 663s + } 663s + } 663s + } 663s > 663s > 664s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 664s > # Data type: character (not sure if this should be supported) 664s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 664s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 664s > x[2:3, 3:4] <- NA_character_ 664s > 664s > # Row/column counts 664s > for (na.rm in c(FALSE, TRUE)) { 664s + for (value in c("g", NA_character_)) { 664s + r0 <- rowCounts_R(x, value = value, na.rm = na.rm) 664s + r1 <- rowCounts(x, value = value, na.rm = na.rm) 664s + r2 <- colCounts(t(x), value = value, na.rm = na.rm) 664s + stopifnot(identical(r1, r0)) 664s + stopifnot(identical(r2, r0)) 664s + 664s + c <- count(x[1, ], value = value, na.rm = na.rm) 664s + stopifnot(identical(c, r1[1])) 664s + 664s + c <- count(x[2, ], value = value, na.rm = na.rm) 664s + stopifnot(identical(c, r1[2])) 664s + } 664s + } 664s > 664s > # NA row 664s > x <- matrix(0, nrow = 2L, ncol = 2L) 664s > x[1, ] <- NA_integer_ 664s > 664s > dimnames <- list(letters[1:2], LETTERS[1:2]) 664s > 664s > # Test with and without dimnames on x 664s > for (setDimnames in c(TRUE, FALSE)) { 664s + if (setDimnames) dimnames(x) <- dimnames 664s + else dimnames(x) <- NULL 664s + # Check names attribute 664s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 664s + r0 <- rowCounts(x, value = 0, useNames = useNames) 664s + r1 <- rowCounts_R(x, value = 0, useNames = useNames) 664s + stopifnot(identical(r0, r1)) 664s + } 664s + } 664s > 664s 664s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 664s Copyright (C) 2024 The R Foundation for Statistical Computing 664s Platform: aarch64-unknown-linux-gnu (64-bit) 664s 664s R is free software and comes with ABSOLUTELY NO WARRANTY. 664s You are welcome to redistribute it under certain conditions. 664s Type 'license()' or 'licence()' for distribution details. 664s 664s R is a collaborative project with many contributors. 664s Type 'contributors()' for more information and 664s 'citation()' on how to cite R or R packages in publications. 664s 664s Type 'demo()' for some demos, 'help()' for on-line help, or 664s 'help.start()' for an HTML browser interface to help. 664s Type 'q()' to quit R. 664s 665s > library("matrixStats") 665s > 665s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = NA) { 665s + if (is.na(value)) { 665s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 665s + sum(is.na(x)) 665s + ) 665s + } else { 665s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 665s + sum(x == value, na.rm = na.rm) 665s + ) 665s + } 665s + # Preserve names attribute 665s + names <- names(counts) 665s + counts <- as.integer(counts) 665s + if (isTRUE(useNames) && !is.null(names)) names(counts) <- names 665s + counts 665s + } # rowCounts_R() 665s > 665s > 665s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 665s > # Subsetted tests 665s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 665s > source("utils/validateIndicesFramework.R") 665s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 665s > x[2:3, 3:4] <- NA_real_ 665s > storage.mode(x) <- "integer" 665s > 665s > # To check names attribute 665s > dimnames <- list(letters[1:6], LETTERS[1:6]) 665s > 665s > # Test with and without dimnames on x 665s > for (setDimnames in c(TRUE, FALSE)) { 665s + if (setDimnames) dimnames(x) <- dimnames 665s + else dimnames(x) <- NULL 665s + for (rows in index_cases) { 665s + for (cols in index_cases) { 665s + # Check names attribute 665s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 665s + validateIndicesTestMatrix(x, rows, cols, 665s + ftest = rowCounts, fsure = rowCounts_R, 665s + value = 0, na.rm = TRUE, useNames = useNames) 665s + validateIndicesTestMatrix(x, rows, cols, 665s + fcoltest = colCounts, fsure = rowCounts_R, 665s + value = 0, na.rm = TRUE, useNames = useNames) 665s + for (value in c(0, NA_integer_)) { 665s + validateIndicesTestMatrix(x, rows, cols, 665s + ftest = rowCounts, fsure = rowCounts_R, 665s + value = value, useNames = useNames) 665s + validateIndicesTestMatrix(x, rows, cols, 665s + fcoltest = colCounts, fsure = rowCounts_R, 665s + value = value, useNames = useNames) 665s + } 665s + } 665s + } 665s + } 665s + } 676s > 676s > x <- matrix(rep(letters, length.out = 6 * 6), nrow = 6, ncol = 6) 676s > x[2:3, 3:4] <- NA_character_ 676s > # Test with and without dimnames on x 676s > for (setDimnames in c(TRUE, FALSE)) { 676s + if (setDimnames) dimnames(x) <- dimnames 676s + else dimnames(x) <- NULL 676s + 676s + count <- 0L 676s + for (rows in index_cases) { 676s + for (cols in index_cases) { 676s + count <- count + 1L 676s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 676s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 676s + useNames <- useNames[count %% length(useNames) + 1] 676s + 676s + validateIndicesTestMatrix(x, rows, cols, 676s + ftest = rowCounts, fsure = rowCounts_R, 676s + value = "g", na.rm = TRUE, useNames = useNames) 676s + validateIndicesTestMatrix(x, rows, cols, 676s + fcoltest = colCounts, fsure = rowCounts_R, 676s + value = "g", na.rm = TRUE, useNames = useNames) 676s + for (value in c("g", NA_character_)) { 676s + validateIndicesTestMatrix(x, rows, cols, 676s + ftest = rowCounts, fsure = rowCounts_R, 676s + value = value, useNames = useNames) 676s + validateIndicesTestMatrix(x, rows, cols, 676s + fcoltest = colCounts, fsure = rowCounts_R, 676s + value = value, useNames = useNames) 676s + } 676s + } 676s + } 676s + } 682s > 682s 682s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 682s Copyright (C) 2024 The R Foundation for Statistical Computing 682s Platform: aarch64-unknown-linux-gnu (64-bit) 682s 682s R is free software and comes with ABSOLUTELY NO WARRANTY. 682s You are welcome to redistribute it under certain conditions. 682s Type 'license()' or 'licence()' for distribution details. 682s 682s R is a collaborative project with many contributors. 682s Type 'contributors()' for more information and 682s 'citation()' on how to cite R or R packages in publications. 682s 682s Type 'demo()' for some demos, 'help()' for on-line help, or 682s 'help.start()' for an HTML browser interface to help. 682s Type 'q()' to quit R. 682s 683s > library("matrixStats") 683s > 683s > rowCummins_R <- function(x, ..., useNames = NA) { 683s + suppressWarnings({ 683s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 683s + }) 683s + 683s + # Preserve dimnames attribute? 683s + dim(y) <- dim(x) 683s + dimnames(y) <- if (isTRUE(useNames)) dimnames(x) else NULL 683s + y 683s + } 683s > 683s > rowCummaxs_R <- function(x, ..., useNames = NA) { 683s + mode <- storage.mode(x) 683s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 683s + storage.mode(x) <- "numeric" 683s + suppressWarnings({ 683s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 683s + }) 683s + 683s + # Preserve dimnames attribute? 683s + dim(y) <- dim(x) 683s + dimnames(y) <- if (isTRUE(useNames)) dimnames(x) else NULL 683s + 683s + y 683s + } 683s > 683s > 683s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 683s > # With and without some NAs 683s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 683s > for (mode in c("logical", "integer", "double")) { 683s + for (add_na in c(FALSE, TRUE)) { 683s + cat("add_na = ", add_na, "\n", sep = "") 683s + 683s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 683s + diag(x) <- 0 683s + if (add_na) { 683s + x[3:7, c(2, 4)] <- NA_real_ 683s + } 683s + cat("mode: ", mode, "\n", sep = "") 683s + storage.mode(x) <- mode 683s + str(x) 683s + 683s + # To check dimnames attribute 683s + dimnames <- list(letters[1:10], LETTERS[1:5]) 683s + 683s + # Test with and without dimnames on x 683s + for (setDimnames in c(TRUE, FALSE)) { 683s + if (setDimnames) dimnames(x) <- dimnames 683s + else dimnames(x) <- NULL 683s + # Check names attribute 683s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 683s + # Row/column ranges 683s + r0 <- rowCummins_R(x, useNames = useNames) 683s + r1 <- rowCummins(x, useNames = useNames) 683s + r2 <- t(colCummins(t(x), useNames = useNames)) 683s + stopifnot(all.equal(r1, r2)) 683s + stopifnot(all.equal(r1, r0)) 683s + stopifnot(all.equal(r2, r0)) 683s + 683s + r0 <- rowCummaxs_R(x, useNames = useNames) 683s + r1 <- rowCummaxs(x, useNames = useNames) 683s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 683s + stopifnot(all.equal(r1, r2)) 683s + stopifnot(all.equal(r1, r0)) 683s + stopifnot(all.equal(r2, r0)) 683s + } # for (useNames ...) 683s + } # for (setDimnames ...) 683s + } # for (add_na ...) 683s + } # for (mode ...) 683s add_na = FALSE 683s mode: logical 683s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 683s add_na = TRUE 683s mode: logical 683s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 683s add_na = FALSE 683s mode: integer 683s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 683s add_na = TRUE 683s mode: integer 683s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 683s add_na = FALSE 683s mode: double 683s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 683s add_na = TRUE 683s mode: double 683s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 683s > 683s > 683s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 683s > # All NAs 683s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 683s > for (mode in c("logical", "integer", "double")) { 683s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 683s + cat("mode: ", mode, "\n", sep = "") 683s + storage.mode(x) <- mode 683s + str(x) 683s + 683s + # Test with and without dimnames on x 683s + for (setDimnames in c(TRUE, FALSE)) { 683s + if (setDimnames) dimnames(x) <- dimnames 683s + else dimnames(x) <- NULL 683s + # Check names attribute 683s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 683s + r0 <- rowCummins_R(x, useNames = useNames) 683s + r1 <- rowCummins(x, useNames = useNames) 683s + r2 <- t(colCummins(t(x), useNames = useNames)) 683s + stopifnot(all.equal(r1, r2)) 683s + stopifnot(all.equal(r1, r0)) 683s + stopifnot(all.equal(r2, r0)) 683s + 683s + r0 <- rowCummaxs_R(x, useNames = useNames) 683s + r1 <- rowCummaxs(x, useNames = useNames) 683s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 683s + stopifnot(all.equal(r1, r2)) 683s + stopifnot(all.equal(r1, r0)) 683s + stopifnot(all.equal(r2, r0)) 683s + } # for (useNames ...) 683s + } # for (setDimnames ...) 683s + } # for (mode ...) 684s mode: logical 684s logi [1:10, 1:5] NA NA NA NA NA NA ... 684s mode: integer 684s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 684s mode: double 684s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 684s > 684s > 684s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 684s > # A 1x1 matrix 684s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 684s > for (mode in c("logical", "integer", "double")) { 684s + x <- matrix(0, nrow = 1L, ncol = 1L) 684s + cat("mode: ", mode, "\n", sep = "") 684s + storage.mode(x) <- mode 684s + str(x) 684s + 684s + # To check dimnames attribute 684s + dimnames <- list("a", "A") 684s + 684s + # Test with and without dimnames on x 684s + for (setDimnames in c(TRUE, FALSE)) { 684s + if (setDimnames) dimnames(x) <- dimnames 684s + else dimnames(x) <- NULL 684s + # Check names attribute 684s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 684s + r0 <- rowCummins_R(x, useNames = useNames) 684s + r1 <- rowCummins(x, useNames = useNames) 684s + r2 <- t(colCummins(t(x), useNames = useNames)) 684s + stopifnot(all.equal(r1, r2)) 684s + stopifnot(all.equal(r1, r0)) 684s + stopifnot(all.equal(r2, r0)) 684s + 684s + r0 <- rowCummaxs_R(x, useNames = useNames) 684s + r1 <- rowCummaxs(x, useNames = useNames) 684s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 684s + stopifnot(all.equal(r1, r2)) 684s + stopifnot(all.equal(r1, r0)) 684s + stopifnot(all.equal(r2, r0)) 684s + } # for (useNames ...) 684s + } # for (setDimnames ...) 684s + } # for (mode ...) 684s mode: logical 684s logi [1, 1] FALSE 684s mode: integer 684s int [1, 1] 0 684s mode: double 684s num [1, 1] 0 684s > 684s > 684s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 684s > # Corner cases 684s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 684s > for (mode in c("logical", "integer", "double")) { 684s + cat("mode: ", mode, "\n", sep = "") 684s + value <- 0 684s + storage.mode(value) <- mode 684s + value0 <- if (mode == "logical") 0L else value 684s + 684s + # A 0x0 matrix 684s + x <- matrix(value, nrow = 0L, ncol = 0L) 684s + str(x) 684s + r0 <- matrix(value0, nrow = nrow(x), ncol = ncol(x)) 684s + r1 <- rowCummins(x) 684s + r2 <- t(colCummins(t(x))) 684s + stopifnot(all.equal(r1, r2)) 684s + stopifnot(all.equal(r1, r0)) 684s + stopifnot(all.equal(r2, r0)) 684s + 684s + # A 0xK matrix 684s + x <- matrix(value, nrow = 0L, ncol = 5L) 684s + str(x) 684s + colnames <- LETTERS[1:5] 684s + # Test with and without dimnames on x 684s + for (setDimnames in c(TRUE, FALSE)) { 684s + if (setDimnames) colnames(x) <- colnames 684s + else dimnames(x) <- NULL 684s + # Check names attribute 684s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 684s + r0 <- rowCummins_R(x, useNames = useNames) 684s + r1 <- rowCummins(x, useNames = useNames) 684s + r2 <- t(colCummins(t(x), useNames = useNames)) 684s + stopifnot(all.equal(r1, r2)) 684s + stopifnot(all.equal(r1, r0)) 684s + stopifnot(all.equal(r2, r0)) 684s + r0 <- rowCummaxs_R(x, useNames = useNames) 684s + r1 <- rowCummaxs(x, useNames = useNames) 684s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 684s + stopifnot(all.equal(r1, r2)) 684s + stopifnot(all.equal(r1, r0)) 684s + stopifnot(all.equal(r2, r0)) 684s + } # for (useNames ...) 684s + } # for (setDimnames ...) 684s + 684s + # A Nx0 matrix 684s + x <- matrix(value, nrow = 5L, ncol = 0L) 684s + str(x) 684s + rownames <- LETTERS[1:5] 684s + # Test with and without dimnames on x 684s + for (setDimnames in c(TRUE, FALSE)) { 684s + if (setDimnames) rownames(x) <- rownames 684s + else dimnames(x) <- NULL 684s + # Check names attribute 684s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 684s + r0 <- rowCummins_R(x, useNames = useNames) 684s + r1 <- rowCummins(x, useNames = useNames) 684s + r2 <- t(colCummins(t(x), useNames = useNames)) 684s + stopifnot(all.equal(r1, r2)) 684s + stopifnot(all.equal(r1, r0)) 684s + stopifnot(all.equal(r2, r0)) 684s + 684s + r0 <- rowCummaxs_R(x, useNames = useNames) 684s + r1 <- rowCummaxs(x, useNames = useNames) 684s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 684s + stopifnot(all.equal(r1, r2)) 684s + stopifnot(all.equal(r1, r0)) 684s + stopifnot(all.equal(r2, r0)) 684s + } # for (useNames ...) 684s + } # for (setDimnames ...) 684s + } # for (mode ...) 684s mode: logical 684s logi[0 , 0 ] 684s logi[0 , 1:5] 684s logi[1:5, 0 ] 684s mode: integer 684s int[0 , 0 ] 684s int[0 , 1:5] 684s int[1:5, 0 ] 684s mode: double 684s num[0 , 0 ] 684s num[0 , 1:5] 685s num[1:5, 0 ] 685s > 685s 685s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 685s Copyright (C) 2024 The R Foundation for Statistical Computing 685s Platform: aarch64-unknown-linux-gnu (64-bit) 685s 685s R is free software and comes with ABSOLUTELY NO WARRANTY. 685s You are welcome to redistribute it under certain conditions. 685s Type 'license()' or 'licence()' for distribution details. 685s 685s R is a collaborative project with many contributors. 685s Type 'contributors()' for more information and 685s 'citation()' on how to cite R or R packages in publications. 685s 685s Type 'demo()' for some demos, 'help()' for on-line help, or 685s 'help.start()' for an HTML browser interface to help. 685s Type 'q()' to quit R. 685s 686s > library("matrixStats") 686s > 686s > rowCummins_R <- function(x, ..., useNames = NA) { 686s + suppressWarnings({ 686s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 686s + }) 686s + 686s + # Preserve dimnames attribute? 686s + dim(y) <- dim(x) 686s + dimnames(y) <- if (isTRUE(useNames)) dimnames(x) else NULL 686s + 686s + y 686s + } 686s > 686s > rowCummaxs_R <- function(x, ..., useNames = NA) { 686s + mode <- storage.mode(x) 686s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 686s + storage.mode(x) <- "numeric" 686s + suppressWarnings({ 686s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 686s + }) 686s + 686s + # Preserve dimnames attribute? 686s + dim(y) <- dim(x) 686s + dimnames(y) <- if (isTRUE(useNames)) dimnames(x) else NULL 686s + 686s + storage.mode(y) <- mode 686s + y 686s + } 686s > 686s > 686s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 686s > # Subsetted tests 686s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 686s > source("utils/validateIndicesFramework.R") 686s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 686s > storage.mode(x) <- "integer" 686s > 686s > # To check dimnames attribute 686s > dimnames <- list(letters[1:6], LETTERS[1:6]) 686s > 686s > # Test with and without dimnames on x 686s > for (setDimnames in c(TRUE, FALSE)) { 686s + if (setDimnames) dimnames(x) <- dimnames 686s + else dimnames(x) <- NULL 686s + for (rows in index_cases) { 686s + for (cols in index_cases) { 686s + # Check names attribute 686s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 686s + validateIndicesTestMatrix(x, rows, cols, 686s + ftest = rowCummins, fsure = rowCummins_R, useNames = useNames,verbose=TRUE) 686s + validateIndicesTestMatrix(x, rows, cols, 686s + ftest = function(x, rows, cols, ..., useNames) { 686s + t(colCummins(t(x), rows = cols, cols = rows, useNames = useNames)) 686s + }, fsure = rowCummins_R, useNames = useNames) 686s + 686s + validateIndicesTestMatrix(x, rows, cols, 686s + ftest = rowCummaxs, fsure = rowCummaxs_R, useNames = useNames) 686s + validateIndicesTestMatrix(x, rows, cols, 686s + ftest = function(x, rows, cols, ..., useNames) { 686s + t(colCummaxs(t(x), rows = cols, cols = rows, useNames = useNames)) 686s + }, fsure = rowCummaxs_R, useNames = useNames) 686s + } 686s + } 686s + } 686s + } 705s > 705s 705s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 705s Copyright (C) 2024 The R Foundation for Statistical Computing 705s Platform: aarch64-unknown-linux-gnu (64-bit) 705s 705s R is free software and comes with ABSOLUTELY NO WARRANTY. 705s You are welcome to redistribute it under certain conditions. 705s Type 'license()' or 'licence()' for distribution details. 705s 705s R is a collaborative project with many contributors. 705s Type 'contributors()' for more information and 705s 'citation()' on how to cite R or R packages in publications. 705s 705s Type 'demo()' for some demos, 'help()' for on-line help, or 705s 'help.start()' for an HTML browser interface to help. 705s Type 'q()' to quit R. 705s 706s > library("matrixStats") 706s > 706s > rowCumprods_R <- function(x, ..., useNames = NA) { 706s + suppressWarnings({ 706s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 706s + }) 706s + 706s + # Preserve dimnames attribute? 706s + dim(y) <- dim(x) 706s + dimnames(y) <- if (isTRUE(useNames)) dimnames(x) else NULL 706s + 706s + y 706s + } 706s > 706s > 706s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 706s > # With and without some NAs 706s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 706s > for (mode in c("logical", "integer", "double")) { 706s + for (add_na in c(FALSE, TRUE)) { 706s + cat("add_na = ", add_na, "\n", sep = "") 706s + 706s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 706s + if (add_na) { 706s + x[3:7, c(2, 4)] <- NA_real_ 706s + } 706s + cat("mode: ", mode, "\n", sep = "") 706s + storage.mode(x) <- mode 706s + str(x) 706s + 706s + # To check dimnames attribute 706s + dimnames <- list(letters[1:10], LETTERS[1:5]) 706s + 706s + # Test with and without dimnames on x 706s + for (setDimnames in c(TRUE, FALSE)) { 706s + if (setDimnames) dimnames(x) <- dimnames 706s + else dimnames(x) <- NULL 706s + # Check names attribute 706s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 706s + # Row/column ranges 706s + r0 <- rowCumprods_R(x, useNames = useNames) 706s + r1 <- rowCumprods(x, useNames = useNames) 706s + r2 <- t(colCumprods(t(x), useNames = useNames)) 706s + stopifnot(all.equal(r1, r2)) 706s + stopifnot(all.equal(r1, r0)) 706s + stopifnot(all.equal(r2, r0)) 706s + } # for (useNames ...) 706s + } # for (setDimnames ...) 706s + } # for (add_na ...) 706s + } # for (mode ...) 707s add_na = FALSE 707s mode: logical 707s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 707s add_na = TRUE 707s mode: logical 707s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 707s add_na = FALSE 707s mode: integer 707s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 707s add_na = TRUE 707s mode: integer 707s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 707s add_na = FALSE 707s mode: double 707s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 707s add_na = TRUE 707s mode: double 707s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 707s > 707s > 707s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 707s > # All NAs 707s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 707s > for (mode in c("logical", "integer", "double")) { 707s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 707s + cat("mode: ", mode, "\n", sep = "") 707s + storage.mode(x) <- mode 707s + str(x) 707s + 707s + # Test with and without dimnames on x 707s + for (setDimnames in c(TRUE, FALSE)) { 707s + if (setDimnames) dimnames(x) <- dimnames 707s + else dimnames(x) <- NULL 707s + # Check names attribute 707s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 707s + # Row/column ranges 707s + r0 <- rowCumprods_R(x, useNames = useNames) 707s + r1 <- rowCumprods(x, useNames = useNames) 707s + r2 <- t(colCumprods(t(x), useNames = useNames)) 707s + stopifnot(all.equal(r1, r2)) 707s + stopifnot(all.equal(r1, r0)) 707s + stopifnot(all.equal(r2, r0)) 707s + } # for (useNames ...) 707s + } # for (setDimnames ...) 707s + } # for (mode ...) 707s mode: logical 707s logi [1:10, 1:5] NA NA NA NA NA NA ... 707s mode: integer 707s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 707s mode: double 707s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 707s > 707s > 707s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 707s > # A 1x1 matrix 707s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 707s > for (mode in c("logical", "integer", "double")) { 707s + x <- matrix(0, nrow = 1L, ncol = 1L) 707s + cat("mode: ", mode, "\n", sep = "") 707s + storage.mode(x) <- mode 707s + str(x) 707s + 707s + dimnames <- list("a", "A") 707s + # Test with and without dimnames on x 707s + for (setDimnames in c(TRUE, FALSE)) { 707s + if (setDimnames) dimnames(x) <- dimnames 707s + else dimnames(x) <- NULL 707s + # Check names attribute 707s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 707s + # Row/column ranges 707s + r0 <- rowCumprods_R(x, useNames = useNames) 707s + r1 <- rowCumprods(x, useNames = useNames) 707s + r2 <- t(colCumprods(t(x), useNames = useNames)) 707s + stopifnot(all.equal(r1, r2)) 707s + stopifnot(all.equal(r1, r0)) 707s + stopifnot(all.equal(r2, r0)) 707s + } # for (useNames ...) 707s + } # for (setDimnames ...) 707s + } 707s mode: logical 707s logi [1, 1] FALSE 707s mode: integer 707s int [1, 1] 0 707s mode: double 707s num [1, 1] 0 707s > 707s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 707s > # BUG FIX TEST: Assert zeros don't trump NAs in integer matrices 707s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 707s > for (mode in c("logical", "integer", "double")) { 707s + x <- matrix(NA_real_, nrow = 3L, ncol = 2L) 707s + x[1, 2] <- 0 707s + x[2, 2] <- 1 707s + x[3, 1] <- 0 707s + storage.mode(x) <- mode 707s + cat("mode: ", mode, "\n", sep = "") 707s + str(x) 707s + 707s + dimnames <- list(letters[1:3], LETTERS[1:2]) 707s + # Test with and without dimnames on x 707s + for (setDimnames in c(TRUE, FALSE)) { 707s + if (setDimnames) dimnames(x) <- dimnames 707s + else dimnames(x) <- NULL 707s + # Check names attribute 707s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 707s + # Row/column ranges 707s + r0 <- rowCumprods_R(x, useNames = useNames) 707s + r1 <- rowCumprods(x, useNames = useNames) 707s + r2 <- t(colCumprods(t(x), useNames = useNames)) 707s + stopifnot(all.equal(r1, r2)) 707s + stopifnot(all.equal(r1, r0)) 707s + stopifnot(all.equal(r2, r0)) 707s + } # for (useNames ...) 707s + } # for (setDimnames ...) 707s + } 707s mode: logical 707s logi [1:3, 1:2] NA NA FALSE FALSE TRUE NA 707s mode: integer 707s int [1:3, 1:2] NA NA 0 0 1 NA 707s mode: double 707s num [1:3, 1:2] NA NA 0 0 1 NA 707s > 707s > 707s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 707s > # Corner cases 707s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 707s > for (mode in c("logical", "integer", "double")) { 707s + cat("mode: ", mode, "\n", sep = "") 707s + value <- 0 707s + storage.mode(value) <- mode 707s + if (mode == "logical") value2 <- 0L 707s + 707s + # A 0x0 matrix 707s + x <- matrix(value, nrow = 0L, ncol = 0L) 707s + str(x) 707s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 707s + r1 <- rowCumprods(x) 707s + r2 <- t(colCumprods(t(x))) 707s + stopifnot(all.equal(r1, r2)) 707s + stopifnot(all.equal(r1, r0)) 707s + stopifnot(all.equal(r2, r0)) 707s + 707s + # A 0xK matrix 707s + x <- matrix(value, nrow = 0L, ncol = 5L) 707s + str(x) 707s + colnames <- LETTERS[1:5] 707s + # Test with and without dimnames on x 707s + for (setDimnames in c(TRUE, FALSE)) { 707s + if (setDimnames) colnames(x) <- colnames 707s + else dimnames(x) <- NULL 707s + # Check names attribute 707s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 707s + r0 <- rowCumprods_R(x, useNames = useNames) 707s + r1 <- rowCumprods(x, useNames = useNames) 707s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 707s + stopifnot(all.equal(r1, r2)) 707s + stopifnot(all.equal(r1, r0)) 707s + stopifnot(all.equal(r2, r0)) 707s + } # for (useNames ...) 707s + } # for (setDimnames ...) 707s + 707s + # A Nx0 matrix 707s + x <- matrix(value, nrow = 5L, ncol = 0L) 707s + str(x) 707s + rownames <- LETTERS[1:5] 707s + # Test with and without dimnames on x 707s + for (setDimnames in c(TRUE, FALSE)) { 707s + if (setDimnames) rownames(x) <- rownames 707s + else dimnames(x) <- NULL 707s + # Check names attribute 707s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 707s + r0 <- rowCumprods_R(x, useNames = useNames) 707s + r1 <- rowCumprods(x, useNames = useNames) 707s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 707s + stopifnot(all.equal(r1, r2)) 707s + stopifnot(all.equal(r1, r0)) 707s + stopifnot(all.equal(r2, r0)) 707s + } # for (useNames ...) 707s + } # for (setDimnames ...) 707s + } # for (mode ...) 707s mode: logical 707s logi[0 , 0 ] 707s logi[0 , 1:5] 708s logi[1:5, 0 ] 708s mode: integer 708s int[0 , 0 ] 708s int[0 , 1:5] 708s int[1:5, 0 ] 708s mode: double 708s num[0 , 0 ] 708s num[0 , 1:5] 708s num[1:5, 0 ] 708s > 708s 708s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 708s Copyright (C) 2024 The R Foundation for Statistical Computing 708s Platform: aarch64-unknown-linux-gnu (64-bit) 708s 708s R is free software and comes with ABSOLUTELY NO WARRANTY. 708s You are welcome to redistribute it under certain conditions. 708s Type 'license()' or 'licence()' for distribution details. 708s 708s R is a collaborative project with many contributors. 708s Type 'contributors()' for more information and 708s 'citation()' on how to cite R or R packages in publications. 708s 708s Type 'demo()' for some demos, 'help()' for on-line help, or 708s 'help.start()' for an HTML browser interface to help. 708s Type 'q()' to quit R. 708s 709s > library("matrixStats") 709s > 709s > rowCumprods_R <- function(x, ..., useNames = NA) { 709s + suppressWarnings({ 709s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 709s + }) 709s + 709s + # Preserve dimnames attribute? 709s + dim(y) <- dim(x) 709s + dimnames(y) <- if (isTRUE(useNames)) dimnames(x) else NULL 709s + 709s + y 709s + } 709s > 709s > 709s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 709s > # Subsetted tests 709s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 709s > source("utils/validateIndicesFramework.R") 709s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 709s > storage.mode(x) <- "integer" 709s > 709s > # To check dimnames attribute 709s > dimnames <- list(letters[1:6], LETTERS[1:6]) 709s > 709s > # Test with and without dimnames on x 709s > for (setDimnames in c(TRUE, FALSE)) { 709s + if (setDimnames) dimnames(x) <- dimnames 709s + else dimnames(x) <- NULL 709s + for (rows in index_cases) { 709s + for (cols in index_cases) { 709s + # Check names attribute 709s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 709s + validateIndicesTestMatrix(x, rows, cols, 709s + ftest = rowCumprods, fsure = rowCumprods_R, useNames = useNames) 709s + validateIndicesTestMatrix(x, rows, cols, 709s + ftest = function(x, rows, cols, ..., useNames) { 709s + t(colCumprods(t(x), rows = cols, cols = rows, useNames = useNames)) 709s + }, fsure = rowCumprods_R, useNames = useNames) 709s + } 709s + } 709s + } 709s + } 719s > 720s 720s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 720s Copyright (C) 2024 The R Foundation for Statistical Computing 720s Platform: aarch64-unknown-linux-gnu (64-bit) 720s 720s R is free software and comes with ABSOLUTELY NO WARRANTY. 720s You are welcome to redistribute it under certain conditions. 720s Type 'license()' or 'licence()' for distribution details. 720s 720s R is a collaborative project with many contributors. 720s Type 'contributors()' for more information and 720s 'citation()' on how to cite R or R packages in publications. 720s 720s Type 'demo()' for some demos, 'help()' for on-line help, or 720s 'help.start()' for an HTML browser interface to help. 720s Type 'q()' to quit R. 720s 721s > library("matrixStats") 721s > 721s > rowCumsums_R <- function(x, ..., useNames = NA) { 721s + suppressWarnings({ 721s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 721s + }) 721s + 721s + # Preserve dimnames attribute? 721s + dim(y) <- dim(x) 721s + dimnames(y) <- if (isTRUE(useNames)) dimnames(x) else NULL 721s + 721s + y 721s + } 721s > 721s > 721s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 721s > # With and without some NAs 721s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 721s > dimnames <- list(letters[1:10], LETTERS[1:5]) # to check dimnames attribute 721s > for (mode in c("logical", "integer", "double")) { 721s + for (add_na in c(FALSE, TRUE)) { 721s + cat("add_na = ", add_na, "\n", sep = "") 721s + 721s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 721s + if (add_na) { 721s + x[3:7, c(2, 4)] <- NA_real_ 721s + } 721s + cat("mode: ", mode, "\n", sep = "") 721s + storage.mode(x) <- mode 721s + str(x) 721s + 721s + # Test with and without dimnames on x 721s + for (setDimnames in c(TRUE, FALSE)) { 721s + if (setDimnames) dimnames(x) <- dimnames 721s + else dimnames(x) <- NULL 721s + # Check names attribute 721s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 721s + # Row/column ranges 721s + r0 <- rowCumsums_R(x, useNames = useNames) 721s + r1 <- rowCumsums(x, useNames = useNames) 721s + r2 <- t(colCumsums(t(x), useNames = useNames)) 721s + stopifnot(all.equal(r1, r2)) 721s + stopifnot(all.equal(r1, r0)) 721s + stopifnot(all.equal(r2, r0)) 721s + } # for (useNames ...) 721s + } # for (setDimnames ...) 721s + } # for (add_na ...) 721s + } 721s add_na = FALSE 721s mode: logical 721s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 721s add_na = TRUE 721s mode: logical 721s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 721s add_na = FALSE 721s mode: integer 721s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 721s add_na = TRUE 721s mode: integer 721s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 721s add_na = FALSE 721s mode: double 721s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 721s add_na = TRUE 721s mode: double 721s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 721s > 721s > 721s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 721s > # All NAs 721s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 721s > for (mode in c("logical", "integer", "double")) { 721s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 721s + cat("mode: ", mode, "\n", sep = "") 721s + storage.mode(x) <- mode 721s + str(x) 721s + 721s + # Test with and without dimnames on x 721s + for (setDimnames in c(TRUE, FALSE)) { 721s + if (setDimnames) dimnames(x) <- dimnames 721s + else dimnames(x) <- NULL 721s + # Check names attribute 721s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 721s + # Row/column ranges 721s + r0 <- rowCumsums_R(x, useNames = useNames) 721s + r1 <- rowCumsums(x, useNames = useNames) 721s + r2 <- t(colCumsums(t(x), useNames = useNames)) 721s + stopifnot(all.equal(r1, r2)) 721s + stopifnot(all.equal(r1, r0)) 721s + stopifnot(all.equal(r2, r0)) 721s + } # for (useNames ...) 721s + } # for (setDimnames ...) 721s + } # for (mode ...) 722s mode: logical 722s logi [1:10, 1:5] NA NA NA NA NA NA ... 722s mode: integer 722s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 722s mode: double 722s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 722s > 722s > 722s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 722s > # A 1x1 matrix 722s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 722s > dimnames <- list("a", "A") # to check dimnames attribute 722s > for (mode in c("logical", "integer", "double")) { 722s + x <- matrix(0, nrow = 1L, ncol = 1L) 722s + cat("mode: ", mode, "\n", sep = "") 722s + storage.mode(x) <- mode 722s + str(x) 722s + 722s + r0 <- rowCumsums_R(x) 722s + r1 <- rowCumsums(x) 722s + r2 <- t(colCumsums(t(x))) 722s + stopifnot(all.equal(r1, r2)) 722s + stopifnot(all.equal(r1, r0)) 722s + stopifnot(all.equal(r2, r0)) 722s + 722s + # Check dimnames attribute 722s + dimnames(x) <- dimnames 722s + # r0 <- rowCumsums_R(x) 722s + # > r0 722s + # a 722s + # [1,] 0 722s + r1 <- rowCumsums(x, useNames = TRUE) 722s + r2 <- t(colCumsums(t(x), useNames = TRUE)) 722s + stopifnot(identical(dimnames(r1), dimnames)) 722s + stopifnot(identical(dimnames(r2), dimnames)) 722s + dimnames(x) <- NULL 722s + } 722s mode: logical 722s logi [1, 1] FALSE 722s mode: integer 722s int [1, 1] 0 722s mode: double 722s num [1, 1] 0 722s > 722s > 722s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 722s > # Corner cases 722s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 722s > names <- LETTERS[1:5] # to check dimnames attribute 722s > for (mode in c("logical", "integer", "double")) { 722s + cat("mode: ", mode, "\n", sep = "") 722s + value <- 0 722s + storage.mode(value) <- mode 722s + value2 <- value 722s + if (mode == "logical") value2 <- 0L 722s + 722s + # A 0x0 matrix 722s + x <- matrix(value, nrow = 0L, ncol = 0L) 722s + str(x) 722s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 722s + r1 <- rowCumsums(x) 722s + r2 <- t(colCumsums(t(x))) 722s + stopifnot(all.equal(r1, r2)) 722s + stopifnot(all.equal(r1, r0)) 722s + stopifnot(all.equal(r2, r0)) 722s + 722s + # A 0xK matrix 722s + x <- matrix(value, nrow = 0L, ncol = 5L) 722s + str(x) 722s + colnames <- LETTERS[1:5] 722s + # Test with and without dimnames on x 722s + for (setDimnames in c(TRUE, FALSE)) { 722s + if (setDimnames) colnames(x) <- colnames 722s + else dimnames(x) <- NULL 722s + # Check names attribute 722s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 722s + r0 <- rowCumsums_R(x, useNames = useNames) 722s + r1 <- rowCumsums(x, useNames = useNames) 722s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 722s + stopifnot(all.equal(r1, r2)) 722s + stopifnot(all.equal(r1, r0)) 722s + stopifnot(all.equal(r2, r0)) 722s + } # for (useNames ...) 722s + } # for (setDimnames ...) 722s + 722s + # A Nx0 matrix 722s + x <- matrix(value, nrow = 5L, ncol = 0L) 722s + str(x) 722s + rownames <- LETTERS[1:5] 722s + # Test with and without dimnames on x 722s + for (setDimnames in c(TRUE, FALSE)) { 722s + if (setDimnames) rownames(x) <- rownames 722s + else dimnames(x) <- NULL 722s + # Check names attribute 722s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 722s + r0 <- rowCumsums_R(x, useNames = useNames) 722s + r1 <- rowCumsums(x, useNames = useNames) 722s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 722s + stopifnot(all.equal(r1, r2)) 722s + stopifnot(all.equal(r1, r0)) 722s + stopifnot(all.equal(r2, r0)) 722s + } # for (useNames ...) 722s + } # for (setDimnames ...) 722s + } # for (mode ...) 722s mode: logical 722s logi[0 , 0 ] 722s logi[0 , 1:5] 723s logi[1:5, 0 ] 723s mode: integer 723s int[0 , 0 ] 723s int[0 , 1:5] 723s int[1:5, 0 ] 723s mode: double 723s num[0 , 0 ] 723s num[0 , 1:5] 723s num[1:5, 0 ] 723s > 723s 723s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 723s Copyright (C) 2024 The R Foundation for Statistical Computing 723s Platform: aarch64-unknown-linux-gnu (64-bit) 723s 723s R is free software and comes with ABSOLUTELY NO WARRANTY. 723s You are welcome to redistribute it under certain conditions. 723s Type 'license()' or 'licence()' for distribution details. 723s 723s R is a collaborative project with many contributors. 723s Type 'contributors()' for more information and 723s 'citation()' on how to cite R or R packages in publications. 723s 723s Type 'demo()' for some demos, 'help()' for on-line help, or 723s 'help.start()' for an HTML browser interface to help. 723s Type 'q()' to quit R. 723s 724s > library("matrixStats") 724s > 724s > rowCumsums_R <- function(x, ..., useNames = NA) { 724s + suppressWarnings({ 724s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 724s + }) 724s + 724s + # Preserve dimnames attribute? 724s + dim(y) <- dim(x) 724s + dimnames(y) <- if (isTRUE(useNames)) dimnames(x) else NULL 724s + 724s + y 724s + } 724s > 724s > 724s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 724s > # Subsetted tests 724s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 724s > source("utils/validateIndicesFramework.R") 724s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 724s > storage.mode(x) <- "integer" 724s > 724s > # To check dimnames attribute 724s > dimnames <- list(letters[1:6], LETTERS[1:6]) 724s > 724s > # Test with and without dimnames on x 724s > for (setDimnames in c(TRUE, FALSE)) { 724s + if (setDimnames) dimnames(x) <- dimnames 724s + else dimnames(x) <- NULL 724s + for (rows in index_cases) { 724s + for (cols in index_cases) { 724s + # Check names attribute 724s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 724s + validateIndicesTestMatrix(x, rows, cols, 724s + ftest = rowCumsums, fsure = rowCumsums_R, useNames = useNames) 724s + validateIndicesTestMatrix(x, rows, cols, 724s + ftest = function(x, rows, cols, ..., useNames) { 724s + t(colCumsums(t(x), rows = cols, cols = rows, useNames = useNames)) 724s + }, fsure = rowCumsums_R, useNames = useNames) 724s + } 724s + } 724s + } 724s + } 732s > 733s 733s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 733s Copyright (C) 2024 The R Foundation for Statistical Computing 733s Platform: aarch64-unknown-linux-gnu (64-bit) 733s 733s R is free software and comes with ABSOLUTELY NO WARRANTY. 733s You are welcome to redistribute it under certain conditions. 733s Type 'license()' or 'licence()' for distribution details. 733s 733s R is a collaborative project with many contributors. 733s Type 'contributors()' for more information and 733s 'citation()' on how to cite R or R packages in publications. 733s 733s Type 'demo()' for some demos, 'help()' for on-line help, or 733s 'help.start()' for an HTML browser interface to help. 733s Type 'q()' to quit R. 733s 733s > library("matrixStats") 733s > 733s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = NA) { 733s + ncol2 <- ncol(x) - lag * differences 733s + if (ncol2 <= 0) { 733s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 733s + # Preserve names attribute 733s + if (isTRUE(useNames) && !is.null(rownames(x))) rownames(y) <- rownames(x) 733s + return(y) 733s + } 733s + suppressWarnings({ 733s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 733s + }) 733s + y <- t(y) 733s + 733s + # Preserve dimnames attribute 733s + dim(y) <- c(nrow(x), ncol2) 733s + if (isTRUE(useNames) && !is.null(dimnames(x))) { 733s + colnames <- colnames(x) 733s + if (!is.null(colnames)) { 733s + len <- length(colnames) 733s + colnames <- colnames[(len - ncol2 + 1):len] 733s + } 733s + dimnames(y) <- list(rownames(x), colnames) 733s + } 733s + else dimnames(y) <- NULL 733s + 733s + y 733s + } 733s > 733s > 733s > set.seed(0x42) 733s > 733s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 733s > # With and without some NAs 733s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 733s > for (mode in c("integer", "double")) { 733s + cat("mode: ", mode, "\n", sep = "") 733s + 733s + for (add_na in c(FALSE, TRUE)) { 733s + cat("add_na = ", add_na, "\n", sep = "") 733s + 733s + x <- matrix(sample(10 * 8) + 0.1, nrow = 10L, ncol = 8L) 733s + if (add_na) { 733s + x[3:7, c(2, 4)] <- NA_real_ 733s + } 733s + storage.mode(x) <- mode 733s + str(x) 733s + 733s + dimnames <- list(letters[1:10], LETTERS[1:8]) 733s + 733s + # Test with and without dimnames on x 733s + for (setDimnames in c(TRUE, FALSE)) { 733s + if (setDimnames) dimnames(x) <- dimnames 733s + else dimnames(x) <- NULL 733s + # Check dimnames attribute 733s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 733s + for (lag in 1:4) { 733s + for (differences in 1:3) { 733s + cat(sprintf("mode: %s, lag = %d, differences = %d\n", 733s + mode, lag, differences)) 733s + # Row/column ranges 733s + r0 <- rowDiffs_R(x, lag = lag, differences = differences, useNames = useNames) 733s + r1 <- rowDiffs(x, lag = lag, differences = differences, useNames = useNames) 733s + r2 <- t(colDiffs(t(x), lag = lag, differences = differences, useNames = useNames)) 733s + stopifnot(all.equal(r1, r0)) 733s + stopifnot(all.equal(r2, r0)) 733s + stopifnot(all.equal(r1, r2)) 733s + } 733s + } 733s + } # for (useNames ...) 733s + } # for (setDimnames ...) 733s + } # for (add_na ...) 733s + } # for (mode ...) 734s mode: integer 734s add_na = FALSE 734s int [1:10, 1:8] 68 26 29 47 48 10 1 38 16 40 ... 734s mode: integer, lag = 1, differences = 1 734s mode: integer, lag = 1, differences = 2 734s mode: integer, lag = 1, differences = 3 734s mode: integer, lag = 2, differences = 1 734s mode: integer, lag = 2, differences = 2 734s mode: integer, lag = 2, differences = 3 734s mode: integer, lag = 3, differences = 1 734s mode: integer, lag = 3, differences = 2 734s mode: integer, lag = 3, differences = 3 734s mode: integer, lag = 4, differences = 1 734s mode: integer, lag = 4, differences = 2 734s mode: integer, lag = 4, differences = 3 734s mode: integer, lag = 1, differences = 1 734s mode: integer, lag = 1, differences = 2 734s mode: integer, lag = 1, differences = 3 734s mode: integer, lag = 2, differences = 1 734s mode: integer, lag = 2, differences = 2 734s mode: integer, lag = 2, differences = 3 734s mode: integer, lag = 3, differences = 1 734s mode: integer, lag = 3, differences = 2 734s mode: integer, lag = 3, differences = 3 734s mode: integer, lag = 4, differences = 1 734s mode: integer, lag = 4, differences = 2 734s mode: integer, lag = 4, differences = 3 734s mode: integer, lag = 1, differences = 1 734s mode: integer, lag = 1, differences = 2 734s mode: integer, lag = 1, differences = 3 734s mode: integer, lag = 2, differences = 1 734s mode: integer, lag = 2, differences = 2 735s mode: integer, lag = 2, differences = 3 735s mode: integer, lag = 3, differences = 1 735s mode: integer, lag = 3, differences = 2 735s mode: integer, lag = 3, differences = 3 735s mode: integer, lag = 4, differences = 1 735s mode: integer, lag = 4, differences = 2 735s mode: integer, lag = 4, differences = 3 735s mode: integer, lag = 1, differences = 1 735s mode: integer, lag = 1, differences = 2 735s mode: integer, lag = 1, differences = 3 735s mode: integer, lag = 2, differences = 1 735s mode: integer, lag = 2, differences = 2 735s mode: integer, lag = 2, differences = 3 735s mode: integer, lag = 3, differences = 1 735s mode: integer, lag = 3, differences = 2 735s mode: integer, lag = 3, differences = 3 735s mode: integer, lag = 4, differences = 1 735s mode: integer, lag = 4, differences = 2 735s mode: integer, lag = 4, differences = 3 735s add_na = TRUE 735s int [1:10, 1:8] 80 71 7 52 79 22 31 10 29 63 ... 735s mode: integer, lag = 1, differences = 1 735s mode: integer, lag = 1, differences = 2 735s mode: integer, lag = 1, differences = 3 735s mode: integer, lag = 2, differences = 1 735s mode: integer, lag = 2, differences = 2 735s mode: integer, lag = 2, differences = 3 735s mode: integer, lag = 3, differences = 1 735s mode: integer, lag = 3, differences = 2 735s mode: integer, lag = 3, differences = 3 735s mode: integer, lag = 4, differences = 1 735s mode: integer, lag = 4, differences = 2 735s mode: integer, lag = 4, differences = 3 735s mode: integer, lag = 1, differences = 1 735s mode: integer, lag = 1, differences = 2 735s mode: integer, lag = 1, differences = 3 735s mode: integer, lag = 2, differences = 1 735s mode: integer, lag = 2, differences = 2 735s mode: integer, lag = 2, differences = 3 735s mode: integer, lag = 3, differences = 1 735s mode: integer, lag = 3, differences = 2 735s mode: integer, lag = 3, differences = 3 735s mode: integer, lag = 4, differences = 1 735s mode: integer, lag = 4, differences = 2 735s mode: integer, lag = 4, differences = 3 735s mode: integer, lag = 1, differences = 1 735s mode: integer, lag = 1, differences = 2 735s mode: integer, lag = 1, differences = 3 735s mode: integer, lag = 2, differences = 1 735s mode: integer, lag = 2, differences = 2 735s mode: integer, lag = 2, differences = 3 735s mode: integer, lag = 3, differences = 1 735s mode: integer, lag = 3, differences = 2 735s mode: integer, lag = 3, differences = 3 735s mode: integer, lag = 4, differences = 1 735s mode: integer, lag = 4, differences = 2 735s mode: integer, lag = 4, differences = 3 735s mode: integer, lag = 1, differences = 1 735s mode: integer, lag = 1, differences = 2 735s mode: integer, lag = 1, differences = 3 735s mode: integer, lag = 2, differences = 1 735s mode: integer, lag = 2, differences = 2 735s mode: integer, lag = 2, differences = 3 735s mode: integer, lag = 3, differences = 1 735s mode: integer, lag = 3, differences = 2 735s mode: integer, lag = 3, differences = 3 735s mode: integer, lag = 4, differences = 1 735s mode: integer, lag = 4, differences = 2 735s mode: integer, lag = 4, differences = 3 735s mode: double 735s add_na = FALSE 735s num [1:10, 1:8] 36.1 15.1 27.1 63.1 62.1 58.1 28.1 19.1 41.1 3.1 ... 735s mode: double, lag = 1, differences = 1 735s mode: double, lag = 1, differences = 2 735s mode: double, lag = 1, differences = 3 735s mode: double, lag = 2, differences = 1 735s mode: double, lag = 2, differences = 2 735s mode: double, lag = 2, differences = 3 735s mode: double, lag = 3, differences = 1 735s mode: double, lag = 3, differences = 2 735s mode: double, lag = 3, differences = 3 735s mode: double, lag = 4, differences = 1 735s mode: double, lag = 4, differences = 2 735s mode: double, lag = 4, differences = 3 735s mode: double, lag = 1, differences = 1 735s mode: double, lag = 1, differences = 2 735s mode: double, lag = 1, differences = 3 735s mode: double, lag = 2, differences = 1 735s mode: double, lag = 2, differences = 2 735s mode: double, lag = 2, differences = 3 735s mode: double, lag = 3, differences = 1 735s mode: double, lag = 3, differences = 2 735s mode: double, lag = 3, differences = 3 735s mode: double, lag = 4, differences = 1 735s mode: double, lag = 4, differences = 2 735s mode: double, lag = 4, differences = 3 735s mode: double, lag = 1, differences = 1 735s mode: double, lag = 1, differences = 2 735s mode: double, lag = 1, differences = 3 735s mode: double, lag = 2, differences = 1 735s mode: double, lag = 2, differences = 2 735s mode: double, lag = 2, differences = 3 735s mode: double, lag = 3, differences = 1 735s mode: double, lag = 3, differences = 2 735s mode: double, lag = 3, differences = 3 735s mode: double, lag = 4, differences = 1 735s mode: double, lag = 4, differences = 2 735s mode: double, lag = 4, differences = 3 735s mode: double, lag = 1, differences = 1 735s mode: double, lag = 1, differences = 2 735s mode: double, lag = 1, differences = 3 735s mode: double, lag = 2, differences = 1 735s mode: double, lag = 2, differences = 2 735s mode: double, lag = 2, differences = 3 735s mode: double, lag = 3, differences = 1 735s mode: double, lag = 3, differences = 2 735s mode: double, lag = 3, differences = 3 735s mode: double, lag = 4, differences = 1 735s mode: double, lag = 4, differences = 2 735s mode: double, lag = 4, differences = 3 735s add_na = TRUE 735s num [1:10, 1:8] 67.1 80.1 45.1 8.1 39.1 66.1 27.1 71.1 47.1 46.1 ... 735s mode: double, lag = 1, differences = 1 735s mode: double, lag = 1, differences = 2 735s mode: double, lag = 1, differences = 3 735s mode: double, lag = 2, differences = 1 735s mode: double, lag = 2, differences = 2 735s mode: double, lag = 2, differences = 3 735s mode: double, lag = 3, differences = 1 735s mode: double, lag = 3, differences = 2 735s mode: double, lag = 3, differences = 3 735s mode: double, lag = 4, differences = 1 735s mode: double, lag = 4, differences = 2 735s mode: double, lag = 4, differences = 3 735s mode: double, lag = 1, differences = 1 735s mode: double, lag = 1, differences = 2 735s mode: double, lag = 1, differences = 3 735s mode: double, lag = 2, differences = 1 735s mode: double, lag = 2, differences = 2 735s mode: double, lag = 2, differences = 3 735s mode: double, lag = 3, differences = 1 735s mode: double, lag = 3, differences = 2 735s mode: double, lag = 3, differences = 3 735s mode: double, lag = 4, differences = 1 735s mode: double, lag = 4, differences = 2 736s mode: double, lag = 4, differences = 3 736s mode: double, lag = 1, differences = 1 736s mode: double, lag = 1, differences = 2 736s mode: double, lag = 1, differences = 3 736s mode: double, lag = 2, differences = 1 736s mode: double, lag = 2, differences = 2 736s mode: double, lag = 2, differences = 3 736s mode: double, lag = 3, differences = 1 736s mode: double, lag = 3, differences = 2 736s mode: double, lag = 3, differences = 3 736s mode: double, lag = 4, differences = 1 736s mode: double, lag = 4, differences = 2 736s mode: double, lag = 4, differences = 3 736s mode: double, lag = 1, differences = 1 736s mode: double, lag = 1, differences = 2 736s mode: double, lag = 1, differences = 3 736s mode: double, lag = 2, differences = 1 736s mode: double, lag = 2, differences = 2 736s mode: double, lag = 2, differences = 3 736s mode: double, lag = 3, differences = 1 736s mode: double, lag = 3, differences = 2 736s mode: double, lag = 3, differences = 3 736s mode: double, lag = 4, differences = 1 736s mode: double, lag = 4, differences = 2 736s mode: double, lag = 4, differences = 3 736s > 736s > 736s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 736s > # All NAs 736s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 736s > for (mode in c("integer", "double")) { 736s + cat("mode: ", mode, "\n", sep = "") 736s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 736s + storage.mode(x) <- mode 736s + str(x) 736s + 736s + dimnames <- list(letters[1:10], LETTERS[1:5]) 736s + 736s + # Test with and without dimnames on x 736s + for (setDimnames in c(TRUE, FALSE)) { 736s + if (setDimnames) dimnames(x) <- dimnames 736s + else dimnames(x) <- NULL 736s + # Check dimnames attribute 736s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 736s + r0 <- rowDiffs_R(x, useNames = useNames) 736s + r1 <- rowDiffs(x, useNames = useNames) 736s + r2 <- t(colDiffs(t(x), useNames = useNames)) 736s + stopifnot(all.equal(r1, r0)) 736s + stopifnot(all.equal(r2, r0)) 736s + stopifnot(all.equal(r1, r2)) 736s + } # for (useNames ...) 736s + } # for (setDimnames ...) 736s + } # for (mode ...) 736s mode: integer 736s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 736s mode: double 736s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 736s > 736s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 736s > # A 1x1 matrix 736s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 736s > x <- matrix(0, nrow = 1L, ncol = 1L) 736s > dimnames <- list("a", "A") 736s > # Test with and without dimnames on x 736s > for (setDimnames in c(TRUE, FALSE)) { 736s + if (setDimnames) dimnames(x) <- dimnames 736s + else dimnames(x) <- NULL 736s + # Check dimnames attribute 736s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 736s + r0 <- rowDiffs_R(x, useNames = useNames) 736s + r1 <- rowDiffs(x, useNames = useNames) 736s + r2 <- t(colDiffs(t(x), useNames = useNames)) 736s + stopifnot(all.equal(r1, r0)) 736s + stopifnot(all.equal(r2, r0)) 736s + stopifnot(all.equal(r1, r2)) 736s + } # for (useNames ...) 736s + } # for (setDimnames ...) 736s > 737s 737s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 737s Copyright (C) 2024 The R Foundation for Statistical Computing 737s Platform: aarch64-unknown-linux-gnu (64-bit) 737s 737s R is free software and comes with ABSOLUTELY NO WARRANTY. 737s You are welcome to redistribute it under certain conditions. 737s Type 'license()' or 'licence()' for distribution details. 737s 737s R is a collaborative project with many contributors. 737s Type 'contributors()' for more information and 737s 'citation()' on how to cite R or R packages in publications. 737s 737s Type 'demo()' for some demos, 'help()' for on-line help, or 737s 'help.start()' for an HTML browser interface to help. 737s Type 'q()' to quit R. 737s 737s > library("matrixStats") 737s > 737s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = NA) { 737s + ncol2 <- ncol(x) - lag * differences 737s + if (ncol2 <= 0) { 737s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 737s + # Preserve names attribute 737s + if (isTRUE(useNames) && !is.null(rownames(x))) rownames(y) <- rownames(x) 737s + return(y) 737s + } 737s + suppressWarnings({ 737s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 737s + }) 737s + y <- t(y) 737s + 737s + # Preserve dimnames attribute 737s + dim(y) <- c(nrow(x), ncol2) 737s + if (isTRUE(useNames) && !is.null(dimnames(x))) { 737s + colnames <- colnames(x) 737s + if (!is.null(colnames)) { 737s + len <- length(colnames) 737s + colnames <- colnames[(len - ncol2 + 1):len] 737s + } 737s + dimnames(y) <- list(rownames(x), colnames) 737s + } 737s + else dimnames(y) <- NULL 737s + 737s + y 737s + } 737s > 737s > 737s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 737s > # Subsetted tests 737s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 737s > source("utils/validateIndicesFramework.R") 737s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 737s > storage.mode(x) <- "integer" 737s > 737s > # To check dimnames attribute 737s > dimnames <- list(letters[1:6], LETTERS[1:6]) 737s > 737s > # Test with and without dimnames on x 737s > for (setDimnames in c(TRUE, FALSE)) { 737s + if (setDimnames) dimnames(x) <- dimnames 737s + else dimnames(x) <- NULL 737s + 737s + count <- 0L 737s + for (rows in index_cases) { 737s + for (cols in index_cases) { 737s + count <- count + 1L 737s + for (lag in 1:2) { 737s + for (differences in 1:3) { 737s + # Check dimnames attribute 737s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 737s + useNames <- useNames[count %% length(useNames) + 1] 737s + validateIndicesTestMatrix(x, rows, cols, 737s + ftest = rowDiffs, fsure = rowDiffs_R, 737s + lag = lag, differences = differences, useNames = useNames) 737s + validateIndicesTestMatrix(x, rows, cols, 737s + ftest = function(x, rows, cols, ..., useNames) { 737s + t(colDiffs(t(x), rows = cols, cols = rows, ..., useNames = useNames)) 737s + }, fsure = rowDiffs_R, 737s + lag = lag, differences = differences, useNames = useNames) 737s + } 737s + } 737s + } 737s + } 737s + } 760s > 761s 761s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 761s Copyright (C) 2024 The R Foundation for Statistical Computing 761s Platform: aarch64-unknown-linux-gnu (64-bit) 761s 761s R is free software and comes with ABSOLUTELY NO WARRANTY. 761s You are welcome to redistribute it under certain conditions. 761s Type 'license()' or 'licence()' for distribution details. 761s 761s R is a collaborative project with many contributors. 761s Type 'contributors()' for more information and 761s 'citation()' on how to cite R or R packages in publications. 761s 761s Type 'demo()' for some demos, 'help()' for on-line help, or 761s 'help.start()' for an HTML browser interface to help. 761s Type 'q()' to quit R. 761s 761s > library("matrixStats") 761s > 761s > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 761s + quantile_na <- function(x, ..., na.rm = FALSE) { 761s + if (!na.rm && anyMissing(x)) 761s + return(c(NA_real_, NA_real_)) 761s + quantile(x, ..., na.rm = na.rm) 761s + } 761s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 761s + probs = c(0.25, 0.75), na.rm = na.rm) 761s + rownames(q) <- NULL # Not needed anymore 761s + 761s + # Preserve names attribute 761s + dim(q) <- c(2L, nrow(x)) 761s + colnames(q) <- if (isTRUE(useNames)) rownames(x) else NULL 761s + 761s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 761s + } 761s > 761s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 761s > # Test with multiple quantiles 761s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 761s > for (mode in c("integer", "double")) { 761s + cat("mode: ", mode, "\n", sep = "") 761s + x <- matrix(1:100 + 0.1, nrow = 10, ncol = 10) 761s + storage.mode(x) <- mode 761s + str(x) 761s + 761s + # To check names attribute 761s + dimnames <- list(letters[1:10], LETTERS[1:10]) 761s + 761s + for (add_na in c(FALSE, TRUE)) { 761s + if (add_na) { 761s + x[3:5, 6:9] <- NA 761s + } 761s + # Test with and without dimnames on x 761s + for (setDimnames in c(TRUE, FALSE)) { 761s + if (setDimnames) dimnames(x) <- dimnames 761s + else dimnames(x) <- NULL 761s + for (na.rm in c(FALSE, TRUE)) { 761s + # Check names attribute 761s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 761s + probs <- c(0, 0.5, 1) 761s + q0 <- rowIQRs_R(x, na.rm = na.rm, useNames = useNames) 761s + print(q0) 761s + q1 <- rowIQRs(x, na.rm = na.rm, useNames = useNames) 761s + print(q1) 761s + stopifnot(all.equal(q1, q0)) 761s + q2 <- colIQRs(t(x), na.rm = na.rm, useNames = useNames) 761s + stopifnot(all.equal(q2, q0)) 761s + 761s + q <- iqr(x[3, ], na.rm = na.rm) 761s + print(q) 761s + } # for (useNames ...) 761s + } # for (na.rm ...) 761s + } # for (setDimnames ...) 761s + } # for (add_na ...) 761s + } # for (mode ...) 762s mode: integer 762s int [1:10, 1:10] 1 2 3 4 5 6 7 8 9 10 ... 762s a b c d e f g h i j 762s 45 45 45 45 45 45 45 45 45 45 762s a b c d e f g h i j 762s 45 45 45 45 45 45 45 45 45 45 762s [1] 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 762s a b c d e f g h i j 762s 45 45 45 45 45 45 45 45 45 45 762s a b c d e f g h i j 762s 45 45 45 45 45 45 45 45 45 45 762s [1] 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 45 45 45 45 45 45 45 45 45 762s [1] 45 762s a b c d e f g h i j 762s 45 45 NA NA NA 45 45 45 45 45 762s a b c d e f g h i j 762s 45 45 NA NA NA 45 45 45 45 45 762s [1] NA 762s [1] 45 45 NA NA NA 45 45 45 45 45 762s [1] 45 45 NA NA NA 45 45 45 45 45 762s [1] NA 762s a b c d e f g h i j 763s 45 45 25 25 25 45 45 45 45 45 763s a b c d e f g h i j 763s 45 45 25 25 25 45 45 45 45 45 763s [1] 25 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 25 763s [1] 45 45 NA NA NA 45 45 45 45 45 763s [1] 45 45 NA NA NA 45 45 45 45 45 763s [1] NA 763s [1] 45 45 NA NA NA 45 45 45 45 45 763s [1] 45 45 NA NA NA 45 45 45 45 45 763s [1] NA 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 25 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 25 763s mode: double 763s num [1:10, 1:10] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 763s a b c d e f g h i j 763s 45 45 45 45 45 45 45 45 45 45 763s a b c d e f g h i j 763s 45 45 45 45 45 45 45 45 45 45 763s [1] 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 763s a b c d e f g h i j 763s 45 45 45 45 45 45 45 45 45 45 763s a b c d e f g h i j 763s 45 45 45 45 45 45 45 45 45 45 763s [1] 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 45 45 45 45 45 45 45 45 45 763s [1] 45 763s a b c d e f g h i j 763s 45 45 NA NA NA 45 45 45 45 45 763s a b c d e f g h i j 763s 45 45 NA NA NA 45 45 45 45 45 763s [1] NA 763s [1] 45 45 NA NA NA 45 45 45 45 45 763s [1] 45 45 NA NA NA 45 45 45 45 45 763s [1] NA 763s a b c d e f g h i j 763s 45 45 25 25 25 45 45 45 45 45 763s a b c d e f g h i j 763s 45 45 25 25 25 45 45 45 45 45 763s [1] 25 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 25 763s [1] 45 45 NA NA NA 45 45 45 45 45 763s [1] 45 45 NA NA NA 45 45 45 45 45 763s [1] NA 763s [1] 45 45 NA NA NA 45 45 45 45 45 763s [1] 45 45 NA NA NA 45 45 45 45 45 763s [1] NA 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 25 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 45 45 25 25 25 45 45 45 45 45 763s [1] 25 763s > 763s > 763s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 763s > # Test corner cases 763s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 763s > for (mode in c("integer", "double")) { 763s + cat("mode: ", mode, "\n", sep = "") 763s + # Empty vectors 763s + x <- integer(0L) 763s + storage.mode(x) <- mode 763s + str(x) 763s + q <- iqr(x) 763s + print(q) 763s + stopifnot(identical(q, NA_real_)) 763s + 763s + # Scalar 763s + x <- 1L 763s + storage.mode(x) <- mode 763s + str(x) 763s + q <- iqr(x) 763s + str(q) 763s + stopifnot(identical(q, 0)) 763s + } 764s mode: integer 764s int(0) 764s [1] NA 764s int 1 764s num 0 764s mode: double 764s num(0) 764s [1] NA 764s num 1 764s num 0 764s > 764s > 764s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 764s > # Single row matrices 764s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 764s > x <- matrix(1, nrow = 1L, ncol = 2L) 764s > dimnames <- list("a", LETTERS[1:2]) 764s > # Test with and without dimnames on x 764s > for (setDimnames in c(TRUE, FALSE)) { 764s + if (setDimnames) dimnames(x) <- dimnames 764s + else dimnames(x) <- NULL 764s + # Check names attribute 764s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 764s + q0 <- rowIQRs_R(x, useNames = useNames) 764s + q1 <- rowIQRs(x, useNames = useNames) 764s + q2 <- colIQRs(t(x), useNames = useNames) 764s + stopifnot(all.equal(q0, q1)) 764s + stopifnot(all.equal(q0, q2)) 764s + } 764s + } 764s > 764s > x <- matrix(1, nrow = 2L, ncol = 1L) 764s > q <- colIQRs(x) 764s > stopifnot(identical(q, 0)) 764s > 764s 764s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 764s Copyright (C) 2024 The R Foundation for Statistical Computing 764s Platform: aarch64-unknown-linux-gnu (64-bit) 764s 764s R is free software and comes with ABSOLUTELY NO WARRANTY. 764s You are welcome to redistribute it under certain conditions. 764s Type 'license()' or 'licence()' for distribution details. 764s 764s R is a collaborative project with many contributors. 764s Type 'contributors()' for more information and 764s 'citation()' on how to cite R or R packages in publications. 764s 764s Type 'demo()' for some demos, 'help()' for on-line help, or 764s 'help.start()' for an HTML browser interface to help. 764s Type 'q()' to quit R. 764s 765s > library("matrixStats") 765s > 765s > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 765s + quantile_na <- function(x, ..., na.rm = FALSE) { 765s + if (!na.rm && anyMissing(x)) 765s + return(c(NA_real_, NA_real_)) 765s + quantile(x, ..., na.rm = na.rm) 765s + } 765s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 765s + probs = c(0.25, 0.75), na.rm = na.rm) 765s + rownames(q) <- NULL # Not needed anymore 765s + 765s + # Preserve names attribute 765s + dim(q) <- c(2L, nrow(x)) 765s + colnames(q) <- if (isTRUE(useNames)) rownames(x) else NULL 765s + 765s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 765s + } 765s > 765s > 765s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 765s > # Subsetted tests 765s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 765s > source("utils/validateIndicesFramework.R") 765s > x <- runif(6, min = -6, max = 6) 765s > for (idxs in index_cases) { 765s + for (na.rm in c(TRUE, FALSE)) { 765s + validateIndicesTestVector(x, idxs, ftest = iqr, fsure = function(x, na.rm) { 765s + dim(x) <- c(1L, length(x)) 765s + rowIQRs_R(x, na.rm = na.rm) 765s + }, na.rm = na.rm) 765s + } 765s + } 766s > 766s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 766s > 766s > # To check names attribute 766s > dimnames <- list(letters[1:6], LETTERS[1:6]) 766s > 766s > # Test with and without dimnames on x 766s > for (setDimnames in c(TRUE, FALSE)) { 766s + if (setDimnames) dimnames(x) <- dimnames 766s + else dimnames(x) <- NULL 766s + 766s + count <- 0L 766s + for (rows in index_cases) { 766s + for (cols in index_cases) { 766s + count <- count + 1L 766s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 766s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 766s + useNames <- useNames[count %% length(useNames) + 1] 766s + 766s + validateIndicesTestMatrix(x, rows, cols, 766s + ftest = rowIQRs, fsure = rowIQRs_R, 766s + na.rm = na.rm, useNames = useNames) 766s + validateIndicesTestMatrix(x, rows, cols, 766s + fcoltest = colIQRs, fsure = rowIQRs_R, 766s + na.rm = na.rm, useNames = useNames) 766s + } 766s + } 766s + } 777s > 778s 778s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 778s Copyright (C) 2024 The R Foundation for Statistical Computing 778s Platform: aarch64-unknown-linux-gnu (64-bit) 778s 778s R is free software and comes with ABSOLUTELY NO WARRANTY. 778s You are welcome to redistribute it under certain conditions. 778s Type 'license()' or 'licence()' for distribution details. 778s 778s R is a collaborative project with many contributors. 778s Type 'contributors()' for more information and 778s 'citation()' on how to cite R or R packages in publications. 778s 778s Type 'demo()' for some demos, 'help()' for on-line help, or 778s 'help.start()' for an HTML browser interface to help. 778s Type 'q()' to quit R. 778s 778s > # Test inspired by the harmonic mean example in R-help 778s > # thread '[R] Beyond double-precision?' on May 9, 2009. 778s > 778s > library("matrixStats") 779s > library("stats") 779s > 779s > logSumExp0 <- function(lx) { 779s + idx_max <- which.max(lx) 779s + log1p(sum(exp(lx[-idx_max] - lx[idx_max]))) + lx[idx_max] 779s + } 779s > 779s > n <- 200L 779s > set.seed(1) 779s > 779s > for (mode in c("integer", "double")) { 779s + cat("mode: ", mode, "\n", sep = "") 779s + x <- matrix(runif(n, min = 1.0, max = 3.0), nrow = 20L) 779s + storage.mode(x) <- mode 779s + str(x) 779s + 779s + # The logarithm of the harmonic mean by rows 779s + y_h <- log(1 / rowMeans(1 / x)) 779s + str(y_h) 779s + 779s + lx_neg <- -log(x) 779s + 779s + y0 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp0) 779s + stopifnot(all.equal(y0, y_h)) 779s + 779s + y1 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp) 779s + stopifnot(all.equal(y1, y0)) 779s + 779s + y2 <- log(ncol(x)) - rowLogSumExps(lx_neg) 779s + stopifnot(all.equal(y2, y0)) 779s + 779s + y3 <- log(ncol(x)) - colLogSumExps(t(lx_neg)) 779s + stopifnot(all.equal(y3, y0)) 779s + 779s + 779s + # The logarithm of the harmonic mean by columns 779s + y_h <- log(1 / colMeans(1 / x)) 779s + str(y_h) 779s + 779s + y0 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp0) 779s + stopifnot(all.equal(y0, y_h)) 779s + 779s + y1 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp) 779s + stopifnot(all.equal(y1, y0)) 779s + 779s + y2 <- log(nrow(x)) - colLogSumExps(lx_neg) 779s + stopifnot(all.equal(y2, y0)) 779s + 779s + y3 <- log(nrow(x)) - rowLogSumExps(t(lx_neg)) 779s + stopifnot(all.equal(y3, y0)) 779s + 779s + # Testing names 779s + rownames(lx_neg) <- seq_len(nrow(x)) 779s + colnames(lx_neg) <- seq_len(ncol(x)) 779s + y2 <- rowLogSumExps(lx_neg, useNames = TRUE) 779s + stopifnot(identical(names(y2), rownames(lx_neg))) 779s + y3 <- colLogSumExps(t(lx_neg), useNames = TRUE) 779s + stopifnot(identical(names(y3), rownames(lx_neg))) 779s + } # for (mode ...) 779s mode: integer 779s int [1:20, 1:10] 1 1 2 2 1 2 2 2 2 1 ... 779s num [1:20] 0.357 0.223 0.223 0.288 0.511 ... 779s num [1:10] 0.322 0.223 0.322 0.255 0.255 ... 779s mode: double 779s num [1:20, 1:10] 1.54 1.44 2.03 1.54 1.36 ... 779s num [1:20] 0.526 0.466 0.734 0.638 0.604 ... 779s num [1:10] 0.627 0.582 0.617 0.474 0.418 ... 779s > 779s > 779s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 779s > # Corner cases 779s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 779s > ## Zero-size matrices 779s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 0L) 779s > y <- rowLogSumExps(lx) 779s > print(y) 779s numeric(0) 779s > stopifnot(length(y) == nrow(lx)) 779s > 779s > y <- colLogSumExps(lx) 779s > print(y) 779s numeric(0) 779s > stopifnot(length(y) == ncol(lx)) 779s > 779s > ## Zero-height matrices 779s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 5L) 779s > y <- rowLogSumExps(lx) 779s > print(y) 779s numeric(0) 779s > stopifnot(length(y) == nrow(lx)) 779s > 779s > y <- colLogSumExps(lx) 779s > print(y) 779s [1] -Inf -Inf -Inf -Inf -Inf 779s > stopifnot(length(y) == ncol(lx)) 779s > stopifnot(all(y == -Inf)) 779s > 779s > ## Zero-width matrices 779s > lx <- matrix(numeric(0L), nrow = 5L, ncol = 0L) 779s > y <- colLogSumExps(lx) 779s > print(y) 779s numeric(0) 779s > stopifnot(length(y) == ncol(lx)) 779s > 779s > y <- rowLogSumExps(lx) 779s > print(y) 779s [1] -Inf -Inf -Inf -Inf -Inf 779s > stopifnot(length(y) == nrow(lx)) 779s > stopifnot(all(y == -Inf)) 779s > 779s > 779s > ## Matrices with one element 779s > lx <- matrix(1.0, nrow = 1L, ncol = 1L) 779s > y <- rowLogSumExps(lx) 779s > print(y) 779s [1] 1 779s > stopifnot(length(y) == nrow(lx)) 779s > stopifnot(all(y == lx)) 779s > 779s > y <- colLogSumExps(lx) 779s > print(y) 779s [1] 1 779s > stopifnot(length(y) == ncol(lx)) 779s > stopifnot(all(y == lx)) 779s > 779s > ## All missing values 779s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 779s > y <- rowLogSumExps(lx, na.rm = TRUE) 779s > print(y) 779s [1] -Inf 779s > stopifnot(length(y) == nrow(lx)) 779s > stopifnot(identical(y, -Inf)) 779s > 779s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 779s > y <- colLogSumExps(lx, na.rm = TRUE) 779s > print(y) 779s [1] -Inf 779s > stopifnot(length(y) == ncol(lx)) 779s > stopifnot(identical(y, -Inf)) 779s > 779s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 779s > y <- rowLogSumExps(lx, na.rm = TRUE) 779s > print(y) 779s [1] -Inf -Inf 779s > stopifnot(length(y) == nrow(lx)) 779s > stopifnot(all(y == -Inf)) 779s > 779s > y <- rowLogSumExps(lx, na.rm = FALSE) 779s > print(y) 779s [1] NA NA 779s > stopifnot(length(y) == nrow(lx)) 779s > stopifnot(all(is.na(y) & !is.nan(y))) 779s > 779s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 779s > y <- colLogSumExps(lx, na.rm = TRUE) 779s > print(y) 779s [1] -Inf -Inf 779s > stopifnot(length(y) == ncol(lx)) 779s > stopifnot(all(y == -Inf)) 779s > 779s > y <- colLogSumExps(lx, na.rm = FALSE) 779s > print(y) 779s [1] NA NA 779s > stopifnot(length(y) == ncol(lx)) 779s > stopifnot(all(is.na(y) & !is.nan(y))) 779s > 779s > ## +Inf values 779s > lx <- matrix(c(1, 2, +Inf), nrow = 3L, ncol = 2L) 779s > y <- colLogSumExps(lx, na.rm = TRUE) 779s > print(y) 779s [1] Inf Inf 779s > stopifnot(length(y) == ncol(lx)) 779s > stopifnot(all(y == +Inf)) 779s > 779s > ## multiple -Inf values 779s > lx <- matrix(c(-Inf, -Inf), nrow = 2L, ncol = 3L) 779s > y <- rowLogSumExps(lx) 779s > print(y) 779s [1] -Inf -Inf 779s > stopifnot(length(y) == nrow(lx)) 779s > stopifnot(all(y == -Inf)) 779s > 779s > lx <- matrix(c(-Inf, 5, -Inf), nrow = 2L, ncol = 3L, byrow = TRUE) 779s > y <- rowLogSumExps(lx) 779s > print(y) 779s [1] 5 5 779s > stopifnot(length(y) == nrow(lx)) 779s > stopifnot(all(y == 5)) 779s > 779s > ## Bug report #104 (https://github.com/HenrikBengtsson/matrixStats/issues/104) 779s > ## (This would core dump on Windows) 779s > x <- matrix(0.0, nrow = 2L, ncol = 32762L) 779s > y <- colLogSumExps(x) 779s > str(y) 779s num [1:32762] 0.693 0.693 0.693 0.693 0.693 ... 779s > 779s > ## Bug report #120 (https://github.com/HenrikBengtsson/matrixStats/issues/120) 779s > ## (This would error if x had rownames/colnames and non-NULL rows/cols were 779s > ## used) 779s > x <- matrix(runif(6), nrow = 2L, ncol = 3L, 779s + dimnames = list(c("A", "B"), c("a", "b", "c"))) 779s > y <- colLogSumExps(x, cols = 3:1, useNames = TRUE) 779s > stopifnot(names(y) == c("c", "b", "a")) 779s > y <- rowLogSumExps(x, rows = 2, useNames = TRUE) 779s > stopifnot(names(y) == "B") 779s > 779s > 779s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 779s > # Check names attributes 779s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 779s > 779s > ## Create isFALSE() if running on an old version of R 779s > if (!exists("isFALSE", mode="function")) { 779s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 779s + } 779s > 779s > rowLogSumExps_R <- function(x, ..., useNames = NA) { 779s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 779s + log(sum(exp(rx), ...)) 779s + }, ...) 779s + if (isFALSE(useNames)) names(res) <- NULL 779s + res 779s + } 779s > 779s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 779s > 779s > # To check names attribute 779s > dimnames <- list(letters[1:6], LETTERS[1:6]) 779s > 779s > # Test with and without dimnames on x 779s > for (setDimnames in c(TRUE, FALSE)) { 779s + if (setDimnames) dimnames(x) <- dimnames 779s + else dimnames(x) <- NULL 779s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 779s + y0 <- rowLogSumExps_R(x, useNames = useNames) 779s + y1 <- rowLogSumExps(x, useNames = useNames) 779s + y2 <- colLogSumExps(t(x), useNames = useNames) 779s + stopifnot(all.equal(y1, y0)) 779s + stopifnot(all.equal(y2, y0)) 779s + } 779s + } 779s > 779s 779s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 779s Copyright (C) 2024 The R Foundation for Statistical Computing 779s Platform: aarch64-unknown-linux-gnu (64-bit) 779s 779s R is free software and comes with ABSOLUTELY NO WARRANTY. 779s You are welcome to redistribute it under certain conditions. 779s Type 'license()' or 'licence()' for distribution details. 779s 779s R is a collaborative project with many contributors. 779s Type 'contributors()' for more information and 779s 'citation()' on how to cite R or R packages in publications. 779s 779s Type 'demo()' for some demos, 'help()' for on-line help, or 779s 'help.start()' for an HTML browser interface to help. 779s Type 'q()' to quit R. 779s 780s > library("matrixStats") 780s > 780s > ## Create isFALSE() if running on an old version of R 780s > if (!exists("isFALSE", mode="function")) { 780s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 780s + } 780s > 780s > rowLogSumExps_R <- function(x, ..., useNames = NA) { 780s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 780s + log(sum(exp(rx), ...)) 780s + }, ...) 780s + if (isFALSE(useNames)) names(res) <- NULL 780s + res 780s + } 780s > 780s > 780s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 780s > # Subsetted tests 780s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 780s > source("utils/validateIndicesFramework.R") 780s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 780s > 780s > # To check names attribute 780s > dimnames <- list(letters[1:6], LETTERS[1:6]) 780s > 780s > # Test with and without dimnames on x 780s > for (setDimnames in c(TRUE, FALSE)) { 780s + if (setDimnames) dimnames(x) <- dimnames 780s + else dimnames(x) <- NULL 780s + for (rows in index_cases) { 780s + for (cols in index_cases) { 780s + for (na.rm in c(TRUE, FALSE)) { 780s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 780s + validateIndicesTestMatrix(x, rows, cols, 780s + ftest = rowLogSumExps, 780s + fsure = rowLogSumExps_R, 780s + na.rm = na.rm, useNames = useNames) 780s + validateIndicesTestMatrix(x, rows, cols, 780s + fcoltest = colLogSumExps, 780s + fsure = rowLogSumExps_R, 780s + na.rm = na.rm, useNames = useNames) 780s + } 780s + } 780s + } 780s + } 780s + } 787s > 787s 787s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 787s Copyright (C) 2024 The R Foundation for Statistical Computing 787s Platform: aarch64-unknown-linux-gnu (64-bit) 787s 787s R is free software and comes with ABSOLUTELY NO WARRANTY. 787s You are welcome to redistribute it under certain conditions. 787s Type 'license()' or 'licence()' for distribution details. 787s 787s R is a collaborative project with many contributors. 787s Type 'contributors()' for more information and 787s 'citation()' on how to cite R or R packages in publications. 787s 787s Type 'demo()' for some demos, 'help()' for on-line help, or 787s 'help.start()' for an HTML browser interface to help. 787s Type 'q()' to quit R. 787s 788s > library("matrixStats") 788s > 788s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 788s > options(matrixStats.center.onUse = "ignore") 788s > 788s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 788s + suppressWarnings({ 788s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 788s + }) 788s + if (is.na(useNames) || !useNames) names(res) <- NULL 788s + res 788s + } 788s > 788s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 788s + suppressWarnings({ 788s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 788s + }) 788s + if (is.na(useNames) || !useNames) names(res) <- NULL 788s + res 788s + } 788s > 788s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 788s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 788s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 788s + } 788s > 788s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 788s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 788s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 788s + } 788s > 788s > 788s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 788s > # A 3x3 matrix (no ties) 788s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 788s > for (mode in c("integer", "double")) { 788s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 788s + cat("mode: ", mode, "\n", sep = "") 788s + storage.mode(x) <- mode 788s + str(x) 788s + 788s + # To check name attribute 788s + dimnames <- list(letters[1:3], LETTERS[1:3]) 788s + 788s + # Test with and without dimnames on x 788s + for (setDimnames in c(TRUE, FALSE)) { 788s + if (setDimnames) dimnames(x) <- dimnames 788s + else dimnames(x) <- NULL 788s + tx <- t(x) 788s + # Check names attribute 788s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 788s + cat("rowMads():\n") 788s + center <- rowMedians(x, na.rm = TRUE, useNames = useNames) 788s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 788s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 788s + r1b <- rowMads_center(x, na.rm = TRUE, useNames = useNames) 788s + r1c <- rowMads(x, center = center, na.rm = TRUE, useNames = useNames) 788s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 788s + r2b <- colMads_center(tx, na.rm = TRUE, useNames = useNames) 788s + stopifnot(all.equal(r1, r2)) 788s + stopifnot(all.equal(r1, r0)) 788s + stopifnot(all.equal(r1b, r1)) 788s + stopifnot(all.equal(r1c, r1)) 788s + stopifnot(all.equal(r2, r0)) 788s + stopifnot(all.equal(r2b, r2)) 788s + 788s + cat("colMads():\n") 788s + center <- colMedians(x, na.rm = TRUE, useNames = useNames) 788s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 788s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 788s + r1b <- colMads_center(x, na.rm = TRUE, useNames = useNames) 788s + r1c <- colMads(x, center = center, na.rm = TRUE, useNames = useNames) 788s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 788s + r2b <- rowMads_center(tx, na.rm = TRUE, useNames = useNames) 788s + stopifnot(all.equal(r1, r2)) 788s + stopifnot(all.equal(r1, r0)) 788s + stopifnot(all.equal(r1b, r1)) 788s + stopifnot(all.equal(r1c, r1)) 788s + stopifnot(all.equal(r2, r0)) 788s + stopifnot(all.equal(r2b, r2)) 788s + } 788s + } 788s + } 789s mode: integer 789s int [1:3, 1:3] 1 2 3 2 3 4 3 4 5 789s rowMads(): 789s colMads(): 789s rowMads(): 789s colMads(): 789s rowMads(): 789s colMads(): 789s rowMads(): 789s colMads(): 789s mode: double 789s num [1:3, 1:3] 1.1 2.1 3.1 2.1 3.1 4.1 3.1 4.1 5.1 789s rowMads(): 789s colMads(): 789s rowMads(): 789s colMads(): 789s rowMads(): 789s colMads(): 789s rowMads(): 789s colMads(): 789s > 789s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 789s > # Ties: a 4x4 matrix 789s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 789s > for (mode in c("integer", "double")) { 789s + x <- matrix(c(1:4, 2:5, 3:6, 4:7) + 0.1, nrow = 4, ncol = 4) 789s + cat("mode: ", mode, "\n", sep = "") 789s + storage.mode(x) <- mode 789s + str(x) 789s + tx <- t(x) 789s + 789s + # To check name attribute 789s + dimnames <- list(letters[1:4], LETTERS[1:4]) 789s + 789s + # Test with and without dimnames on x 789s + for (setDimnames in c(TRUE, FALSE)) { 789s + if (setDimnames) dimnames(x) <- dimnames 789s + else dimnames(x) <- NULL 789s + tx <- t(x) 789s + # Check names attribute 789s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 789s + cat("rowMads():\n") 789s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 789s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 789s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 789s + stopifnot(all.equal(r1, r2)) 789s + stopifnot(all.equal(r1, r0)) 789s + stopifnot(all.equal(r2, r0)) 789s + 789s + cat("colMads():\n") 789s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 789s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 789s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 789s + stopifnot(all.equal(r1, r2)) 789s + stopifnot(all.equal(r1, r0)) 789s + stopifnot(all.equal(r2, r0)) 789s + } 789s + } 789s + } 790s mode: integer 790s int [1:4, 1:4] 1 2 3 4 2 3 4 5 3 4 ... 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s mode: double 790s num [1:4, 1:4] 1.1 2.1 3.1 4.1 2.1 3.1 4.1 5.1 3.1 4.1 ... 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s > tx <- NULL 790s > 790s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 790s > # No ties: a 3x3 matrix with an NA value 790s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 790s > for (mode in c("integer", "double")) { 790s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 790s + x[2, 2] <- NA_real_ 790s + 790s + cat("mode: ", mode, "\n", sep = "") 790s + storage.mode(x) <- mode 790s + str(x) 790s + tx <- t(x) 790s + 790s + # To check name attribute 790s + dimnames <- list(letters[1:3], LETTERS[1:3]) 790s + 790s + # Test with and without dimnames on x 790s + for (setDimnames in c(TRUE, FALSE)) { 790s + if (setDimnames) dimnames(x) <- dimnames 790s + else dimnames(x) <- NULL 790s + tx <- t(x) 790s + # Check names attribute 790s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 790s + cat("rowMads():\n") 790s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 790s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 790s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 790s + stopifnot(all.equal(r1, r2)) 790s + stopifnot(all.equal(r1, r0)) 790s + stopifnot(all.equal(r2, r0)) 790s + 790s + cat("colMads():\n") 790s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 790s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 790s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 790s + stopifnot(all.equal(r1, r2)) 790s + stopifnot(all.equal(r1, r0)) 790s + stopifnot(all.equal(r2, r0)) 790s + } 790s + } 790s + } 790s mode: integer 790s int [1:3, 1:3] 1 2 3 2 NA 4 3 4 5 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s mode: double 790s num [1:3, 1:3] 1.1 2.1 3.1 2.1 NA 4.1 3.1 4.1 5.1 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s rowMads(): 790s colMads(): 790s > tx <- NULL 790s > 790s > 790s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 790s > # With and without some NAs 790s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 790s > for (add_na in c(FALSE, TRUE)) { 790s + cat("add_na = ", add_na, "\n", sep = "") 790s + 790s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 790s + if (add_na) { 790s + x[3:7, c(2, 4)] <- NA_real_ 790s + } 790s + 790s + # To check name attribute 790s + dimnames <- list(letters[1:10], LETTERS[1:5]) 790s + 790s + # Test with and without dimnames on x 790s + for (setDimnames in c(TRUE, FALSE)) { 790s + if (setDimnames) dimnames(x) <- dimnames 790s + else dimnames(x) <- NULL 790s + tx <- t(x) 790s + # Row/column ranges 790s + for (na.rm in c(FALSE, TRUE)) { 790s + # Check names attribute 790s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 790s + cat("na.rm = ", na.rm, "\n", sep = "") 790s + cat("rowMads():\n") 790s + center <- rowMedians(x, na.rm = na.rm, useNames = useNames) 790s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 790s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 790s + r2 <- rowMads(x, center = center, na.rm = na.rm, useNames = useNames) 790s + r3 <- colMads(tx, na.rm = na.rm, useNames = useNames) 790s + stopifnot(all.equal(r1, r0)) 790s + stopifnot(all.equal(r2, r0)) 790s + stopifnot(all.equal(r2, r1)) 790s + stopifnot(all.equal(r3, r0)) 790s + stopifnot(all.equal(r3, r1)) 790s + stopifnot(all.equal(r3, r2)) 790s + 790s + cat("colMads():\n") 790s + center <- colMedians(x, na.rm = na.rm, useNames = useNames) 790s + r0 <- colMads_R(x, na.rm = na.rm, useNames = useNames) 790s + r1 <- colMads(x, na.rm = na.rm, useNames = useNames) 790s + r2 <- colMads(x, center = center, na.rm = na.rm, useNames = useNames) 790s + r3 <- rowMads(tx, na.rm = na.rm, useNames = useNames) 790s + stopifnot(all.equal(r1, r0)) 790s + stopifnot(all.equal(r2, r0)) 790s + stopifnot(all.equal(r2, r1)) 790s + stopifnot(all.equal(r3, r0)) 790s + stopifnot(all.equal(r3, r1)) 790s + stopifnot(all.equal(r3, r2)) 790s + } 790s + } 790s + } 790s + tx <- NULL 790s + } # for (add_na ...) 790s add_na = FALSE 790s na.rm = FALSE 790s rowMads(): 790s colMads(): 790s na.rm = FALSE 790s rowMads(): 790s colMads(): 790s na.rm = TRUE 790s rowMads(): 790s colMads(): 790s na.rm = TRUE 790s rowMads(): 790s colMads(): 790s na.rm = FALSE 790s rowMads(): 790s colMads(): 790s na.rm = FALSE 790s rowMads(): 790s colMads(): 790s na.rm = TRUE 790s rowMads(): 790s colMads(): 790s na.rm = TRUE 790s rowMads(): 790s colMads(): 790s add_na = TRUE 790s na.rm = FALSE 790s rowMads(): 790s colMads(): 790s na.rm = FALSE 790s rowMads(): 790s colMads(): 790s na.rm = TRUE 790s rowMads(): 790s colMads(): 790s na.rm = TRUE 790s rowMads(): 790s colMads(): 790s na.rm = FALSE 790s rowMads(): 790s colMads(): 790s na.rm = FALSE 790s rowMads(): 790s colMads(): 790s na.rm = TRUE 790s rowMads(): 790s colMads(): 790s na.rm = TRUE 790s rowMads(): 790s colMads(): 790s > 790s > 790s > 790s > 790s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 790s > # All NAs 790s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 790s > x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 790s > # Test with and without dimnames on x 790s > for (setDimnames in c(TRUE, FALSE)) { 790s + if (setDimnames) dimnames(x) <- dimnames 790s + else dimnames(x) <- NULL 790s + tx <- t(x) 790s + # Row/column ranges 790s + for (na.rm in c(FALSE, TRUE)) { 790s + # Check names attribute 790s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 790s + cat("na.rm = ", na.rm, "\n", sep = "") 790s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 790s + if (na.rm) r0[is.na(r0)] <- NaN 790s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 790s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 790s + stopifnot(all.equal(r1, r0)) 790s + stopifnot(all.equal(r2, r0)) 790s + stopifnot(all.equal(r1, r2)) 790s + } 790s + } 790s + } 791s na.rm = FALSE 791s na.rm = FALSE 791s na.rm = TRUE 791s na.rm = TRUE 791s na.rm = FALSE 791s na.rm = FALSE 791s na.rm = TRUE 791s na.rm = TRUE 791s > tx <- NULL 791s > 791s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 791s > # A 1x1 matrix 791s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 791s > x <- matrix(0, nrow = 1L, ncol = 1L) 791s > dimnames <- list("a", "A") 791s > # Test with and without dimnames on x 791s > for (setDimnames in c(TRUE, FALSE)) { 791s + if (setDimnames) dimnames(x) <- dimnames 791s + else dimnames(x) <- NULL 791s + tx <- t(x) 791s + # Row/column ranges 791s + for (na.rm in c(FALSE, TRUE)) { 791s + # Check names attribute 791s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 791s + cat("na.rm = ", na.rm, "\n", sep = "") 791s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 791s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 791s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 791s + stopifnot(all.equal(r1, r0)) 791s + stopifnot(all.equal(r2, r0)) 791s + stopifnot(all.equal(r1, r2)) 791s + } 791s + } 791s + } 791s na.rm = FALSE 791s na.rm = FALSE 791s na.rm = TRUE 791s na.rm = TRUE 791s na.rm = FALSE 791s na.rm = FALSE 791s na.rm = TRUE 791s na.rm = TRUE 791s > 791s > 791s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 791s > # A 0x0 matrix 791s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 791s > x <- matrix(double(0), nrow = 0, ncol = 0) 791s > tx <- t(x) 791s > for (na.rm in c(FALSE, TRUE)) { 791s + cat("na.rm = ", na.rm, "\n", sep = "") 791s + r0 <- rowMads_R(x, na.rm = na.rm) 791s + r1 <- rowMads(x, na.rm = na.rm) 791s + r2 <- colMads(tx, na.rm = na.rm) 791s + stopifnot(all.equal(r1, r2)) 791s + stopifnot(all.equal(r1, r0)) 791s + stopifnot(all.equal(r2, r0)) 791s + } 791s na.rm = FALSE 791s na.rm = TRUE 791s > 791s 791s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 791s Copyright (C) 2024 The R Foundation for Statistical Computing 791s Platform: aarch64-unknown-linux-gnu (64-bit) 791s 791s R is free software and comes with ABSOLUTELY NO WARRANTY. 791s You are welcome to redistribute it under certain conditions. 791s Type 'license()' or 'licence()' for distribution details. 791s 791s R is a collaborative project with many contributors. 791s Type 'contributors()' for more information and 791s 'citation()' on how to cite R or R packages in publications. 791s 791s Type 'demo()' for some demos, 'help()' for on-line help, or 791s 'help.start()' for an HTML browser interface to help. 791s Type 'q()' to quit R. 791s 791s > library("matrixStats") 792s > 792s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 792s > options(matrixStats.center.onUse = "ignore") 792s > 792s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 792s + suppressWarnings({ 792s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 792s + }) 792s + if (is.na(useNames) || !useNames) names(res) <- NULL 792s + res 792s + } 792s > 792s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 792s + suppressWarnings({ 792s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 792s + }) 792s + if (is.na(useNames) || !useNames) names(res) <- NULL 792s + res 792s + } 792s > 792s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 792s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 792s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 792s + } 792s > 792s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 792s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 792s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 792s + } 792s > 792s > 792s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 792s > # Subsetted tests 792s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 792s > source("utils/validateIndicesFramework.R") 792s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 792s > storage.mode(x) <- "integer" 792s > 792s > # To check names attribute 792s > dimnames <- list(letters[1:6], LETTERS[1:6]) 792s > 792s > # Test with and without dimnames on x 792s > for (setDimnames in c(TRUE, FALSE)) { 792s + if (setDimnames) dimnames(x) <- dimnames 792s + else dimnames(x) <- NULL 792s + 792s + count <- 0L 792s + for (rows in index_cases) { 792s + for (cols in index_cases) { 792s + count <- count + 1L 792s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 792s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 792s + useNames <- useNames[count %% length(useNames) + 1] 792s + 792s + validateIndicesTestMatrix(x, rows, cols, 792s + ftest = rowMads, fsure = rowMads_R, 792s + na.rm = na.rm, useNames = useNames) 792s + validateIndicesTestMatrix(x, rows, cols, 792s + ftest = rowMads_center, fsure = rowMads_R, 792s + na.rm = na.rm, useNames = useNames) 792s + 792s + validateIndicesTestMatrix(x, rows, cols, 792s + fcoltest = colMads, fsure = rowMads_R, 792s + na.rm = na.rm, useNames = useNames) 792s + validateIndicesTestMatrix(x, rows, cols, 792s + fcoltest = colMads_center, fsure = rowMads_R, 792s + na.rm = na.rm, useNames = useNames) 792s + } 792s + } 792s + } 798s > 799s 799s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 799s Copyright (C) 2024 The R Foundation for Statistical Computing 799s Platform: aarch64-unknown-linux-gnu (64-bit) 799s 799s R is free software and comes with ABSOLUTELY NO WARRANTY. 799s You are welcome to redistribute it under certain conditions. 799s Type 'license()' or 'licence()' for distribution details. 799s 799s R is a collaborative project with many contributors. 799s Type 'contributors()' for more information and 799s 'citation()' on how to cite R or R packages in publications. 799s 799s Type 'demo()' for some demos, 'help()' for on-line help, or 799s 'help.start()' for an HTML browser interface to help. 799s Type 'q()' to quit R. 799s 799s > library("matrixStats") 799s > 799s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 799s + res <- rowMeans(x, na.rm = na.rm) 799s + if (is.na(useNames) || !useNames) names(res) <- NULL 799s + res 799s + } 799s > 799s > colMeans_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 799s + res <- colMeans(x, na.rm = na.rm) 799s + if (is.na(useNames) || !useNames) names(res) <- NULL 799s + res 799s + } 799s > 799s > for (mode in c("integer", "logical", "double")) { 799s + x <- matrix(-4:4, nrow = 3, ncol = 3) 799s + storage.mode(x) <- mode 799s + if (mode == "double") x <- x + 0.1 799s + 799s + # To check names attribute 799s + dimnames <- list(letters[1:3], LETTERS[1:3]) 799s + 799s + # Test with and without dimnames on x 799s + for (setDimnames in c(TRUE, FALSE)) { 799s + if (setDimnames) dimnames(x) <- dimnames 799s + else dimnames(x) <- NULL 799s + # Check names attribute 799s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 799s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 799s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 799s + stopifnot(all.equal(y1, y0)) 799s + 799s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 799s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 799s + stopifnot(all.equal(y1, y0)) 799s + } 799s + } 799s + } 800s > 800s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 800s > # Special case: Single-element matrix 800s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 800s > cat("Special case: Single-element matrix:\n") 800s Special case: Single-element matrix: 800s > for (mode in c("integer", "logical", "double")) { 800s + x <- matrix(1, nrow = 1, ncol = 1) 800s + storage.mode(x) <- mode 800s + 800s + # To check names attribute 800s + dimnames <- list("a", "A") 800s + 800s + # Test with and without dimnames on x 800s + for (setDimnames in c(TRUE, FALSE)) { 800s + if (setDimnames) dimnames(x) <- dimnames 800s + else dimnames(x) <- NULL 800s + # Check names attribute 800s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 800s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 800s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 800s + stopifnot(all.equal(y1, y0)) 800s + 800s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 800s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 800s + stopifnot(all.equal(y1, y0)) 800s + } 800s + } 800s + } 800s > 800s > 800s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 800s > # Special case: Empty matrix 800s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 800s > cat("Special case: Empty matrix:\n") 800s Special case: Empty matrix: 800s > for (mode in c("integer", "logical", "double")) { 800s + x <- matrix(integer(0), nrow = 0, ncol = 0) 800s + storage.mode(x) <- mode 800s + 800s + y0 <- rowMeans(x, na.rm = FALSE) 800s + y1 <- rowMeans2(x, na.rm = FALSE) 800s + stopifnot(all.equal(y1, y0)) 800s + 800s + y0 <- colMeans(x, na.rm = FALSE) 800s + y1 <- colMeans2(x, na.rm = FALSE) 800s + stopifnot(all.equal(y1, y0)) 800s + } 800s > 800s > 800s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 800s > # Special case: All NAs 800s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 800s > cat("Special case: All NAs:\n") 800s Special case: All NAs: 800s > for (mode in c("integer", "logical", "double")) { 800s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 800s + storage.mode(x) <- mode 800s + 800s + # To check names attribute 800s + dimnames <- list(letters[1:3], LETTERS[1:3]) 800s + 800s + # Test with and without dimnames on x 800s + for (setDimnames in c(TRUE, FALSE)) { 800s + if (setDimnames) dimnames(x) <- dimnames 800s + else dimnames(x) <- NULL 800s + # Check names attribute 800s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 800s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 800s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 800s + stopifnot(all.equal(y1, y0)) 800s + 800s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 800s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 800s + stopifnot(all.equal(y1, y0)) 800s + } 800s + } 800s + } 800s > 800s > 800s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 800s > # Special case: All NaNs 800s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 800s > cat("Special case: All NaNs:\n") 800s Special case: All NaNs: 800s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 800s > 800s > # Test with and without dimnames on x 800s > for (setDimnames in c(TRUE, FALSE)) { 800s + if (setDimnames) dimnames(x) <- dimnames 800s + else dimnames(x) <- NULL 800s + # Check names attribute 800s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 800s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 800s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 800s + stopifnot(all.equal(y1, y0)) 800s + 800s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 800s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 800s + stopifnot(all.equal(y1, y0)) 800s + } 800s + } 801s > 801s > 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > # Special case: All Infs 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > cat("Special case: All Infs:\n") 801s Special case: All Infs: 801s > x <- matrix(Inf, nrow = 3, ncol = 3) 801s > 801s > # Test with and without dimnames on x 801s > for (setDimnames in c(TRUE, FALSE)) { 801s + if (setDimnames) dimnames(x) <- dimnames 801s + else dimnames(x) <- NULL 801s + # Check names attribute 801s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 801s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 801s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 801s + stopifnot(all.equal(y1, y0)) 801s + 801s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 801s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 801s + stopifnot(all.equal(y1, y0)) 801s + } 801s + } 801s > 801s > 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > # Special case: All -Infs 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > cat("Special case: All -Infs:\n") 801s Special case: All -Infs: 801s > x <- matrix(-Inf, nrow = 3, ncol = 3) 801s > 801s > # Test with and without dimnames on x 801s > for (setDimnames in c(TRUE, FALSE)) { 801s + if (setDimnames) dimnames(x) <- dimnames 801s + else dimnames(x) <- NULL 801s + # Check names attribute 801s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 801s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 801s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 801s + stopifnot(all.equal(y1, y0)) 801s + 801s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 801s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 801s + stopifnot(all.equal(y1, y0)) 801s + } 801s + } 801s > 801s > 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > # Special case: Infs and -Infs 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > cat("Special case: Infs and -Infs:\n") 801s Special case: Infs and -Infs: 801s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 801s > 801s > # To check names attribute 801s > dimnames <- list(letters[1:4], LETTERS[1:4]) 801s > 801s > # Test with and without dimnames on x 801s > for (setDimnames in c(TRUE, FALSE)) { 801s + if (setDimnames) dimnames(x) <- dimnames 801s + else dimnames(x) <- NULL 801s + # Check names attribute 801s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 801s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 801s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 801s + stopifnot(all.equal(y1, y0)) 801s + 801s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 801s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 801s + stopifnot(all.equal(y1, y0)) 801s + } 801s + } 801s > 801s > 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > # Special case: NaNs and NAs 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > cat("Special case: NaNs and NAs:\n") 801s Special case: NaNs and NAs: 801s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 801s > 801s > # Test with and without dimnames on x 801s > for (setDimnames in c(TRUE, FALSE)) { 801s + if (setDimnames) dimnames(x) <- dimnames 801s + else dimnames(x) <- NULL 801s + # Check names attribute 801s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 801s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 801s + str(y0) 801s + stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 801s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 801s + str(y1) 801s + stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 801s + stopifnot(all.equal(y1, y0)) 801s + 801s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 801s + stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 801s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 801s + stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 801s + stopifnot(all.equal(y1, y0)) 801s + } 801s + } 801s Named num [1:4] NaN NA NaN NA 801s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 801s Named num [1:4] NaN NA NaN NA 801s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 801s num [1:4] NaN NA NaN NA 801s num [1:4] NaN NA NaN NA 801s num [1:4] NaN NA NaN NA 801s num [1:4] NaN NA NaN NA 801s num [1:4] NaN NA NaN NA 801s num [1:4] NaN NA NaN NA 801s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 801s > ## returned here (as one would expect). NaN might very well be returned, 801s > ## when both NA and NaN are involved. This is an accepted feature in R, 801s > ## which is documented in help("is.nan"). See also 801s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 801s > ## Thus, we cannot guarantee that y1 is identical to y0. 801s > 801s > 801s > 801s > 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > # Special case: Integer overflow with ties 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > cat("Special case: Integer overflow with ties:\n") 801s Special case: Integer overflow with ties: 801s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 801s > 801s > # Test with and without dimnames on x 801s > for (setDimnames in c(TRUE, FALSE)) { 801s + if (setDimnames) dimnames(x) <- dimnames 801s + else dimnames(x) <- NULL 801s + # Check names attribute 801s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 801s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 801s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 801s + stopifnot(all.equal(y1, y0)) 801s + 801s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 801s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 801s + stopifnot(all.equal(y1, y0)) 801s + } 801s + } 801s > 801s > 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > # Consistency checks 801s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 801s > set.seed(1) 801s > 801s > cat("Consistency checks:\n") 801s Consistency checks: 801s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 801s > for (kk in seq_len(n_sims)) { 801s + cat("Random test #", kk, "\n", sep = "") 801s + 801s + # Simulate data in a matrix of any shape 801s + dim <- sample(50:200, size = 2) 801s + n <- prod(dim) 801s + x <- rnorm(n, sd = 100) 801s + dim(x) <- dim 801s + 801s + # Add NAs? 801s + if ((kk %% 4) %in% c(3, 0)) { 801s + cat("Adding NAs\n") 801s + nna <- sample(n, size = 1) 801s + na_values <- c(NA_real_, NaN) 801s + t <- sample(na_values, size = nna, replace = TRUE) 801s + x[sample(length(x), size = nna)] <- t 801s + } 801s + 801s + # Mode? 801s + modes <- "double" 801s + if ((kk %% 4) %in% c(2, 0)) { 801s + modes <- c("integer", "logical") 801s + } 801s + 801s + for (mode in modes) { 801s + if (mode != "double") { 801s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 801s + storage.mode(x) <- mode 801s + } 801s + 801s + na.rm <- sample(c(TRUE, FALSE), size = 1) 801s + 801s + # rowMeans2(): 801s + y0 <- rowMeans(x, na.rm = na.rm) 801s + y1 <- rowMeans2(x, na.rm = na.rm) 801s + stopifnot(all.equal(y1, y0)) 801s + y2 <- colMeans2(t(x), na.rm = na.rm) 801s + stopifnot(all.equal(y2, y0)) 801s + 801s + # colMeans2(): 801s + y0 <- colMeans(x, na.rm = na.rm) 801s + y1 <- colMeans2(x, na.rm = na.rm) 801s + stopifnot(all.equal(y1, y0)) 801s + y2 <- rowMeans2(t(x), na.rm = na.rm) 801s + stopifnot(all.equal(y2, y0)) 801s + } 801s + } # for (kk ...) 801s Random test #1 801s Random test #2 801s Coercing from double to integer 801s Coercing from integer to logical 801s Random test #3 801s Adding NAs 801s Random test #4 801s Adding NAs 801s Coercing from double to integer 801s Coercing from integer to logical 801s Random test #5 801s Random test #6 801s Coercing from double to integer 801s Coercing from integer to logical 801s Random test #7 801s Adding NAs 801s Random test #8 801s Adding NAs 801s Coercing from double to integer 801s Coercing from integer to logical 801s Random test #9 801s Random test #10 801s Coercing from double to integer 801s Coercing from integer to logical 802s Random test #11 802s Adding NAs 802s Random test #12 802s Adding NAs 802s Coercing from double to integer 802s Coercing from integer to logical 802s Random test #13 802s Random test #14 802s Coercing from double to integer 802s Coercing from integer to logical 802s Random test #15 802s Adding NAs 802s Random test #16 802s Adding NAs 802s Coercing from double to integer 802s Coercing from integer to logical 802s Random test #17 802s Random test #18 802s Coercing from double to integer 802s Coercing from integer to logical 802s Random test #19 802s Adding NAs 802s Random test #20 802s Adding NAs 802s Coercing from double to integer 802s Coercing from integer to logical 802s > 802s 802s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 802s Copyright (C) 2024 The R Foundation for Statistical Computing 802s Platform: aarch64-unknown-linux-gnu (64-bit) 802s 802s R is free software and comes with ABSOLUTELY NO WARRANTY. 802s You are welcome to redistribute it under certain conditions. 802s Type 'license()' or 'licence()' for distribution details. 802s 802s R is a collaborative project with many contributors. 802s Type 'contributors()' for more information and 802s 'citation()' on how to cite R or R packages in publications. 802s 802s Type 'demo()' for some demos, 'help()' for on-line help, or 802s 'help.start()' for an HTML browser interface to help. 802s Type 'q()' to quit R. 802s 803s > library("matrixStats") 803s > 803s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 803s + res <- rowMeans(x, na.rm = na.rm) 803s + if (is.na(useNames) || !useNames) names(res) <- NULL 803s + res 803s + } 803s > 803s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 803s > # Subsetted tests 803s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 803s > source("utils/validateIndicesFramework.R") 803s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 803s > storage.mode(x) <- "integer" 803s > 803s > # To check names attribute 803s > dimnames <- list(letters[1:6], LETTERS[1:6]) 803s > 803s > # Test with and without dimnames on x 803s > for (setDimnames in c(TRUE, FALSE)) { 803s + if (setDimnames) dimnames(x) <- dimnames 803s + else dimnames(x) <- NULL 803s + 803s + count <- 0L 803s + for (rows in index_cases) { 803s + for (cols in index_cases) { 803s + count <- count + 1L 803s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 803s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 803s + useNames <- useNames[count %% length(useNames) + 1] 803s + 803s + validateIndicesTestMatrix(x, rows, cols, 803s + ftest = rowMeans2, fsure = rowMeans_R, 803s + na.rm = na.rm, useNames = useNames) 803s + validateIndicesTestMatrix(x, rows, cols, 803s + fcoltest = colMeans2, fsure = rowMeans_R, 803s + na.rm = na.rm, useNames = useNames) 803s + } 803s + } 803s + } 804s > 805s 805s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 805s Copyright (C) 2024 The R Foundation for Statistical Computing 805s Platform: aarch64-unknown-linux-gnu (64-bit) 805s 805s R is free software and comes with ABSOLUTELY NO WARRANTY. 805s You are welcome to redistribute it under certain conditions. 805s Type 'license()' or 'licence()' for distribution details. 805s 805s R is a collaborative project with many contributors. 805s Type 'contributors()' for more information and 805s 'citation()' on how to cite R or R packages in publications. 805s 805s Type 'demo()' for some demos, 'help()' for on-line help, or 805s 'help.start()' for an HTML browser interface to help. 805s Type 'q()' to quit R. 805s 805s > library("matrixStats") 805s > 805s > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 805s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 805s + if (is.na(useNames) || !useNames) names(res) <- NULL 805s + res 805s + } 805s > 805s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 805s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 805s + if (is.na(useNames) || !useNames) names(res) <- NULL 805s + res 805s + } 805s > 805s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 805s > # Special case: Non-ties 805s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 805s > cat("Special case: Non-ties:\n") 805s Special case: Non-ties: 805s > for (mode in c("integer", "double")) { 805s + x <- matrix(1:9 + 0.1, nrow = 3, ncol = 3) 805s + storage.mode(x) <- mode 805s + 805s + # To check names attribute 805s + dimnames <- list(letters[1:3], LETTERS[1:3]) 805s + 805s + # Test with and without dimnames on x 805s + for (setDimnames in c(TRUE, FALSE)) { 805s + if (setDimnames) dimnames(x) <- dimnames 805s + else dimnames(x) <- NULL 805s + # Check names attribute 805s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 805s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 805s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 805s + stopifnot(all.equal(y1, y0)) 805s + 805s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 805s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 805s + stopifnot(all.equal(y1, y0)) 805s + } 805s + } 805s + } 805s > 805s > 805s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 805s > # Special case: Ties 805s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 805s > cat("Special case: Ties:\n") 805s Special case: Ties: 805s > for (mode in c("integer", "double")) { 805s + x <- matrix(1:16 + 0.1, nrow = 4, ncol = 4) 805s + storage.mode(x) <- mode 805s + 805s + # To check names attribute 805s + dimnames <- list(letters[1:4], LETTERS[1:4]) 805s + 805s + # Test with and without dimnames on x 805s + for (setDimnames in c(TRUE, FALSE)) { 805s + if (setDimnames) dimnames(x) <- dimnames 805s + else dimnames(x) <- NULL 805s + # Check names attribute 805s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 805s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 805s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 805s + stopifnot(all.equal(y1, y0)) 805s + 805s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 805s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 805s + stopifnot(all.equal(y1, y0)) 805s + } 805s + } 805s + } 806s > 806s > 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > # Special case: Single-element matrix 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > cat("Special case: Single-element matrix:\n") 806s Special case: Single-element matrix: 806s > for (mode in c("integer", "double")) { 806s + x <- matrix(1, nrow = 1, ncol = 1) 806s + storage.mode(x) <- mode 806s + 806s + # To check names attribute 806s + dimnames <- list("a", "A") 806s + 806s + # Test with and without dimnames on x 806s + for (setDimnames in c(TRUE, FALSE)) { 806s + if (setDimnames) dimnames(x) <- dimnames 806s + else dimnames(x) <- NULL 806s + # Check names attribute 806s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 806s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 806s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + 806s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 806s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + } 806s + } 806s + } 806s > 806s > 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > # Special case: Empty matrix 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > cat("Special case: Empty matrix:\n") 806s Special case: Empty matrix: 806s > for (mode in c("integer", "double")) { 806s + x <- matrix(integer(0), nrow = 0, ncol = 0) 806s + storage.mode(x) <- mode 806s + 806s + y0 <- rowMedians_R(x, na.rm = FALSE) 806s + y1 <- rowMedians(x, na.rm = FALSE) 806s + stopifnot(all.equal(y1, y0)) 806s + 806s + y0 <- colMedians_R(x, na.rm = FALSE) 806s + y1 <- colMedians(x, na.rm = FALSE) 806s + stopifnot(all.equal(y1, y0)) 806s + } 806s > 806s > 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > # Special case: All NAs 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > cat("Special case: All NAs:\n") 806s Special case: All NAs: 806s > for (mode in c("integer", "double")) { 806s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 806s + storage.mode(x) <- mode 806s + 806s + # To check names attribute 806s + dimnames <- list(letters[1:3], LETTERS[1:3]) 806s + 806s + # Test with and without dimnames on x 806s + for (setDimnames in c(TRUE, FALSE)) { 806s + if (setDimnames) dimnames(x) <- dimnames 806s + else dimnames(x) <- NULL 806s + # Check names attribute 806s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 806s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 806s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + 806s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 806s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + } 806s + } 806s + } 806s > 806s > 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > # Special case: All NaNs 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > cat("Special case: All NaNs:\n") 806s Special case: All NaNs: 806s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 806s > 806s > # Test with and without dimnames on x 806s > for (setDimnames in c(TRUE, FALSE)) { 806s + if (setDimnames) dimnames(x) <- dimnames 806s + else dimnames(x) <- NULL 806s + # Check names attribute 806s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 806s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 806s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + 806s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 806s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + } 806s + } 806s > 806s > 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > # Special case: All Infs 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > cat("Special case: All Infs:\n") 806s Special case: All Infs: 806s > x <- matrix(Inf, nrow = 3, ncol = 3) 806s > 806s > # Test with and without dimnames on x 806s > for (setDimnames in c(TRUE, FALSE)) { 806s + if (setDimnames) dimnames(x) <- dimnames 806s + else dimnames(x) <- NULL 806s + # Check names attribute 806s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 806s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 806s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + 806s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 806s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + } 806s + } 806s > 806s > 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > # Special case: All -Infs 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > cat("Special case: All -Infs:\n") 806s Special case: All -Infs: 806s > x <- matrix(-Inf, nrow = 3, ncol = 3) 806s > 806s > # Test with and without dimnames on x 806s > for (setDimnames in c(TRUE, FALSE)) { 806s + if (setDimnames) dimnames(x) <- dimnames 806s + else dimnames(x) <- NULL 806s + # Check names attribute 806s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 806s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 806s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + 806s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 806s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + } 806s + } 806s > 806s > 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > # Special case: Infs and -Infs 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > cat("Special case: Infs and -Infs:\n") 806s Special case: Infs and -Infs: 806s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 806s > 806s > # To check names attribute 806s > dimnames <- list(letters[1:4], LETTERS[1:4]) 806s > 806s > # Test with and without dimnames on x 806s > for (setDimnames in c(TRUE, FALSE)) { 806s + if (setDimnames) dimnames(x) <- dimnames 806s + else dimnames(x) <- NULL 806s + # Check names attribute 806s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 806s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 806s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + 806s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 806s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + } 806s + } 806s > 806s > 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > # Special case: Integer overflow with ties 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > cat("Special case: Integer overflow with ties:\n") 806s Special case: Integer overflow with ties: 806s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 806s > 806s > # Test with and without dimnames on x 806s > for (setDimnames in c(TRUE, FALSE)) { 806s + if (setDimnames) dimnames(x) <- dimnames 806s + else dimnames(x) <- NULL 806s + # Check names attribute 806s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 806s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 806s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + 806s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 806s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 806s + stopifnot(all.equal(y1, y0)) 806s + } 806s + } 806s > 806s > 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > # Consistency checks 806s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 806s > set.seed(1) 806s > 806s > cat("Consistency checks:\n") 806s Consistency checks: 806s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 806s > for (kk in seq_len(n_sims)) { 806s + cat("Random test #", kk, "\n", sep = "") 806s + 806s + # Simulate data in a matrix of any shape 806s + dim <- sample(50:200, size = 2) 806s + n <- prod(dim) 806s + x <- rnorm(n, sd = 100) 806s + dim(x) <- dim 806s + 806s + # Add NAs? 806s + if ((kk %% 4) %in% c(3, 0)) { 806s + cat("Adding NAs\n") 806s + nna <- sample(n, size = 1) 806s + na_values <- c(NA_real_, NaN) 806s + t <- sample(na_values, size = nna, replace = TRUE) 806s + x[sample(length(x), size = nna)] <- t 806s + } 806s + 806s + # Integer or double? 806s + if ((kk %% 4) %in% c(2, 0)) { 806s + cat("Coercing to integers\n") 806s + storage.mode(x) <- "integer" 806s + } 806s + 806s + na.rm <- sample(c(TRUE, FALSE), size = 1) 806s + 806s + # rowMedians(): 806s + y0 <- rowMedians_R(x, na.rm = na.rm) 806s + y1 <- rowMedians(x, na.rm = na.rm) 806s + stopifnot(all.equal(y1, y0)) 806s + y2 <- colMedians(t(x), na.rm = na.rm) 806s + stopifnot(all.equal(y2, y0)) 806s + 806s + # colMedians(): 806s + y0 <- colMedians_R(x, na.rm = na.rm) 806s + y1 <- colMedians(x, na.rm = na.rm) 806s + stopifnot(all.equal(y1, y0)) 806s + y2 <- rowMedians(t(x), na.rm = na.rm) 806s + stopifnot(all.equal(y2, y0)) 806s + } # for (kk ...) 806s Random test #1 806s Random test #2 806s Coercing to integers 806s Random test #3 806s Adding NAs 807s Random test #4 807s Adding NAs 807s Coercing to integers 807s Random test #5 807s Random test #6 807s Coercing to integers 807s Random test #7 807s Adding NAs 807s Random test #8 807s Adding NAs 807s Coercing to integers 807s Random test #9 807s Random test #10 807s Coercing to integers 807s Random test #11 807s Adding NAs 807s Random test #12 807s Adding NAs 807s Coercing to integers 807s Random test #13 807s Random test #14 807s Coercing to integers 807s Random test #15 807s Adding NAs 807s Random test #16 807s Adding NAs 807s Coercing to integers 807s Random test #17 807s Random test #18 807s Coercing to integers 808s Random test #19 808s Adding NAs 808s Random test #20 808s Adding NAs 808s Coercing to integers 808s > 808s 808s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 808s Copyright (C) 2024 The R Foundation for Statistical Computing 808s Platform: aarch64-unknown-linux-gnu (64-bit) 808s 808s R is free software and comes with ABSOLUTELY NO WARRANTY. 808s You are welcome to redistribute it under certain conditions. 808s Type 'license()' or 'licence()' for distribution details. 808s 808s R is a collaborative project with many contributors. 808s Type 'contributors()' for more information and 808s 'citation()' on how to cite R or R packages in publications. 808s 808s Type 'demo()' for some demos, 'help()' for on-line help, or 808s 'help.start()' for an HTML browser interface to help. 808s Type 'q()' to quit R. 808s 808s > library("matrixStats") 808s > 808s > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 808s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 808s + if (is.na(useNames) || !useNames) names(res) <- NULL 808s + res 808s + } 808s > 808s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 808s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 808s + if (is.na(useNames) || !useNames) names(res) <- NULL 808s + res 808s + } 808s > 808s > 808s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 808s > # Subsetted tests 808s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 808s > source("utils/validateIndicesFramework.R") 809s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 809s > storage.mode(x) <- "integer" 809s > 809s > # To check names attribute 809s > dimnames <- list(letters[1:6], LETTERS[1:6]) 809s > 809s > # Test with and without dimnames on x 809s > for (setDimnames in c(TRUE, FALSE)) { 809s + if (setDimnames) dimnames(x) <- dimnames 809s + else dimnames(x) <- NULL 809s + 809s + count <- 0L 809s + for (rows in index_cases) { 809s + for (cols in index_cases) { 809s + count <- count + 1L 809s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 809s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 809s + useNames <- useNames[count %% length(useNames) + 1] 809s + 809s + validateIndicesTestMatrix(x, rows, cols, 809s + ftest = rowMedians, fsure = rowMedians_R, 809s + na.rm = na.rm, useNames = useNames) 809s + validateIndicesTestMatrix(x, rows, cols, 809s + fcoltest = colMedians, fsure = rowMedians_R, 809s + na.rm = na.rm, useNames = useNames) 809s + } 809s + } 809s + } 811s > 811s 811s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 811s Copyright (C) 2024 The R Foundation for Statistical Computing 811s Platform: aarch64-unknown-linux-gnu (64-bit) 811s 811s R is free software and comes with ABSOLUTELY NO WARRANTY. 811s You are welcome to redistribute it under certain conditions. 811s Type 'license()' or 'licence()' for distribution details. 811s 811s R is a collaborative project with many contributors. 811s Type 'contributors()' for more information and 811s 'citation()' on how to cite R or R packages in publications. 811s 811s Type 'demo()' for some demos, 'help()' for on-line help, or 811s 'help.start()' for an HTML browser interface to help. 811s Type 'q()' to quit R. 811s 812s > library("matrixStats") 812s > library("stats") 812s > 812s > asWhich <- function(probs, max) { 812s + idx <- as.integer(round(probs * max)) 812s + if (idx < 1L) { 812s + idx <- 1L 812s + } else if (idx > max) { 812s + idx <- max 812s + } 812s + idx 812s + } # asWhich() 812s > 812s > rowOrderStats_R <- function(x, probs, ..., useNames = NA) { 812s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 812s + 812s + # Remove Attributes 812s + if (is.na(useNames) || !useNames || length(ans) == 0L) attributes(ans) <- NULL 812s + ans 812s + } # rowOrderStats_R() 812s > 812s > 812s > set.seed(1) 812s > 812s > 812s > # Simulate data in a matrix of any shape 812s > nrow <- 60L 812s > ncol <- 30L 812s > x <- rnorm(nrow * ncol) 812s > dim(x) <- c(nrow, ncol) 812s > probs <- 0.3 812s > which <- asWhich(probs, max = ncol) 812s > 812s > y0 <- rowOrderStats_R(x, probs = probs) 812s > y1 <- rowOrderStats(x, which = which) 812s > stopifnot(all.equal(y1, y0)) 812s > y2 <- colOrderStats(t(x), which = which) 812s > stopifnot(all.equal(y2, y0)) 812s > 812s > 812s > 812s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 812s > # Consistency checks 812s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 812s > for (mode in c("integer", "double")) { 812s + cat("Consistency checks without NAs:\n") 812s + for (kk in 1:3) { 812s + cat("Random test #", kk, "\n", sep = "") 812s + 812s + # Simulate data in a matrix of any shape 812s + nrow <- sample(20L, size = 1L) 812s + ncol <- sample(20L, size = 1L) 812s + x <- rnorm(nrow * ncol) 812s + dim(x) <- c(nrow, ncol) 812s + 812s + cat("mode: ", mode, "\n", sep = "") 812s + storage.mode(x) <- mode 812s + str(x) 812s + 812s + probs <- runif(1) 812s + which <- asWhich(probs, max = ncol) 812s + 812s + y0 <- rowOrderStats_R(x, probs = probs) 812s + y1 <- rowOrderStats(x, which = which) 812s + stopifnot(all.equal(y1, y0)) 812s + y2 <- colOrderStats(t(x), which = which) 812s + stopifnot(all.equal(y2, y0)) 812s + } # for (kk in ...) 812s + } # for (mode ...) 812s Consistency checks without NAs: 812s Random test #1 812s mode: integer 812s int [1:14, 1:6] 0 0 1 0 2 -1 1 0 0 0 ... 812s Random test #2 812s mode: integer 812s int [1:8, 1:13] 0 0 1 -2 0 0 0 0 1 0 ... 812s Random test #3 812s mode: integer 812s int [1:20, 1:17] 0 0 0 0 1 0 1 0 0 -1 ... 812s Consistency checks without NAs: 812s Random test #1 812s mode: double 812s num [1:9, 1:5] -1.4286 -0.00386 -0.70456 -0.29242 -0.49607 ... 812s Random test #2 812s mode: double 812s num [1:11, 1:20] -0.796 0.482 -0.952 0.5 1.242 ... 812s Random test #3 812s mode: double 812s num [1:7, 1:18] 1.553 -2.405 0.167 -0.403 -1.746 ... 812s > 812s > 812s > # Check names attribute 812s > x <- matrix(1:9 + 0.1, nrow = 3L, ncol = 3L) 812s > 812s > probs <- runif(1) 812s > which <- asWhich(probs, max = ncol(x)) 812s > 812s > dimnames <- list(letters[1:3], LETTERS[1:3]) 812s > 812s > # Test with and without dimnames on x 812s > for (setDimnames in c(TRUE, FALSE)) { 812s + if (setDimnames) dimnames(x) <- dimnames 812s + else dimnames(x) <- NULL 812s + # Check names attribute 812s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 812s + y0 <- rowOrderStats_R(x, probs = probs, useNames = useNames) 812s + y1 <- rowOrderStats(x, which = which, useNames = useNames) 812s + stopifnot(all.equal(y1, y0)) 812s + y2 <- colOrderStats(t(x), which = which, useNames = useNames) 812s + stopifnot(all.equal(y2, y0)) 812s + } 812s + } 812s > 813s 813s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 813s Copyright (C) 2024 The R Foundation for Statistical Computing 813s Platform: aarch64-unknown-linux-gnu (64-bit) 813s 813s R is free software and comes with ABSOLUTELY NO WARRANTY. 813s You are welcome to redistribute it under certain conditions. 813s Type 'license()' or 'licence()' for distribution details. 813s 813s R is a collaborative project with many contributors. 813s Type 'contributors()' for more information and 813s 'citation()' on how to cite R or R packages in publications. 813s 813s Type 'demo()' for some demos, 'help()' for on-line help, or 813s 'help.start()' for an HTML browser interface to help. 813s Type 'q()' to quit R. 813s 813s > library("matrixStats") 813s > 813s > rowOrderStats_R <- function(x, probs, ..., useNames = NA) { 813s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 813s + 813s + # Remove Attributes 813s + if (is.na(useNames) || !useNames || length(ans) == 0L) attributes(ans) <- NULL 813s + ans 813s + } # rowOrderStats_R() 813s > 813s > 813s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 813s > # Subsetted tests 813s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 813s > source("utils/validateIndicesFramework.R") 813s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 813s > storage.mode(x) <- "integer" 813s > 813s > # To check names attribute 813s > dimnames <- list(letters[1:6], LETTERS[1:6]) 813s > 813s > probs <- 0.3 813s > # Test with and without dimnames on x 813s > for (setDimnames in c(TRUE, FALSE)) { 813s + if (setDimnames) dimnames(x) <- dimnames 813s + else dimnames(x) <- NULL 813s + for (rows in index_cases) { 813s + for (cols in index_cases) { 813s + # Check names attribute 813s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 813s + if (is.null(cols)) which <- round(probs * ncol(x)) 813s + else { 813s + xxrows <- rows 813s + suppressWarnings({ 813s + xx <- tryCatch(x[, cols, drop = FALSE], error = function(c) "error") 813s + if (identical(xx, "error")) which <- 0L 813s + else which <- round(probs * ncol(xx)) 813s + }) 813s + } 813s + if (which == 0L) next 813s + 813s + validateIndicesTestMatrix(x, rows, cols, 813s + ftest = rowOrderStats, fsure = rowOrderStats_R, 813s + which = which, probs = probs, useNames = useNames) 813s + validateIndicesTestMatrix(x, rows, cols, 813s + fcoltest = colOrderStats, fsure = rowOrderStats_R, 813s + which = which, probs = probs, useNames = useNames) 813s + } 813s + } 813s + } 813s + } 819s > 819s 819s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 819s Copyright (C) 2024 The R Foundation for Statistical Computing 819s Platform: aarch64-unknown-linux-gnu (64-bit) 819s 819s R is free software and comes with ABSOLUTELY NO WARRANTY. 819s You are welcome to redistribute it under certain conditions. 819s Type 'license()' or 'licence()' for distribution details. 819s 819s R is a collaborative project with many contributors. 819s Type 'contributors()' for more information and 819s 'citation()' on how to cite R or R packages in publications. 819s 819s Type 'demo()' for some demos, 'help()' for on-line help, or 819s 'help.start()' for an HTML browser interface to help. 819s Type 'q()' to quit R. 819s 820s > library("matrixStats") 820s > 820s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = NA) { 820s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 820s + if (is.na(useNames) || !useNames) names(res) <- NULL 820s + res 820s + } 820s > 820s > all.equal.na <- function(target, current, ...) { 820s + # Computations involving NaN may return NaN or NA, cf. ?is.nan 820s + current[is.nan(current)] <- NA_real_ 820s + target[is.nan(target)] <- NA_real_ 820s + all.equal(target, current, ...) 820s + } 820s > 820s > for (mode in c("integer", "double")) { 820s + # Missing values 820s + x <- matrix(c(1, NA, NaN, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 820s + cat("mode: ", mode, "\n", sep = "") 820s + storage.mode(x) <- mode 820s + str(x) 820s + 820s + # To check names attribute 820s + dimnames <- list(letters[1:4], LETTERS[1:2]) 820s + 820s + # Test with and without dimnames on x 820s + for (setDimnames in c(TRUE, FALSE)) { 820s + if (setDimnames) dimnames(x) <- dimnames 820s + else dimnames(x) <- NULL 820s + # Check names attribute 820s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 820s + y0 <- rowProds_R(x, na.rm = TRUE, useNames = useNames) 820s + print(y0) 820s + y1 <- rowProds(x, na.rm = TRUE, useNames = useNames) 820s + print(y1) 820s + y2 <- colProds(t(x), na.rm = TRUE, useNames = useNames) 820s + print(y2) 820s + stopifnot(all.equal(y1, y0)) 820s + stopifnot(all.equal(y2, y1)) 820s + 820s + # Missing values 820s + y0 <- rowProds_R(x, na.rm = FALSE, useNames = useNames) 820s + print(y0) 820s + y1 <- rowProds(x, na.rm = FALSE, useNames = useNames) 820s + print(y1) 820s + y2 <- colProds(t(x), na.rm = FALSE, useNames = useNames) 820s + print(y2) 820s + stopifnot(all.equal(y1, y0)) 820s + stopifnot(all.equal(y2, y1)) 820s + 820s + # "Empty" rows 820s + y0 <- rowProds_R(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 820s + print(y0) 820s + y1 <- rowProds(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 820s + print(y1) 820s + y2 <- colProds(t(x[integer(0), , drop = FALSE]), na.rm = FALSE, useNames = useNames) 820s + print(y2) 820s + stopifnot(all.equal.na(y1, y0)) 820s + stopifnot(all.equal(y2, y1)) 820s + stopifnot(length(y1) == 0L) 820s + 820s + # Using product() 820s + y1 <- rowProds(x, method = "expSumLog", na.rm = FALSE, useNames = useNames) 820s + print(y1) 820s + y2 <- colProds(t(x), method = "expSumLog", na.rm = FALSE, useNames = useNames) 820s + print(y2) 820s + stopifnot(all.equal(y2, y1)) 820s + } 820s + } 820s + } # for (mode ...) 820s mode: integer 820s int [1:4, 1:2] 1 NA NA 1 1 0 1 0 820s a b c d 820s 1 0 1 0 820s a b c d 820s 1 0 1 0 820s a b c d 820s 1 0 1 0 820s a b c d 820s 1 NA NA 0 820s a b c d 820s 1 NA NA 0 820s a b c d 820s 1 NA NA 0 820s numeric(0) 820s numeric(0) 820s numeric(0) 820s a b c d 820s 1 NA NA 0 820s a b c d 820s 1 NA NA 0 820s [1] 1 0 1 0 820s [1] 1 0 1 0 820s [1] 1 0 1 0 820s [1] 1 NA NA 0 820s [1] 1 NA NA 0 820s [1] 1 NA NA 0 820s numeric(0) 820s numeric(0) 820s numeric(0) 820s [1] 1 NA NA 0 820s [1] 1 NA NA 0 820s [1] 1 0 1 0 820s [1] 1 0 1 0 820s [1] 1 0 1 0 820s [1] 1 NA NA 0 820s [1] 1 NA NA 0 820s [1] 1 NA NA 0 820s numeric(0) 820s numeric(0) 820s numeric(0) 820s [1] 1 NA NA 0 820s [1] 1 NA NA 0 820s [1] 1 0 1 0 820s [1] 1 0 1 0 820s [1] 1 0 1 0 820s [1] 1 NA NA 0 820s [1] 1 NA NA 0 820s [1] 1 NA NA 0 820s numeric(0) 820s numeric(0) 820s numeric(0) 820s [1] 1 NA NA 0 820s [1] 1 NA NA 0 820s mode: double 820s num [1:4, 1:2] 1 NA NaN 1 1 0 1 0 820s a b c d 820s 1 0 1 0 820s a b c d 820s 1 0 1 0 820s a b c d 820s 1 0 1 0 820s a b c d 820s 1 NA NaN 0 820s a b c d 820s 1 NA NaN 0 820s a b c d 820s 1 NA NaN 0 820s numeric(0) 820s numeric(0) 820s numeric(0) 820s a b c d 820s 1 NA NA 0 820s a b c d 820s 1 NA NA 0 820s [1] 1 0 1 0 820s [1] 1 0 1 0 820s [1] 1 0 1 0 820s [1] 1 NA NaN 0 820s [1] 1 NA NaN 0 820s [1] 1 NA NaN 0 820s numeric(0) 820s numeric(0) 820s numeric(0) 820s [1] 1 NA NA 0 820s [1] 1 NA NA 0 820s [1] 1 0 1 0 820s [1] 1 0 1 0 820s [1] 1 0 1 0 820s [1] 1 NA NaN 0 820s [1] 1 NA NaN 0 820s [1] 1 NA NaN 0 820s numeric(0) 820s numeric(0) 820s numeric(0) 821s [1] 1 NA NA 0 821s [1] 1 NA NA 0 821s [1] 1 0 1 0 821s [1] 1 0 1 0 821s [1] 1 0 1 0 821s [1] 1 NA NaN 0 821s [1] 1 NA NaN 0 821s [1] 1 NA NaN 0 821s numeric(0) 821s numeric(0) 821s numeric(0) 821s [1] 1 NA NA 0 821s [1] 1 NA NA 0 821s > 821s > 821s > # Bug report 2012-06-25 821s > x <- matrix(c(1, 1, 1, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 821s > y0 <- rowProds_R(x) 821s > print(y0) 821s [1] 1 0 1 0 821s > y1 <- rowProds(x) 821s > print(y1) 821s [1] 1 0 1 0 821s > y2 <- colProds(t(x)) 821s > print(y2) 821s [1] 1 0 1 0 821s > stopifnot(all.equal.na(y1, y0)) 821s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 821s > stopifnot(all.equal.na(y2, y1)) 821s > # Check names attribute 821s > dimnames(x) <- dimnames 821s > y0 <- rowProds_R(x, useNames = TRUE) 821s > print(y0) 821s a b c d 821s 1 0 1 0 821s > y1 <- rowProds(x, useNames = TRUE) 821s > print(y1) 821s a b c d 821s 1 0 1 0 821s > y2 <- colProds(t(x), useNames = TRUE) 821s > print(y2) 821s a b c d 821s 1 0 1 0 821s > stopifnot(all.equal.na(y1, y0)) 821s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 821s > stopifnot(all.equal.na(y2, y1)) 821s > 821s > # Bug report 2014-03-25 ("all rows contains a zero") 821s > x <- matrix(c(0, 1, 1, 0), nrow = 2, ncol = 2) 821s > # To check names attribute 821s > dimnames <- list(letters[1:2], LETTERS[1:2]) 821s > y0 <- rowProds_R(x) 821s > print(y0) 821s [1] 0 0 821s > y1 <- rowProds(x) 821s > print(y1) 821s [1] 0 0 821s > y2 <- colProds(t(x)) 821s > print(y2) 821s [1] 0 0 821s > stopifnot(all.equal.na(y1, y0)) 821s > stopifnot(all.equal.na(y1, c(0, 0))) 821s > stopifnot(all.equal.na(y2, y1)) 821s > # Check names attribute 821s > dimnames(x) <- dimnames 821s > y0 <- rowProds_R(x, useNames = TRUE) 821s > print(y0) 821s a b 821s 0 0 821s > y1 <- rowProds(x, useNames = TRUE) 821s > print(y1) 821s a b 821s 0 0 821s > y2 <- colProds(t(x), useNames = TRUE) 821s > print(y2) 821s a b 821s 0 0 821s > stopifnot(all.equal.na(y1, y0)) 821s > stopifnot(all.equal.na(y2, y1)) 821s > 821s 821s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 821s Copyright (C) 2024 The R Foundation for Statistical Computing 821s Platform: aarch64-unknown-linux-gnu (64-bit) 821s 821s R is free software and comes with ABSOLUTELY NO WARRANTY. 821s You are welcome to redistribute it under certain conditions. 821s Type 'license()' or 'licence()' for distribution details. 821s 821s R is a collaborative project with many contributors. 821s Type 'contributors()' for more information and 821s 'citation()' on how to cite R or R packages in publications. 821s 821s Type 'demo()' for some demos, 'help()' for on-line help, or 821s 'help.start()' for an HTML browser interface to help. 821s Type 'q()' to quit R. 821s 821s > library("matrixStats") 821s > 821s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = NA) { 821s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 821s + if (is.na(useNames) || !useNames) names(res) <- NULL 821s + res 821s + } 821s > 821s > 821s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 821s > # Subsetted tests 821s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 821s > source("utils/validateIndicesFramework.R") 821s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 821s > storage.mode(x) <- "integer" 821s > 821s > # To check names attribute 821s > dimnames <- list(letters[1:6], LETTERS[1:6]) 821s > 821s > # Test with and without dimnames on x 821s > for (setDimnames in c(TRUE, FALSE)) { 821s + if (setDimnames) dimnames(x) <- dimnames 821s + else dimnames(x) <- NULL 821s + for (rows in index_cases) { 821s + for (cols in index_cases) { 821s + for (na.rm in c(TRUE, FALSE)) { 821s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 821s + validateIndicesTestMatrix(x, rows, cols, 821s + ftest = rowProds, fsure = rowProds_R, 821s + method = "expSumLog", 821s + FUN = product, na.rm = na.rm, useNames = useNames) 821s + validateIndicesTestMatrix(x, rows, cols, 821s + fcoltest = colProds, fsure = rowProds_R, 821s + method = "expSumLog", 821s + FUN = product, na.rm = na.rm, useNames = useNames) 821s + } 821s + } 821s + } 821s + } 821s + } 829s > 829s 829s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 829s Copyright (C) 2024 The R Foundation for Statistical Computing 829s Platform: aarch64-unknown-linux-gnu (64-bit) 829s 829s R is free software and comes with ABSOLUTELY NO WARRANTY. 829s You are welcome to redistribute it under certain conditions. 829s Type 'license()' or 'licence()' for distribution details. 829s 829s R is a collaborative project with many contributors. 829s Type 'contributors()' for more information and 829s 'citation()' on how to cite R or R packages in publications. 829s 829s Type 'demo()' for some demos, 'help()' for on-line help, or 829s 'help.start()' for an HTML browser interface to help. 829s Type 'q()' to quit R. 829s 829s > library("matrixStats") 830s > 830s > ## Create isFALSE() if running on an old version of R 830s > if (!exists("isFALSE", mode="function")) { 830s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 830s + } 830s > 830s > rowQuantiles_R <- function(x, probs = c(0, 0.25, 0.50, 0.75, 1), na.rm = FALSE, drop = TRUE, type = 7L, ..., useNames = NA) { 830s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 830s + if (!na.rm && any(is.na(x))) { 830s + na_value <- NA_real_ 830s + if (type != 7L) storage.mode(na_value) <- storage.mode(x) 830s + rep(na_value, times = length(probs)) 830s + } else { 830s + as.vector(quantile(x, probs = probs, na.rm = na.rm, type = type, names = FALSE, ...)) 830s + } 830s + }, probs = probs, na.rm = na.rm) 830s + 830s + if (!is.null(dim(q))) q <- t(q) 830s + else dim(q) <- c(nrow(x), length(probs)) 830s + 830s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 830s + rownames(q) <- rownames(x) 830s + if (isFALSE(useNames)) dimnames(q) <- NULL 830s + 830s + if (drop) q <- drop(q) 830s + q 830s + } 830s > 830s > 830s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 830s > # Test with multiple quantiles 830s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 830s > for (mode in c("logical", "integer", "double")) { 830s + cat("mode: ", mode, "\n", sep = "") 830s + x <- matrix(1:40 + 0.1, nrow = 8, ncol = 5) 830s + storage.mode(x) <- mode 830s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 830s + str(x) 830s + 830s + probs <- c(0, 0.5, 1) 830s + # Test with and without dimnames on x 830s + for (setDimnames in c(TRUE, FALSE)) { 830s + if (setDimnames) dimnames(x) <- dimnames 830s + else dimnames(x) <- NULL 830s + # Check names attribute 830s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 830s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 830s + print(q0) 830s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 830s + print(q1) 830s + ## FIXME: Workaround for R (< 3.0.0) 830s + if (getRversion() < "3.0.0" && mode == "logical") storage.mode(q1) <- storage.mode(q0) 830s + stopifnot(all.equal(q1, q0)) 830s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 830s + ## FIXME: Workaround for R (< 3.0.0) 830s + if (getRversion() < "3.0.0" && mode == "logical") storage.mode(q2) <- storage.mode(q0) 830s + stopifnot(all.equal(q2, q0)) 830s + } 830s + } 830s + } # for (mode ...) 830s mode: logical 830s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 830s 0% 50% 100% 830s a 1 1 1 830s b 1 1 1 830s c 1 1 1 830s d 1 1 1 830s e 1 1 1 830s f 1 1 1 830s g 1 1 1 830s h 1 1 1 830s 0% 50% 100% 830s a 1 1 1 830s b 1 1 1 830s c 1 1 1 830s d 1 1 1 830s e 1 1 1 830s f 1 1 1 830s g 1 1 1 830s h 1 1 1 830s [,1] [,2] [,3] 830s [1,] 1 1 1 830s [2,] 1 1 1 830s [3,] 1 1 1 830s [4,] 1 1 1 830s [5,] 1 1 1 830s [6,] 1 1 1 830s [7,] 1 1 1 830s [8,] 1 1 1 830s [,1] [,2] [,3] 830s [1,] 1 1 1 830s [2,] 1 1 1 830s [3,] 1 1 1 830s [4,] 1 1 1 830s [5,] 1 1 1 830s [6,] 1 1 1 830s [7,] 1 1 1 830s [8,] 1 1 1 830s 0% 50% 100% 830s [1,] 1 1 1 830s [2,] 1 1 1 830s [3,] 1 1 1 830s [4,] 1 1 1 830s [5,] 1 1 1 830s [6,] 1 1 1 830s [7,] 1 1 1 830s [8,] 1 1 1 830s 0% 50% 100% 830s [1,] 1 1 1 830s [2,] 1 1 1 830s [3,] 1 1 1 830s [4,] 1 1 1 830s [5,] 1 1 1 830s [6,] 1 1 1 830s [7,] 1 1 1 830s [8,] 1 1 1 830s [,1] [,2] [,3] 830s [1,] 1 1 1 830s [2,] 1 1 1 830s [3,] 1 1 1 830s [4,] 1 1 1 830s [5,] 1 1 1 830s [6,] 1 1 1 830s [7,] 1 1 1 830s [8,] 1 1 1 830s [,1] [,2] [,3] 830s [1,] 1 1 1 830s [2,] 1 1 1 830s [3,] 1 1 1 830s [4,] 1 1 1 830s [5,] 1 1 1 830s [6,] 1 1 1 830s [7,] 1 1 1 830s [8,] 1 1 1 830s mode: integer 830s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 830s 0% 50% 100% 830s a 1 17 33 830s b 2 18 34 830s c 3 19 35 830s d 4 20 36 830s e 5 21 37 830s f 6 22 38 830s g 7 23 39 830s h 8 24 40 830s 0% 50% 100% 830s a 1 17 33 830s b 2 18 34 830s c 3 19 35 830s d 4 20 36 830s e 5 21 37 830s f 6 22 38 830s g 7 23 39 830s h 8 24 40 830s [,1] [,2] [,3] 830s [1,] 1 17 33 830s [2,] 2 18 34 830s [3,] 3 19 35 830s [4,] 4 20 36 830s [5,] 5 21 37 830s [6,] 6 22 38 830s [7,] 7 23 39 830s [8,] 8 24 40 830s [,1] [,2] [,3] 830s [1,] 1 17 33 830s [2,] 2 18 34 830s [3,] 3 19 35 830s [4,] 4 20 36 830s [5,] 5 21 37 830s [6,] 6 22 38 830s [7,] 7 23 39 830s [8,] 8 24 40 830s 0% 50% 100% 830s [1,] 1 17 33 830s [2,] 2 18 34 830s [3,] 3 19 35 830s [4,] 4 20 36 830s [5,] 5 21 37 830s [6,] 6 22 38 830s [7,] 7 23 39 830s [8,] 8 24 40 830s 0% 50% 100% 830s [1,] 1 17 33 830s [2,] 2 18 34 830s [3,] 3 19 35 830s [4,] 4 20 36 830s [5,] 5 21 37 830s [6,] 6 22 38 830s [7,] 7 23 39 830s [8,] 8 24 40 830s [,1] [,2] [,3] 830s [1,] 1 17 33 830s [2,] 2 18 34 830s [3,] 3 19 35 830s [4,] 4 20 36 830s [5,] 5 21 37 830s [6,] 6 22 38 830s [7,] 7 23 39 830s [8,] 8 24 40 830s [,1] [,2] [,3] 830s [1,] 1 17 33 830s [2,] 2 18 34 830s [3,] 3 19 35 830s [4,] 4 20 36 830s [5,] 5 21 37 830s [6,] 6 22 38 830s [7,] 7 23 39 830s [8,] 8 24 40 830s mode: double 830s num [1:8, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 830s 0% 50% 100% 830s a 1.1 17.1 33.1 830s b 2.1 18.1 34.1 830s c 3.1 19.1 35.1 830s d 4.1 20.1 36.1 830s e 5.1 21.1 37.1 830s f 6.1 22.1 38.1 830s g 7.1 23.1 39.1 830s h 8.1 24.1 40.1 830s 0% 50% 100% 830s a 1.1 17.1 33.1 830s b 2.1 18.1 34.1 830s c 3.1 19.1 35.1 830s d 4.1 20.1 36.1 830s e 5.1 21.1 37.1 830s f 6.1 22.1 38.1 830s g 7.1 23.1 39.1 830s h 8.1 24.1 40.1 830s [,1] [,2] [,3] 830s [1,] 1.1 17.1 33.1 830s [2,] 2.1 18.1 34.1 830s [3,] 3.1 19.1 35.1 830s [4,] 4.1 20.1 36.1 830s [5,] 5.1 21.1 37.1 830s [6,] 6.1 22.1 38.1 830s [7,] 7.1 23.1 39.1 830s [8,] 8.1 24.1 40.1 830s [,1] [,2] [,3] 830s [1,] 1.1 17.1 33.1 830s [2,] 2.1 18.1 34.1 830s [3,] 3.1 19.1 35.1 830s [4,] 4.1 20.1 36.1 830s [5,] 5.1 21.1 37.1 830s [6,] 6.1 22.1 38.1 830s [7,] 7.1 23.1 39.1 830s [8,] 8.1 24.1 40.1 830s 0% 50% 100% 830s [1,] 1.1 17.1 33.1 830s [2,] 2.1 18.1 34.1 830s [3,] 3.1 19.1 35.1 830s [4,] 4.1 20.1 36.1 830s [5,] 5.1 21.1 37.1 830s [6,] 6.1 22.1 38.1 830s [7,] 7.1 23.1 39.1 830s [8,] 8.1 24.1 40.1 830s 0% 50% 100% 830s [1,] 1.1 17.1 33.1 830s [2,] 2.1 18.1 34.1 830s [3,] 3.1 19.1 35.1 830s [4,] 4.1 20.1 36.1 830s [5,] 5.1 21.1 37.1 830s [6,] 6.1 22.1 38.1 830s [7,] 7.1 23.1 39.1 830s [8,] 8.1 24.1 40.1 830s [,1] [,2] [,3] 830s [1,] 1.1 17.1 33.1 830s [2,] 2.1 18.1 34.1 830s [3,] 3.1 19.1 35.1 830s [4,] 4.1 20.1 36.1 830s [5,] 5.1 21.1 37.1 830s [6,] 6.1 22.1 38.1 830s [7,] 7.1 23.1 39.1 830s [8,] 8.1 24.1 40.1 830s [,1] [,2] [,3] 830s [1,] 1.1 17.1 33.1 830s [2,] 2.1 18.1 34.1 830s [3,] 3.1 19.1 35.1 830s [4,] 4.1 20.1 36.1 830s [5,] 5.1 21.1 37.1 830s [6,] 6.1 22.1 38.1 830s [7,] 7.1 23.1 39.1 830s [8,] 8.1 24.1 40.1 830s > 830s > 830s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 830s > # Test with a single quantile 830s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 830s > for (mode in c("logical", "integer", "double")) { 830s + cat("mode: ", mode, "\n", sep = "") 830s + x <- matrix(1:40, nrow = 8, ncol = 5) 830s + storage.mode(x) <- mode 830s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 830s + str(x) 830s + 830s + probs <- c(0.5) 830s + # Test with and without dimnames on x 830s + for (setDimnames in c(TRUE, FALSE)) { 830s + if (setDimnames) dimnames(x) <- dimnames 830s + else dimnames(x) <- NULL 830s + # Check names attribute 830s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 830s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 830s + print(q0) 830s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 830s + ## FIXME: Workaround for R (< 3.0.0) 830s + if (getRversion() < "3.0.0" && mode == "logical") storage.mode(q1) <- storage.mode(q0) 830s + print(q1) 830s + stopifnot(all.equal(q1, q0)) 830s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 830s + ## FIXME: Workaround for R (< 3.0.0) 830s + if (getRversion() < "3.0.0" && mode == "logical") storage.mode(q2) <- storage.mode(q0) 830s + stopifnot(all.equal(q2, q0)) 830s + } 830s + } 830s + } # for (mode ...) 830s mode: logical 830s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 830s a b c d e f g h 830s 1 1 1 1 1 1 1 1 830s a b c d e f g h 830s 1 1 1 1 1 1 1 1 830s [1] 1 1 1 1 1 1 1 1 830s [1] 1 1 1 1 1 1 1 1 830s [1] 1 1 1 1 1 1 1 1 830s [1] 1 1 1 1 1 1 1 1 830s [1] 1 1 1 1 1 1 1 1 830s [1] 1 1 1 1 1 1 1 1 830s mode: integer 830s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 830s a b c d e f g h 830s 17 18 19 20 21 22 23 24 830s a b c d e f g h 830s 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s mode: double 830s num [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 830s a b c d e f g h 830s 17 18 19 20 21 22 23 24 830s a b c d e f g h 830s 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s [1] 17 18 19 20 21 22 23 24 830s > 830s > 830s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 830s > # Consistency checks 830s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 830s > set.seed(1) 830s > 830s > probs <- seq(from = 0, to = 1, by = 0.25) 830s > 830s > cat("Consistency checks:\n") 830s Consistency checks: 830s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 6L else 24L 830s > for (kk in seq_len(n_sims)) { 831s + cat("Random test #", kk, "\n", sep = "") 831s + 831s + # Simulate data in a matrix of any shape 831s + dim <- sample(20:60, size = 2L) 831s + n <- prod(dim) 831s + x <- rnorm(n, sd = 100) 831s + dim(x) <- dim 831s + dimnames <- lapply(dim(x), FUN = function(n) rep(letters, length.out = n)) 831s + 831s + # Add NAs? 831s + has_na <- ((kk %% 2) == 0L) 831s + if (has_na) { 831s + cat("Adding NAs\n") 831s + nna <- sample(n, size = 1) 831s + na_values <- c(NA_real_, NaN) 831s + t <- sample(na_values, size = nna, replace = TRUE) 831s + x[sample(length(x), size = nna)] <- t 831s + } 831s + 831s + # Logical, integer, or double? 831s + mode <- "numeric" 831s + if ((kk %% 6) %in% 1:2) { 831s + cat("Coercing to logical\n") 831s + mode <- "logical" 831s + } else if ((kk %% 6) %in% 3:4) { 831s + cat("Coercing to integers\n") 831s + mode <- "integer" 831s + } 831s + storage.mode(x) <- mode 831s + 831s + str(x) 831s + 831s + # rowQuantiles(): 831s + for (type in 1:9) { 831s + cat(sprintf("type=%d, has_na=%s:\n", type, has_na)) 831s + # Test with and without dimnames on x 831s + for (setDimnames in c(TRUE, FALSE)) { 831s + if (setDimnames) dimnames(x) <- dimnames 831s + else dimnames(x) <- NULL 831s + # Check names attribute 831s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 831s + q0 <- rowQuantiles_R(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 831s + q1 <- rowQuantiles(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 831s + ## FIXME: Workaround for R (< 3.0.0) 831s + if (getRversion() < "3.0.0" && mode == "logical" && !has_na && type == 7L) storage.mode(q1) <- storage.mode(q0) 831s + stopifnot(all.equal(q1, q0)) 831s + q2 <- colQuantiles(t(x), probs = probs, na.rm = has_na, type = type, useNames = useNames) 831s + ## FIXME: Workaround for R (< 3.0.0) 831s + if (getRversion() < "3.0.0" && mode == "logical" && !has_na && type == 7L) storage.mode(q2) <- storage.mode(q0) 831s + stopifnot(all.equal(q2, q0)) 831s + } 831s + } 831s + } 831s + } # for (kk ...) 831s Random test #1 831s Coercing to logical 831s logi [1:23, 1:58] TRUE TRUE TRUE TRUE TRUE TRUE ... 831s type=1, has_na=FALSE: 831s type=2, has_na=FALSE: 831s type=3, has_na=FALSE: 831s type=4, has_na=FALSE: 831s type=5, has_na=FALSE: 832s type=6, has_na=FALSE: 832s type=7, has_na=FALSE: 832s type=8, has_na=FALSE: 832s type=9, has_na=FALSE: 832s Random test #2 832s Adding NAs 832s Coercing to logical 832s logi [1:58, 1:33] TRUE TRUE TRUE TRUE TRUE NA ... 832s type=1, has_na=TRUE: 833s type=2, has_na=TRUE: 833s type=3, has_na=TRUE: 833s type=4, has_na=TRUE: 834s type=5, has_na=TRUE: 834s type=6, has_na=TRUE: 834s type=7, has_na=TRUE: 835s type=8, has_na=TRUE: 835s type=9, has_na=TRUE: 836s Random test #3 836s Coercing to integers 836s int [1:28, 1:60] 119 -164 115 -129 209 -175 2 -32 120 -28 ... 836s type=1, has_na=FALSE: 836s type=2, has_na=FALSE: 836s type=3, has_na=FALSE: 836s type=4, has_na=FALSE: 836s type=5, has_na=FALSE: 836s type=6, has_na=FALSE: 837s type=7, has_na=FALSE: 837s type=8, has_na=FALSE: 837s type=9, has_na=FALSE: 837s Random test #4 837s Adding NAs 837s Coercing to integers 837s int [1:54, 1:35] 147 11 116 -50 NA -69 132 NA 114 NA ... 837s type=1, has_na=TRUE: 838s type=2, has_na=TRUE: 838s type=3, has_na=TRUE: 838s type=4, has_na=TRUE: 838s type=5, has_na=TRUE: 839s type=6, has_na=TRUE: 839s type=7, has_na=TRUE: 839s type=8, has_na=TRUE: 840s type=9, has_na=TRUE: 840s Random test #5 840s num [1:39, 1:53] 5.94 -27.16 -30.78 173 126.05 ... 840s type=1, has_na=FALSE: 840s type=2, has_na=FALSE: 841s type=3, has_na=FALSE: 841s type=4, has_na=FALSE: 841s type=5, has_na=FALSE: 841s type=6, has_na=FALSE: 842s type=7, has_na=FALSE: 842s type=8, has_na=FALSE: 842s type=9, has_na=FALSE: 842s Random test #6 842s Adding NAs 842s num [1:46, 1:22] 197 -107 15 148 -110 ... 842s type=1, has_na=TRUE: 842s type=2, has_na=TRUE: 843s type=3, has_na=TRUE: 843s type=4, has_na=TRUE: 843s type=5, has_na=TRUE: 843s type=6, has_na=TRUE: 844s type=7, has_na=TRUE: 844s type=8, has_na=TRUE: 844s type=9, has_na=TRUE: 845s Random test #7 845s Coercing to logical 845s logi [1:21, 1:51] TRUE TRUE TRUE TRUE TRUE TRUE ... 845s type=1, has_na=FALSE: 845s type=2, has_na=FALSE: 845s type=3, has_na=FALSE: 845s type=4, has_na=FALSE: 845s type=5, has_na=FALSE: 845s type=6, has_na=FALSE: 845s type=7, has_na=FALSE: 845s type=8, has_na=FALSE: 846s type=9, has_na=FALSE: 846s Random test #8 846s Adding NAs 846s Coercing to logical 846s logi [1:33, 1:53] NA NA TRUE TRUE TRUE TRUE ... 846s type=1, has_na=TRUE: 846s type=2, has_na=TRUE: 846s type=3, has_na=TRUE: 846s type=4, has_na=TRUE: 846s type=5, has_na=TRUE: 847s type=6, has_na=TRUE: 847s type=7, has_na=TRUE: 847s type=8, has_na=TRUE: 847s type=9, has_na=TRUE: 848s Random test #9 848s Coercing to integers 848s int [1:53, 1:24] -73 10 -73 -5 44 -107 -100 95 58 -50 ... 848s type=1, has_na=FALSE: 848s type=2, has_na=FALSE: 848s type=3, has_na=FALSE: 848s type=4, has_na=FALSE: 849s type=5, has_na=FALSE: 849s type=6, has_na=FALSE: 849s type=7, has_na=FALSE: 849s type=8, has_na=FALSE: 850s type=9, has_na=FALSE: 850s Random test #10 850s Adding NAs 850s Coercing to integers 850s int [1:44, 1:20] NA -140 NA -57 -252 NA NA 20 NA NA ... 850s type=1, has_na=TRUE: 850s type=2, has_na=TRUE: 851s type=3, has_na=TRUE: 851s type=4, has_na=TRUE: 851s type=5, has_na=TRUE: 852s type=6, has_na=TRUE: 852s type=7, has_na=TRUE: 852s type=8, has_na=TRUE: 852s type=9, has_na=TRUE: 853s Random test #11 853s num [1:54, 1:23] -160.87 74.13 196.08 7.27 4.92 ... 853s type=1, has_na=FALSE: 853s type=2, has_na=FALSE: 853s type=3, has_na=FALSE: 854s type=4, has_na=FALSE: 854s type=5, has_na=FALSE: 854s type=6, has_na=FALSE: 854s type=7, has_na=FALSE: 855s type=8, has_na=FALSE: 855s type=9, has_na=FALSE: 855s Random test #12 855s Adding NAs 855s num [1:59, 1:27] -139.2 -86.3 NA -40.7 NA ... 855s type=1, has_na=TRUE: 856s type=2, has_na=TRUE: 856s type=3, has_na=TRUE: 856s type=4, has_na=TRUE: 857s type=5, has_na=TRUE: 857s type=6, has_na=TRUE: 858s type=7, has_na=TRUE: 858s type=8, has_na=TRUE: 858s type=9, has_na=TRUE: 859s Random test #13 859s Coercing to logical 859s logi [1:53, 1:60] TRUE TRUE TRUE TRUE TRUE TRUE ... 859s type=1, has_na=FALSE: 859s type=2, has_na=FALSE: 859s type=3, has_na=FALSE: 860s type=4, has_na=FALSE: 860s type=5, has_na=FALSE: 860s type=6, has_na=FALSE: 861s type=7, has_na=FALSE: 861s type=8, has_na=FALSE: 861s type=9, has_na=FALSE: 861s Random test #14 861s Adding NAs 861s Coercing to logical 861s logi [1:22, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 861s type=1, has_na=TRUE: 862s type=2, has_na=TRUE: 862s type=3, has_na=TRUE: 862s type=4, has_na=TRUE: 862s type=5, has_na=TRUE: 862s type=6, has_na=TRUE: 862s type=7, has_na=TRUE: 862s type=8, has_na=TRUE: 863s type=9, has_na=TRUE: 863s Random test #15 863s Coercing to integers 863s int [1:20, 1:34] 78 -41 183 190 -71 37 0 -4 -86 27 ... 863s type=1, has_na=FALSE: 863s type=2, has_na=FALSE: 863s type=3, has_na=FALSE: 863s type=4, has_na=FALSE: 863s type=5, has_na=FALSE: 864s type=6, has_na=FALSE: 864s type=7, has_na=FALSE: 864s type=8, has_na=FALSE: 864s type=9, has_na=FALSE: 864s Random test #16 864s Adding NAs 864s Coercing to integers 864s int [1:42, 1:37] NA 12 -15 41 -28 17 NA -74 NA NA ... 864s type=1, has_na=TRUE: 864s type=2, has_na=TRUE: 864s type=3, has_na=TRUE: 865s type=4, has_na=TRUE: 865s type=5, has_na=TRUE: 865s type=6, has_na=TRUE: 865s type=7, has_na=TRUE: 866s type=8, has_na=TRUE: 866s type=9, has_na=TRUE: 866s Random test #17 866s num [1:42, 1:29] -50.51 -6.51 -117.59 135.58 226.87 ... 866s type=1, has_na=FALSE: 866s type=2, has_na=FALSE: 867s type=3, has_na=FALSE: 867s type=4, has_na=FALSE: 867s type=5, has_na=FALSE: 867s type=6, has_na=FALSE: 868s type=7, has_na=FALSE: 868s type=8, has_na=FALSE: 868s type=9, has_na=FALSE: 868s Random test #18 868s Adding NAs 868s num [1:57, 1:39] 223 156.8 -44.6 -127.5 -147.7 ... 868s type=1, has_na=TRUE: 869s type=2, has_na=TRUE: 869s type=3, has_na=TRUE: 869s type=4, has_na=TRUE: 870s type=5, has_na=TRUE: 870s type=6, has_na=TRUE: 870s type=7, has_na=TRUE: 871s type=8, has_na=TRUE: 871s type=9, has_na=TRUE: 871s Random test #19 871s Coercing to logical 871s logi [1:52, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 871s type=1, has_na=FALSE: 872s type=2, has_na=FALSE: 872s type=3, has_na=FALSE: 872s type=4, has_na=FALSE: 873s type=5, has_na=FALSE: 873s type=6, has_na=FALSE: 873s type=7, has_na=FALSE: 873s type=8, has_na=FALSE: 874s type=9, has_na=FALSE: 874s Random test #20 874s Adding NAs 874s Coercing to logical 874s logi [1:25, 1:48] NA TRUE NA NA NA NA ... 874s type=1, has_na=TRUE: 874s type=2, has_na=TRUE: 874s type=3, has_na=TRUE: 875s type=4, has_na=TRUE: 875s type=5, has_na=TRUE: 875s type=6, has_na=TRUE: 875s type=7, has_na=TRUE: 875s type=8, has_na=TRUE: 875s type=9, has_na=TRUE: 876s Random test #21 876s Coercing to integers 876s int [1:53, 1:27] 3 -30 203 -49 19 -45 -138 28 46 -44 ... 876s type=1, has_na=FALSE: 876s type=2, has_na=FALSE: 876s type=3, has_na=FALSE: 877s type=4, has_na=FALSE: 877s type=5, has_na=FALSE: 877s type=6, has_na=FALSE: 878s type=7, has_na=FALSE: 878s type=8, has_na=FALSE: 878s type=9, has_na=FALSE: 878s Random test #22 878s Adding NAs 878s Coercing to integers 878s int [1:48, 1:36] -131 NA NA -201 45 -17 NA 57 NA NA ... 878s type=1, has_na=TRUE: 879s type=2, has_na=TRUE: 879s type=3, has_na=TRUE: 879s type=4, has_na=TRUE: 879s type=5, has_na=TRUE: 880s type=6, has_na=TRUE: 880s type=7, has_na=TRUE: 880s type=8, has_na=TRUE: 880s type=9, has_na=TRUE: 881s Random test #23 881s num [1:23, 1:43] -99.2 -68.8 -86.7 -104.2 48 ... 881s type=1, has_na=FALSE: 881s type=2, has_na=FALSE: 881s type=3, has_na=FALSE: 881s type=4, has_na=FALSE: 881s type=5, has_na=FALSE: 882s type=6, has_na=FALSE: 882s type=7, has_na=FALSE: 882s type=8, has_na=FALSE: 882s type=9, has_na=FALSE: 882s Random test #24 882s Adding NAs 882s num [1:53, 1:29] NaN -67.6 10.8 -88.4 130.1 ... 882s type=1, has_na=TRUE: 882s type=2, has_na=TRUE: 883s type=3, has_na=TRUE: 883s type=4, has_na=TRUE: 883s type=5, has_na=TRUE: 883s type=6, has_na=TRUE: 884s type=7, has_na=TRUE: 884s type=8, has_na=TRUE: 884s type=9, has_na=TRUE: 885s > 885s > 885s > 885s > for (mode in c("logical", "integer", "double")) { 885s + naValue <- NA_real_ 885s + storage.mode(naValue) <- mode 885s + 885s + someValue <- 1 885s + storage.mode(someValue) <- mode 885s + 885s + for (type in 1:9) { 885s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 885s + # All NA 885s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 885s + x <- matrix(naValue, nrow = 3L, ncol = 4L) 885s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 885s + # Test with and without dimnames on x 885s + for (setDimnames in c(TRUE, FALSE)) { 885s + if (setDimnames) dimnames(x) <- dimnames 885s + else dimnames(x) <- NULL 885s + # Check names attribute 885s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 885s + qr0 <- rowQuantiles_R(x, type = type, useNames = useNames) 885s + 885s + qr <- rowQuantiles(x, type = type, useNames = useNames) 885s + stopifnot(identical(qr, qr0)) 885s + 885s + # x <- matrix(naValue, nrow = 4L, ncol = 3L) 885s + qc <- colQuantiles(t(x), type = type, useNames = useNames) 885s + 885s + stopifnot(identical(qc, qr)) 885s + } 885s + } 885s + 885s + 885s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 885s + # Empty matrices 885s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 885s + probs <- c(0, 0.25, 0.75, 1) 885s + x <- matrix(naValue, nrow = 0L, ncol = 0L) 885s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 885s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 885s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 885s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 885s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 885s + 885s + x <- matrix(naValue, nrow = 2L, ncol = 0L) 885s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 885s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 885s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 885s + 885s + x <- matrix(naValue, nrow = 0L, ncol = 2L) 885s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 885s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 885s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 885s + 885s + 885s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 885s + # Single column matrices 885s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 885s + probs <- c(0, 0.25, 0.75, 1) 885s + x <- matrix(someValue, nrow = 2L, ncol = 1L) 885s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 885s + qr <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 885s + print(qr) 885s + 885s + x <- matrix(someValue, nrow = 1L, ncol = 2L) 885s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 885s + qc <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 885s + print(qc) 885s + 885s + stopifnot(identical(qc, qr)) 885s + } 885s + } 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s 0% 25% 75% 100% 885s a 1 1 1 1 885s b 1 1 1 1 885s > 886s 886s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 886s Copyright (C) 2024 The R Foundation for Statistical Computing 886s Platform: aarch64-unknown-linux-gnu (64-bit) 886s 886s R is free software and comes with ABSOLUTELY NO WARRANTY. 886s You are welcome to redistribute it under certain conditions. 886s Type 'license()' or 'licence()' for distribution details. 886s 886s R is a collaborative project with many contributors. 886s Type 'contributors()' for more information and 886s 'citation()' on how to cite R or R packages in publications. 886s 886s Type 'demo()' for some demos, 'help()' for on-line help, or 886s 'help.start()' for an HTML browser interface to help. 886s Type 'q()' to quit R. 886s 886s > library("matrixStats") 886s > 886s > ## Create isFALSE() if running on an old version of R 886s > if (!exists("isFALSE", mode="function")) { 886s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 886s + } 886s > 886s > rowQuantiles_R <- function(x, probs, na.rm = FALSE, drop = TRUE, ..., useNames = NA) { 886s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 886s + if (!na.rm && any(is.na(x))) { 886s + na_value <- NA_real_ 886s + storage.mode(na_value) <- storage.mode(x) 886s + rep(na_value, times = length(probs)) 886s + 886s + } else { 886s + as.vector(quantile(x, probs = probs, na.rm = na.rm, names = FALSE, ...)) 886s + } 886s + }, probs = probs, na.rm = na.rm) 886s + 886s + if (!is.null(dim(q))) q <- t(q) 886s + else dim(q) <- c(nrow(x), length(probs)) 886s + 886s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 886s + rownames(q) <- rownames(x) 886s + if (isFALSE(useNames)) dimnames(q) <- NULL 886s + 886s + if (drop) q <- drop(q) 886s + q 886s + } 886s > 886s > 886s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 886s > # Subsetted tests 886s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 886s > source("utils/validateIndicesFramework.R") 886s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 886s > dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 886s > probs <- c(0, 0.25, 0.75, 1) 886s > # Test with and without dimnames on x 886s > for (setDimnames in c(TRUE, FALSE)) { 886s + if (setDimnames) dimnames(x) <- dimnames 886s + else dimnames(x) <- NULL 886s + 886s + count <- 0L 886s + for (rows in index_cases) { 886s + for (cols in index_cases) { 886s + count <- count + 1L 886s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 886s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 886s + useNames <- useNames[count %% length(useNames) + 1] 886s + 886s + validateIndicesTestMatrix(x, rows, cols, 886s + ftest = rowQuantiles, fsure = rowQuantiles_R, 886s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 886s + validateIndicesTestMatrix(x, rows, cols, 886s + fcoltest = colQuantiles, fsure = rowQuantiles_R, 886s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 886s + } 886s + } 886s + } 892s > 892s > 893s 893s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 893s Copyright (C) 2024 The R Foundation for Statistical Computing 893s Platform: aarch64-unknown-linux-gnu (64-bit) 893s 893s R is free software and comes with ABSOLUTELY NO WARRANTY. 893s You are welcome to redistribute it under certain conditions. 893s Type 'license()' or 'licence()' for distribution details. 893s 893s R is a collaborative project with many contributors. 893s Type 'contributors()' for more information and 893s 'citation()' on how to cite R or R packages in publications. 893s 893s Type 'demo()' for some demos, 'help()' for on-line help, or 893s 'help.start()' for an HTML browser interface to help. 893s Type 'q()' to quit R. 893s 893s > library("matrixStats") 893s > 893s > rowMins_R <- function(x, ..., useNames = NA) { 893s + suppressWarnings({ 893s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 893s + }) 893s + if (is.na(useNames) || !useNames) names(res) <- NULL 893s + res 893s + } # rowMins_R() 893s > 893s > rowMaxs_R <- function(x, ..., useNames = NA) { 893s + suppressWarnings({ 893s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 893s + }) 893s + if (is.na(useNames) || !useNames) names(res) <- NULL 893s + res 893s + } # rowMaxs_R() 893s > 893s > rowRanges_R <- function(x, ..., useNames = NA) { 893s + suppressWarnings({ 893s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 893s + }) 893s + 893s + # Preserve rownames attribute 893s + dim <- c(dim(x)[1], 2L) 893s + if (!isTRUE(all.equal(dim(ans), dim))) { 893s + dim(ans) <- dim 893s + rownames <- rownames(x) 893s + if (!is.null(dimnames)) rownames(ans) <- rownames 893s + } 893s + if (is.na(useNames) || !useNames) dimnames(ans) <- NULL 893s + ans 893s + } # rowRanges_R() 893s > 893s > 893s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 893s > # With and without some NAs 893s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 893s > for (mode in c("integer", "double")) { 893s + cat("mode: ", mode, "\n", sep = "") 893s + 893s + for (add_na in c(FALSE, TRUE)) { 893s + cat("add_na = ", add_na, "\n", sep = "") 893s + 893s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 893s + if (add_na) { 893s + x[3:7, c(2, 4)] <- NA_real_ 893s + } 893s + storage.mode(x) <- mode 893s + str(x) 893s + 893s + # To check names attribute 893s + dimnames <- list(letters[1:10], LETTERS[1:5]) 893s + 893s + # Test with and without dimnames on x 893s + for (setDimnames in c(TRUE, FALSE)) { 893s + if (setDimnames) dimnames(x) <- dimnames 893s + else dimnames(x) <- NULL 893s + # Row/column extremes 893s + for (na.rm in c(FALSE, TRUE)) { 893s + # Check names attribute 893s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 893s + cat("na.rm = ", na.rm, "\n", sep = "") 893s + 893s + # Ranges 893s + cat("range:\n") 893s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 893s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 893s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 893s + stopifnot(all.equal(r1, r2)) 893s + stopifnot(all.equal(r1, r0)) 893s + 893s + # Min 893s + cat("min:\n") 893s + m0 <- rowMins_R(x, na.rm = na.rm, useNames = useNames) 893s + m1 <- rowMins(x, na.rm = na.rm, useNames = useNames) 893s + m2 <- colMins(t(x), na.rm = na.rm, useNames = useNames) 893s + stopifnot(all.equal(m1, m2)) 893s + stopifnot(all.equal(m1, m0)) 893s + 893s + # Max 893s + cat("max:\n") 893s + m0 <- rowMaxs_R(x, na.rm = na.rm, useNames = useNames) 893s + m1 <- rowMaxs(x, na.rm = na.rm, useNames = useNames) 893s + m2 <- colMaxs(t(x), na.rm = na.rm, useNames = useNames) 893s + stopifnot(all.equal(m1, m2)) 893s + stopifnot(all.equal(m1, m0)) 893s + } 893s + } 893s + } 893s + } # for (add_na ...) 893s + } # for (mode ...) 893s mode: integer 893s add_na = FALSE 893s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 893s na.rm = FALSE 893s range: 893s min: 893s max: 893s na.rm = FALSE 893s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s add_na = TRUE 894s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s mode: double 894s add_na = FALSE 894s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s add_na = TRUE 894s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = FALSE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s na.rm = TRUE 894s range: 894s min: 894s max: 894s > 894s > 894s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 894s > # All NAs 894s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 894s > for (mode in c("integer", "double")) { 894s + cat("mode: ", mode, "\n", sep = "") 894s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 894s + storage.mode(x) <- mode 894s + str(x) 894s + 894s + # Test with and without dimnames on x 894s + for (setDimnames in c(TRUE, FALSE)) { 894s + if (setDimnames) dimnames(x) <- dimnames 894s + else dimnames(x) <- NULL 894s + for (na.rm in c(FALSE, TRUE)) { 894s + # Check names attribute 894s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 894s + cat("na.rm = ", na.rm, "\n", sep = "") 894s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 894s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 894s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 894s + stopifnot(all.equal(r1, r2)) 894s + stopifnot(all.equal(r1, r0)) 894s + } 894s + } 894s + } 894s + } # for (mode ...) 894s mode: integer 894s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 894s na.rm = FALSE 894s na.rm = FALSE 894s na.rm = TRUE 894s na.rm = TRUE 894s na.rm = FALSE 894s na.rm = FALSE 894s na.rm = TRUE 894s na.rm = TRUE 894s mode: double 894s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 894s na.rm = FALSE 894s na.rm = FALSE 894s na.rm = TRUE 894s na.rm = TRUE 894s na.rm = FALSE 894s na.rm = FALSE 894s na.rm = TRUE 894s na.rm = TRUE 894s > 894s > 894s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 894s > # Special cases 894s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 894s > # Nx0 matrix 894s > x <- matrix(double(0L), nrow = 5L, ncol = 0L) 894s > r0 <- rowRanges_R(x) 894s > #r1 <- rowRanges(x) 894s > #r_truth <- matrix(c(Inf, -Inf), nrow = nrow(x), ncol = 2L, byrow = TRUE) 894s > #stopifnot(all.equal(r1, r_truth)) 894s > 894s > # 0xN matrix 894s > x <- t(x) 894s > #r1 <- colRanges(x) 894s > #stopifnot(all.equal(r1, r_truth)) 894s > 894s > # Nx1 matrix 894s > x <- matrix(1:5, nrow = 5L, ncol = 1L) 894s > # To check names attribute 894s > dimnames <- list(letters[1:5], "A") 894s > r1 <- rowRanges(x) 894s > r_truth <- matrix(1:5, nrow = nrow(x), ncol = 2L, byrow = FALSE) 894s > stopifnot(all.equal(r1, r_truth)) 894s > # Check names attribute 894s > dimnames(x) <- dimnames 894s > r0 <- rowRanges_R(x, useNames = TRUE) 894s > r1 <- rowRanges(x, useNames = TRUE) 894s > stopifnot(all.equal(r1, r0)) 894s > dimnames(x) <- NULL 894s > 894s > # 1xN matrix 894s > x <- t(x) 894s > r1 <- colRanges(x) 894s > stopifnot(all.equal(r1, r_truth)) 894s > # Check names attribute 894s > dimnames(x) <- list("a", LETTERS[1:5]) 894s > r1 <- colRanges(x, useNames = TRUE) 894s > stopifnot(identical(rownames(r1), colnames(x))) 894s > 894s > 894s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 894s > # Additional tests with NA_integer_, NA_real, NaN, -Inf, +Inf 894s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 894s > x <- matrix(1:12, nrow = 4L, ncol = 3L) 894s > 894s > na_list <- list( 894s + "integer" = matrix(1:12, nrow = 4L, ncol = 3L), 894s + "integer w/ NA" = matrix(NA_integer_, nrow = 4L, ncol = 3L), 894s + "real" = matrix(as.double(1:12), nrow = 4L, ncol = 3L), 894s + "real w/ NA" = matrix(NA_real_, nrow = 4L, ncol = 3L) 894s + ) 894s > 894s > na <- na_list[["real"]] 894s > na[2, 2] <- NA 894s > na_list[["real + NA cell"]] <- na 894s > 894s > na <- na_list[["real"]] 894s > na[2, ] <- NA 894s > na_list[["real + NA row"]] <- na 894s > 894s > na <- na_list[["real"]] 894s > na[2, ] <- NaN 894s > na_list[["real + NaN row"]] <- na 894s > 894s > na <- na_list[["real"]] 894s > na[2, 2] <- Inf 894s > na_list[["real + Inf cell"]] <- na 894s > 894s > na <- na_list[["real"]] 894s > na[2, ] <- Inf 894s > na_list[["real + Inf row"]] <- na 894s > 894s > na <- na_list[["real"]] 894s > na[2, 2] <- NaN 894s > na_list[["real + NaN cell"]] <- na 894s > 894s > na <- na_list[["real w/ NA"]] 894s > na[2, 2] <- NaN 894s > na_list[["real w/ NA + NaN cell"]] <- na 894s > 894s > na <- na_list[["real w/ NA"]] 894s > na[2, ] <- NaN 894s > na_list[["real w/ NA + NaN row"]] <- na 894s > 894s > # To check names attribute 894s > dimnames <- list(letters[1:4], LETTERS[1:3]) 894s > 894s > # Test with and without dimnames on x 894s > for (setDimnames in c(TRUE, FALSE)) { 894s + if (setDimnames) dimnames(x) <- dimnames 894s + else dimnames(x) <- NULL 894s + for (na.rm in c(FALSE, TRUE)) { 894s + for (name in names(na_list)) { 894s + # Check names attribute 894s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 894s + na <- na_list[[name]] 894s + cat(sprintf("%s (%s) w/ na.rm = %s:\n", name, typeof(na), na.rm)) 894s + print(na) 894s + 894s + cat(" min:\n") 894s + y0 <- rowMins_R(na, na.rm = na.rm, useNames = useNames) 894s + str(y0) 894s + y1 <- rowMins(na, na.rm = na.rm, useNames = useNames) 894s + str(y1) 894s + stopifnot(all.equal(y1, y0)) 894s + y1c <- colMins(t(na), na.rm = na.rm, useNames = useNames) 894s + str(y1c) 894s + stopifnot(all.equal(y1c, y1)) 894s + 894s + cat(" max:\n") 894s + y0 <- rowMaxs_R(na, na.rm = na.rm, useNames = useNames) 894s + str(y0) 894s + y1 <- rowMaxs(na, na.rm = na.rm, useNames = useNames) 894s + str(y1) 894s + stopifnot(all.equal(y1, y0)) 894s + y1c <- colMaxs(t(na), na.rm = na.rm, useNames = useNames) 894s + str(y1c) 894s + stopifnot(all.equal(y1c, y1)) 894s + 894s + cat(" range:\n") 894s + y0 <- rowRanges_R(na, na.rm = na.rm, useNames = useNames) 894s + str(y0) 894s + y1 <- rowRanges(na, na.rm = na.rm, useNames = useNames) 894s + str(y1) 894s + stopifnot(all.equal(y1, y0)) 894s + y1c <- colRanges(t(na), na.rm = na.rm, useNames = useNames) 894s + str(y1c) 894s + stopifnot(all.equal(y1c, y1)) 894s + } 894s + } # for (name ...) 894s + } # for (na.rm ...) 894s + } 894s integer (integer) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] 1 5 9 894s [2,] 2 6 10 894s [3,] 3 7 11 894s [4,] 4 8 12 894s min: 894s int [1:4] 1 2 3 4 894s int [1:4] 1 2 3 4 894s int [1:4] 1 2 3 4 894s max: 894s int [1:4] 9 10 11 12 894s int [1:4] 9 10 11 12 894s int [1:4] 9 10 11 12 894s range: 894s int [1:4, 1:2] 1 2 3 4 9 10 11 12 894s int [1:4, 1:2] 1 2 3 4 9 10 11 12 894s int [1:4, 1:2] 1 2 3 4 9 10 11 12 894s integer (integer) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] 1 5 9 894s [2,] 2 6 10 894s [3,] 3 7 11 894s [4,] 4 8 12 894s min: 894s int [1:4] 1 2 3 4 894s int [1:4] 1 2 3 4 894s int [1:4] 1 2 3 4 894s max: 894s int [1:4] 9 10 11 12 894s int [1:4] 9 10 11 12 894s int [1:4] 9 10 11 12 894s range: 894s int [1:4, 1:2] 1 2 3 4 9 10 11 12 894s int [1:4, 1:2] 1 2 3 4 9 10 11 12 894s int [1:4, 1:2] 1 2 3 4 9 10 11 12 894s integer w/ NA (integer) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] NA NA NA 894s [2,] NA NA NA 894s [3,] NA NA NA 894s [4,] NA NA NA 894s min: 894s int [1:4] NA NA NA NA 894s int [1:4] NA NA NA NA 894s int [1:4] NA NA NA NA 894s max: 894s int [1:4] NA NA NA NA 894s int [1:4] NA NA NA NA 894s int [1:4] NA NA NA NA 894s range: 894s int [1:4, 1:2] NA NA NA NA NA NA NA NA 894s int [1:4, 1:2] NA NA NA NA NA NA NA NA 894s int [1:4, 1:2] NA NA NA NA NA NA NA NA 894s integer w/ NA (integer) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] NA NA NA 894s [2,] NA NA NA 894s [3,] NA NA NA 894s [4,] NA NA NA 894s min: 894s int [1:4] NA NA NA NA 894s int [1:4] NA NA NA NA 894s int [1:4] NA NA NA NA 894s max: 894s int [1:4] NA NA NA NA 894s int [1:4] NA NA NA NA 894s int [1:4] NA NA NA NA 894s range: 894s int [1:4, 1:2] NA NA NA NA NA NA NA NA 894s int [1:4, 1:2] NA NA NA NA NA NA NA NA 894s int [1:4, 1:2] NA NA NA NA NA NA NA NA 894s real (double) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] 1 5 9 894s [2,] 2 6 10 894s [3,] 3 7 11 894s [4,] 4 8 12 894s min: 894s num [1:4] 1 2 3 4 894s num [1:4] 1 2 3 4 894s num [1:4] 1 2 3 4 894s max: 894s num [1:4] 9 10 11 12 894s num [1:4] 9 10 11 12 894s num [1:4] 9 10 11 12 894s range: 894s num [1:4, 1:2] 1 2 3 4 9 10 11 12 894s num [1:4, 1:2] 1 2 3 4 9 10 11 12 894s num [1:4, 1:2] 1 2 3 4 9 10 11 12 894s real (double) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] 1 5 9 894s [2,] 2 6 10 894s [3,] 3 7 11 894s [4,] 4 8 12 894s min: 894s num [1:4] 1 2 3 4 894s num [1:4] 1 2 3 4 894s num [1:4] 1 2 3 4 894s max: 894s num [1:4] 9 10 11 12 894s num [1:4] 9 10 11 12 894s num [1:4] 9 10 11 12 894s range: 894s num [1:4, 1:2] 1 2 3 4 9 10 11 12 894s num [1:4, 1:2] 1 2 3 4 9 10 11 12 894s num [1:4, 1:2] 1 2 3 4 9 10 11 12 894s real w/ NA (double) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] NA NA NA 894s [2,] NA NA NA 894s [3,] NA NA NA 894s [4,] NA NA NA 894s min: 894s num [1:4] NA NA NA NA 894s num [1:4] NA NA NA NA 894s num [1:4] NA NA NA NA 894s max: 894s num [1:4] NA NA NA NA 894s num [1:4] NA NA NA NA 894s num [1:4] NA NA NA NA 894s range: 894s num [1:4, 1:2] NA NA NA NA NA NA NA NA 894s num [1:4, 1:2] NA NA NA NA NA NA NA NA 894s num [1:4, 1:2] NA NA NA NA NA NA NA NA 894s real w/ NA (double) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] NA NA NA 894s [2,] NA NA NA 894s [3,] NA NA NA 894s [4,] NA NA NA 894s min: 894s num [1:4] NA NA NA NA 894s num [1:4] NA NA NA NA 894s num [1:4] NA NA NA NA 894s max: 894s num [1:4] NA NA NA NA 894s num [1:4] NA NA NA NA 894s num [1:4] NA NA NA NA 894s range: 894s num [1:4, 1:2] NA NA NA NA NA NA NA NA 894s num [1:4, 1:2] NA NA NA NA NA NA NA NA 894s num [1:4, 1:2] NA NA NA NA NA NA NA NA 894s real + NA cell (double) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] 1 5 9 894s [2,] 2 NA 10 894s [3,] 3 7 11 894s [4,] 4 8 12 894s min: 894s num [1:4] 1 NA 3 4 894s num [1:4] 1 NA 3 4 894s num [1:4] 1 NA 3 4 894s max: 894s num [1:4] 9 NA 11 12 894s num [1:4] 9 NA 11 12 894s num [1:4] 9 NA 11 12 894s range: 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 894s real + NA cell (double) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] 1 5 9 894s [2,] 2 NA 10 894s [3,] 3 7 11 894s [4,] 4 8 12 894s min: 894s num [1:4] 1 NA 3 4 894s num [1:4] 1 NA 3 4 894s num [1:4] 1 NA 3 4 894s max: 894s num [1:4] 9 NA 11 12 894s num [1:4] 9 NA 11 12 894s num [1:4] 9 NA 11 12 894s range: 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 894s real + NA row (double) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] 1 5 9 894s [2,] NA NA NA 894s [3,] 3 7 11 894s [4,] 4 8 12 894s min: 894s num [1:4] 1 NA 3 4 894s num [1:4] 1 NA 3 4 894s num [1:4] 1 NA 3 4 894s max: 894s num [1:4] 9 NA 11 12 894s num [1:4] 9 NA 11 12 894s num [1:4] 9 NA 11 12 894s range: 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 894s real + NA row (double) w/ na.rm = FALSE: 894s [,1] [,2] [,3] 894s [1,] 1 5 9 894s [2,] NA NA NA 894s [3,] 3 7 11 894s [4,] 4 8 12 894s min: 894s num [1:4] 1 NA 3 4 894s num [1:4] 1 NA 3 4 894s num [1:4] 1 NA 3 4 894s max: 894s num [1:4] 9 NA 11 12 894s num [1:4] 9 NA 11 12 894s num [1:4] 9 NA 11 12 894s range: 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 894s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 895s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 895s real + NaN row (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] NaN NaN NaN 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 NaN 3 4 895s num [1:4] 1 NaN 3 4 895s num [1:4] 1 NaN 3 4 895s max: 895s num [1:4] 9 NaN 11 12 895s num [1:4] 9 NaN 11 12 895s num [1:4] 9 NaN 11 12 895s range: 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s real + NaN row (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] NaN NaN NaN 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 NaN 3 4 895s num [1:4] 1 NaN 3 4 895s num [1:4] 1 NaN 3 4 895s max: 895s num [1:4] 9 NaN 11 12 895s num [1:4] 9 NaN 11 12 895s num [1:4] 9 NaN 11 12 895s range: 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s real + Inf cell (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 Inf 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s max: 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s range: 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s real + Inf cell (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 Inf 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s max: 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s range: 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s real + Inf row (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] Inf Inf Inf 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s max: 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s range: 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s real + Inf row (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] Inf Inf Inf 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s max: 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s range: 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s real + NaN cell (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 NaN 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 NaN 3 4 895s num [1:4] 1 NaN 3 4 895s num [1:4] 1 NaN 3 4 895s max: 895s num [1:4] 9 NaN 11 12 895s num [1:4] 9 NaN 11 12 895s num [1:4] 9 NaN 11 12 895s range: 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s real + NaN cell (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 NaN 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 NaN 3 4 895s num [1:4] 1 NaN 3 4 895s num [1:4] 1 NaN 3 4 895s max: 895s num [1:4] 9 NaN 11 12 895s num [1:4] 9 NaN 11 12 895s num [1:4] 9 NaN 11 12 895s range: 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 895s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] NA NA NA 895s [2,] NA NaN NA 895s [3,] NA NA NA 895s [4,] NA NA NA 895s min: 895s num [1:4] NA NA NA NA 895s num [1:4] NA NA NA NA 895s num [1:4] NA NA NA NA 895s max: 895s num [1:4] NA NA NA NA 895s num [1:4] NA NA NA NA 895s num [1:4] NA NA NA NA 895s range: 895s num [1:4, 1:2] NA NA NA NA NA NA NA NA 895s num [1:4, 1:2] NA NA NA NA NA NA NA NA 895s num [1:4, 1:2] NA NA NA NA NA NA NA NA 895s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] NA NA NA 895s [2,] NA NaN NA 895s [3,] NA NA NA 895s [4,] NA NA NA 895s min: 895s num [1:4] NA NA NA NA 895s num [1:4] NA NA NA NA 895s num [1:4] NA NA NA NA 895s max: 895s num [1:4] NA NA NA NA 895s num [1:4] NA NA NA NA 895s num [1:4] NA NA NA NA 895s range: 895s num [1:4, 1:2] NA NA NA NA NA NA NA NA 895s num [1:4, 1:2] NA NA NA NA NA NA NA NA 895s num [1:4, 1:2] NA NA NA NA NA NA NA NA 895s real w/ NA + NaN row (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] NA NA NA 895s [2,] NaN NaN NaN 895s [3,] NA NA NA 895s [4,] NA NA NA 895s min: 895s num [1:4] NA NaN NA NA 895s num [1:4] NA NaN NA NA 895s num [1:4] NA NaN NA NA 895s max: 895s num [1:4] NA NaN NA NA 895s num [1:4] NA NaN NA NA 895s num [1:4] NA NaN NA NA 895s range: 895s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 895s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 895s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 895s real w/ NA + NaN row (double) w/ na.rm = FALSE: 895s [,1] [,2] [,3] 895s [1,] NA NA NA 895s [2,] NaN NaN NaN 895s [3,] NA NA NA 895s [4,] NA NA NA 895s min: 895s num [1:4] NA NaN NA NA 895s num [1:4] NA NaN NA NA 895s num [1:4] NA NaN NA NA 895s max: 895s num [1:4] NA NaN NA NA 895s num [1:4] NA NaN NA NA 895s num [1:4] NA NaN NA NA 895s range: 895s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 895s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 895s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 895s integer (integer) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 6 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s int [1:4] 1 2 3 4 895s int [1:4] 1 2 3 4 895s int [1:4] 1 2 3 4 895s max: 895s int [1:4] 9 10 11 12 895s int [1:4] 9 10 11 12 895s int [1:4] 9 10 11 12 895s range: 895s int [1:4, 1:2] 1 2 3 4 9 10 11 12 895s int [1:4, 1:2] 1 2 3 4 9 10 11 12 895s int [1:4, 1:2] 1 2 3 4 9 10 11 12 895s integer (integer) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 6 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s int [1:4] 1 2 3 4 895s int [1:4] 1 2 3 4 895s int [1:4] 1 2 3 4 895s max: 895s int [1:4] 9 10 11 12 895s int [1:4] 9 10 11 12 895s int [1:4] 9 10 11 12 895s range: 895s int [1:4, 1:2] 1 2 3 4 9 10 11 12 895s int [1:4, 1:2] 1 2 3 4 9 10 11 12 895s int [1:4, 1:2] 1 2 3 4 9 10 11 12 895s integer w/ NA (integer) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] NA NA NA 895s [2,] NA NA NA 895s [3,] NA NA NA 895s [4,] NA NA NA 895s min: 895s num [1:4] Inf Inf Inf Inf 895s num [1:4] Inf Inf Inf Inf 895s num [1:4] Inf Inf Inf Inf 895s max: 895s num [1:4] -Inf -Inf -Inf -Inf 895s num [1:4] -Inf -Inf -Inf -Inf 895s num [1:4] -Inf -Inf -Inf -Inf 895s range: 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s integer w/ NA (integer) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] NA NA NA 895s [2,] NA NA NA 895s [3,] NA NA NA 895s [4,] NA NA NA 895s min: 895s num [1:4] Inf Inf Inf Inf 895s num [1:4] Inf Inf Inf Inf 895s num [1:4] Inf Inf Inf Inf 895s max: 895s num [1:4] -Inf -Inf -Inf -Inf 895s num [1:4] -Inf -Inf -Inf -Inf 895s num [1:4] -Inf -Inf -Inf -Inf 895s range: 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s real (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 6 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s max: 895s num [1:4] 9 10 11 12 895s num [1:4] 9 10 11 12 895s num [1:4] 9 10 11 12 895s range: 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s real (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 6 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s max: 895s num [1:4] 9 10 11 12 895s num [1:4] 9 10 11 12 895s num [1:4] 9 10 11 12 895s range: 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s real w/ NA (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] NA NA NA 895s [2,] NA NA NA 895s [3,] NA NA NA 895s [4,] NA NA NA 895s min: 895s num [1:4] Inf Inf Inf Inf 895s num [1:4] Inf Inf Inf Inf 895s num [1:4] Inf Inf Inf Inf 895s max: 895s num [1:4] -Inf -Inf -Inf -Inf 895s num [1:4] -Inf -Inf -Inf -Inf 895s num [1:4] -Inf -Inf -Inf -Inf 895s range: 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s real w/ NA (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] NA NA NA 895s [2,] NA NA NA 895s [3,] NA NA NA 895s [4,] NA NA NA 895s min: 895s num [1:4] Inf Inf Inf Inf 895s num [1:4] Inf Inf Inf Inf 895s num [1:4] Inf Inf Inf Inf 895s max: 895s num [1:4] -Inf -Inf -Inf -Inf 895s num [1:4] -Inf -Inf -Inf -Inf 895s num [1:4] -Inf -Inf -Inf -Inf 895s range: 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 895s real + NA cell (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 NA 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s max: 895s num [1:4] 9 10 11 12 895s num [1:4] 9 10 11 12 895s num [1:4] 9 10 11 12 895s range: 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s real + NA cell (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 NA 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s max: 895s num [1:4] 9 10 11 12 895s num [1:4] 9 10 11 12 895s num [1:4] 9 10 11 12 895s range: 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s num [1:4, 1:2] 1 2 3 4 9 10 11 12 895s real + NA row (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] NA NA NA 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s max: 895s num [1:4] 9 -Inf 11 12 895s num [1:4] 9 -Inf 11 12 895s num [1:4] 9 -Inf 11 12 895s range: 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s real + NA row (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] NA NA NA 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s max: 895s num [1:4] 9 -Inf 11 12 895s num [1:4] 9 -Inf 11 12 895s num [1:4] 9 -Inf 11 12 895s range: 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s real + NaN row (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] NaN NaN NaN 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s max: 895s num [1:4] 9 -Inf 11 12 895s num [1:4] 9 -Inf 11 12 895s num [1:4] 9 -Inf 11 12 895s range: 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s real + NaN row (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] NaN NaN NaN 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s max: 895s num [1:4] 9 -Inf 11 12 895s num [1:4] 9 -Inf 11 12 895s num [1:4] 9 -Inf 11 12 895s range: 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s real + Inf cell (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 Inf 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s max: 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s range: 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s real + Inf cell (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 Inf 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s max: 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s range: 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s num [1:4, 1:2] 1 2 3 4 9 ... 895s real + Inf row (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] Inf Inf Inf 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s max: 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s range: 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s real + Inf row (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] Inf Inf Inf 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s num [1:4] 1 Inf 3 4 895s max: 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s num [1:4] 9 Inf 11 12 895s range: 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s num [1:4, 1:2] 1 Inf 3 4 9 ... 895s real + NaN cell (double) w/ na.rm = TRUE: 895s [,1] [,2] [,3] 895s [1,] 1 5 9 895s [2,] 2 NaN 10 895s [3,] 3 7 11 895s [4,] 4 8 12 895s min: 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s num [1:4] 1 2 3 4 895s max: 895s num [1:4] 9 10 11 12 895s num [1:4] 9 10 11 12 896s num [1:4] 9 10 11 12 896s range: 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s real + NaN cell (double) w/ na.rm = TRUE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 NaN 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 2 3 4 896s num [1:4] 1 2 3 4 896s num [1:4] 1 2 3 4 896s max: 896s num [1:4] 9 10 11 12 896s num [1:4] 9 10 11 12 896s num [1:4] 9 10 11 12 896s range: 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NA NaN NA 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] Inf Inf Inf Inf 896s num [1:4] Inf Inf Inf Inf 896s num [1:4] Inf Inf Inf Inf 896s max: 896s num [1:4] -Inf -Inf -Inf -Inf 896s num [1:4] -Inf -Inf -Inf -Inf 896s num [1:4] -Inf -Inf -Inf -Inf 896s range: 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NA NaN NA 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] Inf Inf Inf Inf 896s num [1:4] Inf Inf Inf Inf 896s num [1:4] Inf Inf Inf Inf 896s max: 896s num [1:4] -Inf -Inf -Inf -Inf 896s num [1:4] -Inf -Inf -Inf -Inf 896s num [1:4] -Inf -Inf -Inf -Inf 896s range: 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s real w/ NA + NaN row (double) w/ na.rm = TRUE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NaN NaN NaN 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] Inf Inf Inf Inf 896s num [1:4] Inf Inf Inf Inf 896s num [1:4] Inf Inf Inf Inf 896s max: 896s num [1:4] -Inf -Inf -Inf -Inf 896s num [1:4] -Inf -Inf -Inf -Inf 896s num [1:4] -Inf -Inf -Inf -Inf 896s range: 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s real w/ NA + NaN row (double) w/ na.rm = TRUE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NaN NaN NaN 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] Inf Inf Inf Inf 896s num [1:4] Inf Inf Inf Inf 896s num [1:4] Inf Inf Inf Inf 896s max: 896s num [1:4] -Inf -Inf -Inf -Inf 896s num [1:4] -Inf -Inf -Inf -Inf 896s num [1:4] -Inf -Inf -Inf -Inf 896s range: 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 896s integer (integer) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 6 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s int [1:4] 1 2 3 4 896s int [1:4] 1 2 3 4 896s int [1:4] 1 2 3 4 896s max: 896s int [1:4] 9 10 11 12 896s int [1:4] 9 10 11 12 896s int [1:4] 9 10 11 12 896s range: 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s integer (integer) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 6 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s int [1:4] 1 2 3 4 896s int [1:4] 1 2 3 4 896s int [1:4] 1 2 3 4 896s max: 896s int [1:4] 9 10 11 12 896s int [1:4] 9 10 11 12 896s int [1:4] 9 10 11 12 896s range: 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s integer w/ NA (integer) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NA NA NA 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s int [1:4] NA NA NA NA 896s int [1:4] NA NA NA NA 896s int [1:4] NA NA NA NA 896s max: 896s int [1:4] NA NA NA NA 896s int [1:4] NA NA NA NA 896s int [1:4] NA NA NA NA 896s range: 896s int [1:4, 1:2] NA NA NA NA NA NA NA NA 896s int [1:4, 1:2] NA NA NA NA NA NA NA NA 896s int [1:4, 1:2] NA NA NA NA NA NA NA NA 896s integer w/ NA (integer) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NA NA NA 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s int [1:4] NA NA NA NA 896s int [1:4] NA NA NA NA 896s int [1:4] NA NA NA NA 896s max: 896s int [1:4] NA NA NA NA 896s int [1:4] NA NA NA NA 896s int [1:4] NA NA NA NA 896s range: 896s int [1:4, 1:2] NA NA NA NA NA NA NA NA 896s int [1:4, 1:2] NA NA NA NA NA NA NA NA 896s int [1:4, 1:2] NA NA NA NA NA NA NA NA 896s real (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 6 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 2 3 4 896s num [1:4] 1 2 3 4 896s num [1:4] 1 2 3 4 896s max: 896s num [1:4] 9 10 11 12 896s num [1:4] 9 10 11 12 896s num [1:4] 9 10 11 12 896s range: 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s real (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 6 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 2 3 4 896s num [1:4] 1 2 3 4 896s num [1:4] 1 2 3 4 896s max: 896s num [1:4] 9 10 11 12 896s num [1:4] 9 10 11 12 896s num [1:4] 9 10 11 12 896s range: 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s num [1:4, 1:2] 1 2 3 4 9 10 11 12 896s real w/ NA (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NA NA NA 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s max: 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s range: 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s real w/ NA (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NA NA NA 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s max: 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s range: 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s real + NA cell (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 NA 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 NA 3 4 896s num [1:4] 1 NA 3 4 896s num [1:4] 1 NA 3 4 896s max: 896s num [1:4] 9 NA 11 12 896s num [1:4] 9 NA 11 12 896s num [1:4] 9 NA 11 12 896s range: 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s real + NA cell (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 NA 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 NA 3 4 896s num [1:4] 1 NA 3 4 896s num [1:4] 1 NA 3 4 896s max: 896s num [1:4] 9 NA 11 12 896s num [1:4] 9 NA 11 12 896s num [1:4] 9 NA 11 12 896s range: 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s real + NA row (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] NA NA NA 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 NA 3 4 896s num [1:4] 1 NA 3 4 896s num [1:4] 1 NA 3 4 896s max: 896s num [1:4] 9 NA 11 12 896s num [1:4] 9 NA 11 12 896s num [1:4] 9 NA 11 12 896s range: 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s real + NA row (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] NA NA NA 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 NA 3 4 896s num [1:4] 1 NA 3 4 896s num [1:4] 1 NA 3 4 896s max: 896s num [1:4] 9 NA 11 12 896s num [1:4] 9 NA 11 12 896s num [1:4] 9 NA 11 12 896s range: 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 896s real + NaN row (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] NaN NaN NaN 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 NaN 3 4 896s num [1:4] 1 NaN 3 4 896s num [1:4] 1 NaN 3 4 896s max: 896s num [1:4] 9 NaN 11 12 896s num [1:4] 9 NaN 11 12 896s num [1:4] 9 NaN 11 12 896s range: 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s real + NaN row (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] NaN NaN NaN 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 NaN 3 4 896s num [1:4] 1 NaN 3 4 896s num [1:4] 1 NaN 3 4 896s max: 896s num [1:4] 9 NaN 11 12 896s num [1:4] 9 NaN 11 12 896s num [1:4] 9 NaN 11 12 896s range: 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s real + Inf cell (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 Inf 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 2 3 4 896s num [1:4] 1 2 3 4 896s num [1:4] 1 2 3 4 896s max: 896s num [1:4] 9 Inf 11 12 896s num [1:4] 9 Inf 11 12 896s num [1:4] 9 Inf 11 12 896s range: 896s num [1:4, 1:2] 1 2 3 4 9 ... 896s num [1:4, 1:2] 1 2 3 4 9 ... 896s num [1:4, 1:2] 1 2 3 4 9 ... 896s real + Inf cell (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 Inf 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 2 3 4 896s num [1:4] 1 2 3 4 896s num [1:4] 1 2 3 4 896s max: 896s num [1:4] 9 Inf 11 12 896s num [1:4] 9 Inf 11 12 896s num [1:4] 9 Inf 11 12 896s range: 896s num [1:4, 1:2] 1 2 3 4 9 ... 896s num [1:4, 1:2] 1 2 3 4 9 ... 896s num [1:4, 1:2] 1 2 3 4 9 ... 896s real + Inf row (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] Inf Inf Inf 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 Inf 3 4 896s num [1:4] 1 Inf 3 4 896s num [1:4] 1 Inf 3 4 896s max: 896s num [1:4] 9 Inf 11 12 896s num [1:4] 9 Inf 11 12 896s num [1:4] 9 Inf 11 12 896s range: 896s num [1:4, 1:2] 1 Inf 3 4 9 ... 896s num [1:4, 1:2] 1 Inf 3 4 9 ... 896s num [1:4, 1:2] 1 Inf 3 4 9 ... 896s real + Inf row (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] Inf Inf Inf 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 Inf 3 4 896s num [1:4] 1 Inf 3 4 896s num [1:4] 1 Inf 3 4 896s max: 896s num [1:4] 9 Inf 11 12 896s num [1:4] 9 Inf 11 12 896s num [1:4] 9 Inf 11 12 896s range: 896s num [1:4, 1:2] 1 Inf 3 4 9 ... 896s num [1:4, 1:2] 1 Inf 3 4 9 ... 896s num [1:4, 1:2] 1 Inf 3 4 9 ... 896s real + NaN cell (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 NaN 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 NaN 3 4 896s num [1:4] 1 NaN 3 4 896s num [1:4] 1 NaN 3 4 896s max: 896s num [1:4] 9 NaN 11 12 896s num [1:4] 9 NaN 11 12 896s num [1:4] 9 NaN 11 12 896s range: 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s real + NaN cell (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 NaN 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s num [1:4] 1 NaN 3 4 896s num [1:4] 1 NaN 3 4 896s num [1:4] 1 NaN 3 4 896s max: 896s num [1:4] 9 NaN 11 12 896s num [1:4] 9 NaN 11 12 896s num [1:4] 9 NaN 11 12 896s range: 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 896s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NA NaN NA 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s max: 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s range: 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NA NaN NA 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s max: 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s num [1:4] NA NA NA NA 896s range: 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s num [1:4, 1:2] NA NA NA NA NA NA NA NA 896s real w/ NA + NaN row (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NaN NaN NaN 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] NA NaN NA NA 896s num [1:4] NA NaN NA NA 896s num [1:4] NA NaN NA NA 896s max: 896s num [1:4] NA NaN NA NA 896s num [1:4] NA NaN NA NA 896s num [1:4] NA NaN NA NA 896s range: 896s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 896s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 896s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 896s real w/ NA + NaN row (double) w/ na.rm = FALSE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NaN NaN NaN 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] NA NaN NA NA 896s num [1:4] NA NaN NA NA 896s num [1:4] NA NaN NA NA 896s max: 896s num [1:4] NA NaN NA NA 896s num [1:4] NA NaN NA NA 896s num [1:4] NA NaN NA NA 896s range: 896s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 896s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 896s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 896s integer (integer) w/ na.rm = TRUE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 6 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s int [1:4] 1 2 3 4 896s int [1:4] 1 2 3 4 896s int [1:4] 1 2 3 4 896s max: 896s int [1:4] 9 10 11 12 896s int [1:4] 9 10 11 12 896s int [1:4] 9 10 11 12 896s range: 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s integer (integer) w/ na.rm = TRUE: 896s [,1] [,2] [,3] 896s [1,] 1 5 9 896s [2,] 2 6 10 896s [3,] 3 7 11 896s [4,] 4 8 12 896s min: 896s int [1:4] 1 2 3 4 896s int [1:4] 1 2 3 4 896s int [1:4] 1 2 3 4 896s max: 896s int [1:4] 9 10 11 12 896s int [1:4] 9 10 11 12 896s int [1:4] 9 10 11 12 896s range: 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s int [1:4, 1:2] 1 2 3 4 9 10 11 12 896s integer w/ NA (integer) w/ na.rm = TRUE: 896s [,1] [,2] [,3] 896s [1,] NA NA NA 896s [2,] NA NA NA 896s [3,] NA NA NA 896s [4,] NA NA NA 896s min: 896s num [1:4] Inf Inf Inf Inf 896s num [1:4] Inf Inf Inf Inf 896s num [1:4] Inf Inf Inf Inf 896s max: 896s num [1:4] -Inf -Inf -Inf -Inf 896s num [1:4] -Inf -Inf -Inf -Inf 896s num [1:4] -Inf -Inf -Inf -Inf 896s range: 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s integer w/ NA (integer) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] NA NA NA 897s [2,] NA NA NA 897s [3,] NA NA NA 897s [4,] NA NA NA 897s min: 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s max: 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s range: 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s real (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] 2 6 10 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s max: 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s range: 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s real (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] 2 6 10 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s max: 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s range: 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s real w/ NA (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] NA NA NA 897s [2,] NA NA NA 897s [3,] NA NA NA 897s [4,] NA NA NA 897s min: 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s max: 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s range: 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s real w/ NA (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] NA NA NA 897s [2,] NA NA NA 897s [3,] NA NA NA 897s [4,] NA NA NA 897s min: 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s max: 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s range: 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s real + NA cell (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] 2 NA 10 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s max: 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s range: 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s real + NA cell (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] 2 NA 10 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s max: 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s range: 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s real + NA row (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] NA NA NA 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s max: 897s num [1:4] 9 -Inf 11 12 897s num [1:4] 9 -Inf 11 12 897s num [1:4] 9 -Inf 11 12 897s range: 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s real + NA row (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] NA NA NA 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s max: 897s num [1:4] 9 -Inf 11 12 897s num [1:4] 9 -Inf 11 12 897s num [1:4] 9 -Inf 11 12 897s range: 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s real + NaN row (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] NaN NaN NaN 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s max: 897s num [1:4] 9 -Inf 11 12 897s num [1:4] 9 -Inf 11 12 897s num [1:4] 9 -Inf 11 12 897s range: 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s real + NaN row (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] NaN NaN NaN 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s max: 897s num [1:4] 9 -Inf 11 12 897s num [1:4] 9 -Inf 11 12 897s num [1:4] 9 -Inf 11 12 897s range: 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s real + Inf cell (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] 2 Inf 10 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s max: 897s num [1:4] 9 Inf 11 12 897s num [1:4] 9 Inf 11 12 897s num [1:4] 9 Inf 11 12 897s range: 897s num [1:4, 1:2] 1 2 3 4 9 ... 897s num [1:4, 1:2] 1 2 3 4 9 ... 897s num [1:4, 1:2] 1 2 3 4 9 ... 897s real + Inf cell (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] 2 Inf 10 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s max: 897s num [1:4] 9 Inf 11 12 897s num [1:4] 9 Inf 11 12 897s num [1:4] 9 Inf 11 12 897s range: 897s num [1:4, 1:2] 1 2 3 4 9 ... 897s num [1:4, 1:2] 1 2 3 4 9 ... 897s num [1:4, 1:2] 1 2 3 4 9 ... 897s real + Inf row (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] Inf Inf Inf 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s max: 897s num [1:4] 9 Inf 11 12 897s num [1:4] 9 Inf 11 12 897s num [1:4] 9 Inf 11 12 897s range: 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s real + Inf row (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] Inf Inf Inf 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s num [1:4] 1 Inf 3 4 897s max: 897s num [1:4] 9 Inf 11 12 897s num [1:4] 9 Inf 11 12 897s num [1:4] 9 Inf 11 12 897s range: 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s num [1:4, 1:2] 1 Inf 3 4 9 ... 897s real + NaN cell (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] 2 NaN 10 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s max: 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s range: 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s real + NaN cell (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] 1 5 9 897s [2,] 2 NaN 10 897s [3,] 3 7 11 897s [4,] 4 8 12 897s min: 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s num [1:4] 1 2 3 4 897s max: 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s num [1:4] 9 10 11 12 897s range: 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s num [1:4, 1:2] 1 2 3 4 9 10 11 12 897s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] NA NA NA 897s [2,] NA NaN NA 897s [3,] NA NA NA 897s [4,] NA NA NA 897s min: 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s max: 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s range: 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] NA NA NA 897s [2,] NA NaN NA 897s [3,] NA NA NA 897s [4,] NA NA NA 897s min: 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s max: 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s range: 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s real w/ NA + NaN row (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] NA NA NA 897s [2,] NaN NaN NaN 897s [3,] NA NA NA 897s [4,] NA NA NA 897s min: 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s max: 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s range: 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s real w/ NA + NaN row (double) w/ na.rm = TRUE: 897s [,1] [,2] [,3] 897s [1,] NA NA NA 897s [2,] NaN NaN NaN 897s [3,] NA NA NA 897s [4,] NA NA NA 897s min: 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s num [1:4] Inf Inf Inf Inf 897s max: 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s num [1:4] -Inf -Inf -Inf -Inf 897s range: 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 897s > 898s 898s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 898s Copyright (C) 2024 The R Foundation for Statistical Computing 898s Platform: aarch64-unknown-linux-gnu (64-bit) 898s 898s R is free software and comes with ABSOLUTELY NO WARRANTY. 898s You are welcome to redistribute it under certain conditions. 898s Type 'license()' or 'licence()' for distribution details. 898s 898s R is a collaborative project with many contributors. 898s Type 'contributors()' for more information and 898s 'citation()' on how to cite R or R packages in publications. 898s 898s Type 'demo()' for some demos, 'help()' for on-line help, or 898s 'help.start()' for an HTML browser interface to help. 898s Type 'q()' to quit R. 898s 898s > library("matrixStats") 898s > 898s > rowMins_R <- function(x, ..., useNames = NA) { 898s + suppressWarnings({ 898s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 898s + }) 898s + if (is.na(useNames) || !useNames) names(res) <- NULL 898s + res 898s + } # rowMins_R() 898s > 898s > rowMaxs_R <- function(x, ..., useNames = NA) { 898s + suppressWarnings({ 898s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 898s + }) 898s + if (is.na(useNames) || !useNames) names(res) <- NULL 898s + res 898s + } # rowMaxs_R() 898s > 898s > rowRanges_R <- function(x, ..., useNames = NA) { 898s + suppressWarnings({ 898s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 898s + }) 898s + 898s + # Preserve rownames attribute 898s + dim <- c(dim(x)[1], 2L) 898s + if (!isTRUE(all.equal(dim(ans), dim))) { 898s + dim(ans) <- dim 898s + rownames <- rownames(x) 898s + if (!is.null(dimnames)) rownames(ans) <- rownames 898s + } 898s + if (is.na(useNames) || !useNames) dimnames(ans) <- NULL 898s + ans 898s + } # rowRanges_R() 898s > 898s > 898s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 898s > # Subsetted tests 898s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 898s > source("utils/validateIndicesFramework.R") 898s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 898s > storage.mode(x) <- "integer" 898s > 898s > # To check rownames/names attributes 898s > dimnames <- list(letters[1:6], LETTERS[1:6]) 898s > 898s > # Test with and without dimnames on x 898s > for (setDimnames in c(TRUE, FALSE)) { 898s + if (setDimnames) dimnames(x) <- dimnames 898s + else dimnames(x) <- NULL 898s + 898s + count <- 0L 898s + for (rows in index_cases) { 898s + for (cols in index_cases) { 898s + count <- count + 1L 898s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 898s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 898s + useNames <- useNames[count %% length(useNames) + 1] 898s + 898s + validateIndicesTestMatrix(x, rows, cols, 898s + ftest = rowRanges, fsure = rowRanges_R, 898s + na.rm = na.rm, useNames = useNames) 898s + validateIndicesTestMatrix(x, rows, cols, 898s + ftest = rowMins, fsure = rowMins_R, 898s + na.rm = na.rm, useNames = useNames) 898s + validateIndicesTestMatrix(x, rows, cols, 898s + ftest = rowMaxs, fsure = rowMaxs_R, 898s + na.rm = na.rm, useNames = useNames) 898s + 898s + validateIndicesTestMatrix(x, rows, cols, 898s + fcoltest = colRanges, fsure = rowRanges_R, 898s + na.rm = na.rm, useNames = useNames) 898s + validateIndicesTestMatrix(x, rows, cols, 898s + fcoltest = colMins, fsure = rowMins_R, 898s + na.rm = na.rm, useNames = useNames) 898s + validateIndicesTestMatrix(x, rows, cols, 898s + fcoltest = colMaxs, fsure = rowMaxs_R, 898s + na.rm = na.rm, useNames = useNames) 898s + } 898s + } 898s + } 906s > 906s 906s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 906s Copyright (C) 2024 The R Foundation for Statistical Computing 906s Platform: aarch64-unknown-linux-gnu (64-bit) 906s 906s R is free software and comes with ABSOLUTELY NO WARRANTY. 906s You are welcome to redistribute it under certain conditions. 906s Type 'license()' or 'licence()' for distribution details. 906s 906s R is a collaborative project with many contributors. 906s Type 'contributors()' for more information and 906s 'citation()' on how to cite R or R packages in publications. 906s 906s Type 'demo()' for some demos, 'help()' for on-line help, or 906s 'help.start()' for an HTML browser interface to help. 906s Type 'q()' to quit R. 906s 907s > library("matrixStats") 907s > 907s > dense_rank <- function(x) match(x, table = sort(unique(x))) 907s > 907s > rowRanks_R <- function(x, ties.method, ..., useNames = NA) { 907s + if (ties.method == "dense") { 907s + res <- t(apply(x, MARGIN = 1L, FUN = dense_rank)) 907s + } else { 907s + res <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", ties.method = ties.method)) 907s + } 907s + 907s + # Preserve dimnames attribute? 907s + dim(res) <- dim(x) 907s + dimnames(res) <- if (isTRUE(useNames)) dimnames(x) else NULL 907s + 907s + res 907s + } 907s > 907s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = NA) { 907s + if (ties.method == "dense") { 907s + res <- t(apply(x, MARGIN = 2L, FUN = dense_rank)) 907s + } else { 907s + res <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 907s + } 907s + 907s + # Preserve dimnames attribute? 907s + tx <- t(x) 907s + dim(res) <- dim(tx) 907s + dimnames(res) <- if (isTRUE(useNames)) dimnames(tx) else NULL 907s + 907s + if (preserveShape) res <- t(res) 907s + res 907s + } 907s > 907s > set.seed(1) 907s > 907s > cat("Consistency checks:\n") 907s Consistency checks: 907s > xs <- vector("list", length = 4L) 907s > for (kk in 1:4) { 907s + 907s + # Simulate data in a matrix of any shape 907s + dim <- sample(40:80, size = 2L) 907s + n <- prod(dim) 907s + x <- rnorm(n, sd = 10) 907s + dim(x) <- dim 907s + 907s + # Add NAs? 907s + if ((kk %% 4) %in% c(3, 0)) { 907s + cat("Adding NAs\n") 907s + nna <- sample(n, size = 1L) 907s + x[sample(length(x), size = nna)] <- NA_real_ 907s + } 907s + 907s + # Integer or double? 907s + if ((kk %% 4) %in% c(2, 0)) { 907s + cat("Coercing to integers\n") 907s + storage.mode(x) <- "integer" 907s + } 907s + 907s + xs[[kk]] <- x 907s + } # for (kk ...) 907s Coercing to integers 907s Adding NAs 907s Adding NAs 907s Coercing to integers 907s > str(xs) 907s List of 4 907s $ : num [1:43, 1:78] 13.3 12.72 4.15 -15.4 -9.29 ... 907s $ : int [1:46, 1:61] 2 11 -16 -5 19 5 26 -13 1 -9 ... 907s $ : num [1:42, 1:47] NA -22.3 NA NA NA ... 907s $ : int [1:42, 1:78] NA NA NA NA NA NA NA NA NA NA ... 907s > 907s > for (kk in 1:4) { 907s + cat("Random test #", kk, "\n", sep = "") 907s + x <- xs[[kk]] 907s + tx <- t(x) 907s + 907s + for (ties in c("max", "min", "average", "first", "last", "dense")) { 907s + cat(sprintf("ties.method = %s\n", ties)) 907s + # rowRanks(): 907s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 907s + if (ties != "last" || getRversion() >= "3.3.0") { 907s + y2 <- rowRanks_R(x, ties.method = ties) 907s + stopifnot(identical(y1, y2)) 907s + } 907s + 907s + y3 <- matrixStats::colRanks(tx, ties.method = ties) 907s + stopifnot(identical(y1, y3)) 907s + 907s + # colRanks(): 907s + y1 <- matrixStats::colRanks(x, ties.method = ties) 907s + if (ties != "last" || getRversion() >= "3.3.0") { 907s + y2 <- colRanks_R(x, ties.method = ties) 907s + stopifnot(identical(y1, y2)) 907s + } 907s + 907s + y3 <- matrixStats::rowRanks(tx, ties.method = ties) 907s + stopifnot(identical(y1, y3)) 907s + } 907s + } # for (kk ...) 907s Random test #1 907s ties.method = max 907s ties.method = min 907s ties.method = average 907s ties.method = first 907s ties.method = last 907s ties.method = dense 907s Random test #2 907s ties.method = max 907s ties.method = min 907s ties.method = average 907s ties.method = first 907s ties.method = last 907s ties.method = dense 907s Random test #3 907s ties.method = max 908s ties.method = min 908s ties.method = average 908s ties.method = first 908s ties.method = last 908s ties.method = dense 908s Random test #4 908s ties.method = max 908s ties.method = min 908s ties.method = average 908s ties.method = first 908s ties.method = last 908s ties.method = dense 908s > 908s > # Note, below we know ties.method %in% c("min", "max", "average") is correct 908s > 908s > cat("Consistency checks for random:\n") 908s Consistency checks for random: 908s > tolerance <- 0.1 908s > nsamples <- 10000 908s > for (kk in 1:4) { 908s + cat("Random test #", kk, "\n", sep = "") 908s + x <- xs[[kk]] 908s + tx <- t(x) 908s + 908s + for (ties in c("random")) { 908s + cat(sprintf("ties.method = %s\n", ties)) 908s + 908s + ## rowRanks(): 908s + y0 <- rowRanks_R(x, ties.method = ties) 908s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 908s + 908s + ## Assert symmetric rank differences 908s + d <- y1 - y0 908s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 908s + 908s + ## Assert within [min, max] 908s + y2min <- matrixStats::rowRanks(x, ties.method = "min") 908s + y2max <- matrixStats::rowRanks(x, ties.method = "max") 908s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 908s + ## Assert near average 908s + y1list <- replicate(nsamples, matrixStats::rowRanks(x, ties.method = ties), simplify = FALSE) 908s + y1mean <- Reduce(`+`, y1list) / nsamples 908s + y2avg <- matrixStats::rowRanks(x, ties.method = "average") 908s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 908s + 908s + ## colRanks(): 908s + y0 <- colRanks_R(x, ties.method = ties) 908s + y1 <- matrixStats::colRanks(x, ties.method = ties) 908s + 908s + ## Assert symmetric rank differences 908s + d <- y1 - y0 908s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 908s + 908s + ## Assert within [min, max] 908s + y2min <- matrixStats::colRanks(x, ties.method = "min") 908s + y2max <- matrixStats::colRanks(x, ties.method = "max") 908s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 908s + y1list <- replicate(nsamples, matrixStats::colRanks(x, ties.method = ties), simplify = FALSE) 908s + y1mean <- Reduce(`+`, y1list) / nsamples 908s + ## Assert near average 908s + y2avg <- matrixStats::colRanks(x, ties.method = "average") 908s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 908s + } 908s + } # for (kk ...) 908s Random test #1 908s ties.method = random 918s Random test #2 918s ties.method = random 925s Random test #3 925s ties.method = random 928s Random test #4 928s ties.method = random 932s > 932s > 932s > ## Exception handling 932s > x <- matrix(1:12, nrow = 3L, ncol = 4L) 932s > y <- try(rowRanks(x, ties.method = "unknown"), silent = TRUE) 932s > stopifnot(inherits(y, "try-error")) 932s > 932s > y <- try(colRanks(x, ties.method = "unknown"), silent = TRUE) 932s > stopifnot(inherits(y, "try-error")) 932s > 932s > dimnames <- list(letters[1:3], LETTERS[1:4]) 932s > for (mode in c("integer", "double")){ 932s + storage.mode(x) <- mode 932s + # Test with and without dimnames on x 932s + for (setDimnames in c(TRUE, FALSE)) { 932s + if (setDimnames) dimnames(x) <- dimnames 932s + else dimnames(x) <- NULL 932s + # Check names attribute 932s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 932s + for (ties in c("max", "min", "average", "first", "last", "dense", "random")) { 932s + cat(sprintf("ties.method = %s\n", ties)) 932s + # rowRanks(): 932s + y1 <- matrixStats::rowRanks(x, ties.method = ties, useNames = useNames) 932s + if (ties != "last" || getRversion() >= "3.3.0") { 932s + y2 <- rowRanks_R(x, ties.method = ties, useNames = useNames) 932s + stopifnot(identical(y1, y2)) 932s + } 932s + 932s + y3 <- matrixStats::colRanks(t(x), ties.method = ties, useNames = useNames) 932s + stopifnot(identical(y1, y3)) 932s + 932s + # colRanks(): 932s + y1 <- matrixStats::colRanks(x, ties.method = ties, useNames = useNames) 932s + if (ties != "last" || getRversion() >= "3.3.0") { 932s + y2 <- colRanks_R(x, ties.method = ties, useNames = useNames) 932s + stopifnot(identical(y1, y2)) 932s + } 932s + 932s + y3 <- matrixStats::rowRanks(t(x), ties.method = ties, useNames = useNames) 932s + stopifnot(identical(y1, y3)) 932s + 932s + # Check preserveShape 932s + y1 <- matrixStats::colRanks(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 932s + if (ties != "last" || getRversion() >= "3.3.0") { 932s + y2 <- colRanks_R(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 932s + stopifnot(identical(y1, y2)) 932s + } 932s + } 932s + } 932s + } 932s + } 932s ties.method = max 932s ties.method = min 932s ties.method = average 932s ties.method = first 932s ties.method = last 932s ties.method = dense 932s ties.method = random 932s ties.method = max 932s ties.method = min 932s ties.method = average 932s ties.method = first 932s ties.method = last 932s ties.method = dense 932s ties.method = random 932s ties.method = max 932s ties.method = min 932s ties.method = average 932s ties.method = first 932s ties.method = last 932s ties.method = dense 932s ties.method = random 932s ties.method = max 932s ties.method = min 932s ties.method = average 932s ties.method = first 932s ties.method = last 932s ties.method = dense 932s ties.method = random 932s ties.method = max 932s ties.method = min 932s ties.method = average 932s ties.method = first 932s ties.method = last 932s ties.method = dense 932s ties.method = random 932s ties.method = max 932s ties.method = min 932s ties.method = average 932s ties.method = first 932s ties.method = last 932s ties.method = dense 932s ties.method = random 932s ties.method = max 932s ties.method = min 932s ties.method = average 932s ties.method = first 932s ties.method = last 932s ties.method = dense 932s ties.method = random 932s ties.method = max 932s ties.method = min 932s ties.method = average 932s ties.method = first 932s ties.method = last 932s ties.method = dense 932s ties.method = random 932s > 933s 933s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 933s Copyright (C) 2024 The R Foundation for Statistical Computing 933s Platform: aarch64-unknown-linux-gnu (64-bit) 933s 933s R is free software and comes with ABSOLUTELY NO WARRANTY. 933s You are welcome to redistribute it under certain conditions. 933s Type 'license()' or 'licence()' for distribution details. 933s 933s R is a collaborative project with many contributors. 933s Type 'contributors()' for more information and 933s 'citation()' on how to cite R or R packages in publications. 933s 933s Type 'demo()' for some demos, 'help()' for on-line help, or 933s 'help.start()' for an HTML browser interface to help. 933s Type 'q()' to quit R. 933s 933s > library("matrixStats") 933s > 933s > rowRanks_R <- function(x, ties.method = "average", ..., useNames = NA) { 933s + ans <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", 933s + ties.method = ties.method)) 933s + 933s + # Preserve dimnames attribute? 933s + dim(ans) <- dim(x) 933s + dimnames(ans) <- if (isTRUE(useNames)) dimnames(x) else NULL 933s + 933s + ans 933s + } 933s > 933s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = NA) { 933s + ans <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 933s + 933s + # Preserve dimnames attribute? 933s + tx <- t(x) 933s + dim(ans) <- dim(tx) 933s + dimnames(ans) <- if (isTRUE(useNames)) dimnames(tx) else NULL 933s + 933s + if (preserveShape) ans <- t(ans) 933s + ans 933s + } 933s > 933s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 933s > # Subsetted tests 933s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 933s > source("utils/validateIndicesFramework.R") 933s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 933s > storage.mode(x) <- "integer" 933s > 933s > # To check dimnames attribute 933s > dimnames <- list(letters[1:6], LETTERS[1:6]) 933s > 933s > colRanks_R_t <- function(x, rows, cols, ..., useNames = NA) { 933s + t(colRanks(t(x), rows = cols, cols = rows, preserveShape = TRUE, ..., useNames = useNames)) 933s + } 933s > 933s > # Test with and without dimnames on x 933s > for (setDimnames in c(TRUE, FALSE)) { 933s + if (setDimnames) dimnames(x) <- dimnames 933s + else dimnames(x) <- NULL 933s + 933s + count <- 0L 933s + for (rows in index_cases) { 933s + for (cols in index_cases) { 933s + count <- count + 1L 933s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 933s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 933s + useNames <- useNames[count %% length(useNames) + 1] 933s + 933s + validateIndicesTestMatrix(x, rows, cols, 933s + ftest = rowRanks, fsure = rowRanks_R, 933s + ties.method = "average", useNames = useNames) 933s + 933s + validateIndicesTestMatrix(x, rows, cols, 933s + ftest = colRanks_R_t, fsure = rowRanks_R, 933s + ties.method = "average", useNames = useNames) 933s + 933s + for (perserveShape in c(TRUE, FALSE)) { 933s + validateIndicesTestMatrix(x, rows, cols, 933s + ftest = colRanks, fsure = colRanks_R, 933s + ties.method = "average", perserveShape = perserveShape, 933s + useNames = useNames) 933s + } 933s + } 933s + } 933s + } 939s > 940s 940s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 940s Copyright (C) 2024 The R Foundation for Statistical Computing 940s Platform: aarch64-unknown-linux-gnu (64-bit) 940s 940s R is free software and comes with ABSOLUTELY NO WARRANTY. 940s You are welcome to redistribute it under certain conditions. 940s Type 'license()' or 'licence()' for distribution details. 940s 940s R is a collaborative project with many contributors. 940s Type 'contributors()' for more information and 940s 'citation()' on how to cite R or R packages in publications. 940s 940s Type 'demo()' for some demos, 'help()' for on-line help, or 940s 'help.start()' for an HTML browser interface to help. 940s Type 'q()' to quit R. 940s 941s > library("matrixStats") 941s > 941s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 941s > options(matrixStats.center.onUse = "ignore") 941s > 941s > ## Create isFALSE() if running on an old version of R 941s > if (!exists("isFALSE", mode="function")) { 941s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 941s + } 941s > 941s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = NA) { 941s + suppressWarnings({ 941s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 941s + }) 941s + stopifnot(!any(is.infinite(sigma))) 941s + 941s + # Keep naming support consistency same as rowSds() 941s + if (is.null(center) || ncol(x) <= 1L) { 941s + if (is.na(useNames) || isFALSE(useNames)) names(sigma) <- NULL 941s + } 941s + else if (isFALSE(useNames)) names(sigma) <- NULL 941s + sigma 941s + } 941s > 941s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = NA) { 941s + suppressWarnings({ 941s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 941s + }) 941s + stopifnot(!any(is.infinite(sigma))) 941s + 941s + # Keep naming support consistency same as colSds() 941s + if (is.null(center) || nrow(x) <= 1L) { 941s + if (is.na(useNames) || isFALSE(useNames)) names(sigma) <- NULL 941s + } 941s + if (isFALSE(useNames)) names(sigma) <- NULL 941s + sigma 941s + } 941s > 941s > 941s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 941s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 941s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 941s + stopifnot(!any(is.infinite(sigma))) 941s + sigma 941s + } 941s > 941s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 941s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 941s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 941s + stopifnot(!any(is.infinite(sigma))) 941s + sigma 941s + } 941s > 941s > 941s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 941s > # With and without some NAs 941s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 941s > for (mode in c("integer", "double")) { 941s + for (add_na in c(FALSE, TRUE)) { 941s + cat("add_na = ", add_na, "\n", sep = "") 941s + 941s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 941s + if (add_na) { 941s + x[3:7, c(2, 4)] <- NA_real_ 941s + } 941s + cat("mode: ", mode, "\n", sep = "") 941s + storage.mode(x) <- mode 941s + str(x) 941s + 941s + # To check names attribute 941s + dimnames <- list(letters[1:10], LETTERS[1:5]) 941s + 941s + # Test with and without dimnames on x 941s + for (setDimnames in c(TRUE, FALSE)) { 941s + if (setDimnames) dimnames(x) <- dimnames 941s + else dimnames(x) <- NULL 941s + # Row/column ranges 941s + for (na.rm in c(FALSE, TRUE)) { 941s + # Check names attribute 941s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 941s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 941s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 941s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 941s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 941s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 941s + stopifnot(all.equal(r1, r2)) 941s + stopifnot(all.equal(r1, r0)) 941s + stopifnot(all.equal(r2, r0)) 941s + stopifnot(all.equal(r1b, r2b)) 941s + stopifnot( 941s + !any(is.infinite(r1)), 941s + !any(is.infinite(r2)), 941s + !any(is.infinite(r1b)), 941s + !any(is.infinite(r2b)) 941s + ) 941s + } 941s + } 941s + } 941s + } # for (add_na ...) 941s + } 941s add_na = FALSE 941s mode: integer 941s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 941s add_na = TRUE 941s mode: integer 941s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 941s add_na = FALSE 941s mode: double 941s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 941s add_na = TRUE 941s mode: double 941s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 941s > 941s > 941s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 941s > # All NAs 941s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 941s > for (mode in c("integer", "double")) { 941s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 941s + cat("mode: ", mode, "\n", sep = "") 941s + storage.mode(x) <- mode 941s + str(x) 941s + 941s + # Test with and without dimnames on x 941s + for (setDimnames in c(TRUE, FALSE)) { 941s + if (setDimnames) dimnames(x) <- dimnames 941s + else dimnames(x) <- NULL 941s + # Row/column ranges 941s + for (na.rm in c(FALSE, TRUE)) { 941s + # Check names attribute 941s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 941s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 941s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 941s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 941s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 941s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 941s + stopifnot(all.equal(r1, r2)) 941s + stopifnot(all.equal(r1, r0)) 941s + stopifnot(all.equal(r2, r0)) 941s + stopifnot(all.equal(r1b, r2b)) 941s + stopifnot( 941s + !any(is.infinite(r1)), 941s + !any(is.infinite(r2)), 941s + !any(is.infinite(r1b)), 941s + !any(is.infinite(r2b)) 941s + ) 941s + } 941s + } 941s + } 941s + } 941s mode: integer 941s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 941s mode: double 941s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 941s > 941s > 941s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 941s > # A 1x1 matrix 941s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 941s > x <- matrix(0, nrow = 1L, ncol = 1L) 941s > dimnames <- list("a", "A") 941s > for (na.rm in c(FALSE, TRUE)) { 941s + cat("na.rm = ", na.rm, "\n", sep = "") 941s + 941s + # Test with and without dimnames on x 941s + for (setDimnames in c(TRUE, FALSE)) { 941s + if (setDimnames) dimnames(x) <- dimnames 941s + else dimnames(x) <- NULL 941s + # Row/column ranges 941s + for (na.rm in c(FALSE, TRUE)) { 941s + # Check names attribute 941s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 941s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 941s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 941s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 941s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 941s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 941s + stopifnot(all.equal(r1, r2)) 941s + stopifnot(all.equal(r1, r0)) 941s + stopifnot(all.equal(r2, r0)) 941s + stopifnot(all.equal(r1b, r2b)) 941s + stopifnot( 941s + !any(is.infinite(r1)), 941s + !any(is.infinite(r2)), 941s + !any(is.infinite(r1b)), 941s + !any(is.infinite(r2b)) 941s + ) 941s + } 941s + } 941s + } 941s + } 942s na.rm = FALSE 942s na.rm = TRUE 942s > 942s 942s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 942s Copyright (C) 2024 The R Foundation for Statistical Computing 942s Platform: aarch64-unknown-linux-gnu (64-bit) 942s 942s R is free software and comes with ABSOLUTELY NO WARRANTY. 942s You are welcome to redistribute it under certain conditions. 942s Type 'license()' or 'licence()' for distribution details. 942s 942s R is a collaborative project with many contributors. 942s Type 'contributors()' for more information and 942s 'citation()' on how to cite R or R packages in publications. 942s 942s Type 'demo()' for some demos, 'help()' for on-line help, or 942s 'help.start()' for an HTML browser interface to help. 942s Type 'q()' to quit R. 942s 942s > library("matrixStats") 942s > 942s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 942s > options(matrixStats.center.onUse = "ignore") 942s > 942s > ## Create isFALSE() if running on an old version of R 942s > if (!exists("isFALSE", mode="function")) { 942s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 942s + } 942s > 942s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = NA) { 942s + suppressWarnings({ 942s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 942s + }) 942s + stopifnot(!any(is.infinite(sigma))) 942s + 942s + # Keep naming support consistency same as rowSds() 942s + if (is.null(center) || ncol(x) <= 1L) { 942s + if (is.na(useNames) || isFALSE(useNames)) names(sigma) <- NULL 942s + } 942s + else if (isFALSE(useNames)) names(sigma) <- NULL 942s + sigma 942s + } 942s > 942s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = NA) { 942s + suppressWarnings({ 942s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 942s + }) 942s + stopifnot(!any(is.infinite(sigma))) 942s + 942s + # Keep naming support consistency same as colSds() 942s + if (is.null(center) || nrow(x) <= 1L) { 942s + if (is.na(useNames) || isFALSE(useNames)) names(sigma) <- NULL 942s + } 942s + else if (isFALSE(useNames)) names(sigma) <- NULL 942s + sigma 942s + } 942s > 942s > 942s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 942s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 942s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 942s + stopifnot(!any(is.infinite(sigma))) 942s + sigma 942s + } 942s > 942s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 942s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 942s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 942s + stopifnot(!any(is.infinite(sigma))) 942s + sigma 942s + } 942s > 942s > 942s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 942s > # Subsetted tests 942s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 942s > source("utils/validateIndicesFramework.R") 942s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 942s > storage.mode(x) <- "integer" 942s > 942s > # To check names attribute 942s > dimnames <- list(letters[1:6], LETTERS[1:6]) 942s > 942s > # Test with and without dimnames on x 942s > for (setDimnames in c(TRUE, FALSE)) { 942s + if (setDimnames) dimnames(x) <- dimnames 942s + else dimnames(x) <- NULL 942s + 942s + count <- 0L 942s + for (rows in index_cases) { 942s + for (cols in index_cases) { 942s + count <- count + 1L 942s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 942s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 942s + useNames <- useNames[count %% length(useNames) + 1] 942s + 942s + validateIndicesTestMatrix(x, rows, cols, 942s + ftest = rowSds, fsure = rowSds_R, 942s + na.rm = na.rm, useNames = useNames) 942s + validateIndicesTestMatrix(x, rows, cols, 942s + ftest = rowSds_center, fsure = rowSds_R, 942s + na.rm = na.rm, center = TRUE, useNames = useNames) 942s + 942s + validateIndicesTestMatrix(x, rows, cols, 942s + fcoltest = colSds, fsure = rowSds_R, 942s + na.rm = na.rm, useNames = useNames) 942s + validateIndicesTestMatrix(x, rows, cols, 942s + fcoltest = colSds_center, fsure = rowSds_R, 942s + na.rm = na.rm, center = TRUE, useNames = useNames) 942s + } 942s + } 942s + } 947s > 947s 947s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 947s Copyright (C) 2024 The R Foundation for Statistical Computing 947s Platform: aarch64-unknown-linux-gnu (64-bit) 947s 947s R is free software and comes with ABSOLUTELY NO WARRANTY. 947s You are welcome to redistribute it under certain conditions. 947s Type 'license()' or 'licence()' for distribution details. 947s 947s R is a collaborative project with many contributors. 947s Type 'contributors()' for more information and 947s 'citation()' on how to cite R or R packages in publications. 947s 947s Type 'demo()' for some demos, 'help()' for on-line help, or 947s 'help.start()' for an HTML browser interface to help. 947s Type 'q()' to quit R. 947s 947s > library("matrixStats") 947s > 947s > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 947s + ## FIXME: sum() may overflow for integers, whereas 947s + ## base::rowSums() doesn't. What should rowSums2() do? 947s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 947s + res <- rowSums(x, na.rm = na.rm) 947s + if (is.na(useNames) || !useNames) names(res) <- NULL 947s + res 947s + } 947s > 947s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 947s + ## FIXME: sum() may overflow for integers, whereas 947s + ## base::colSums() doesn't. What should colSums2() do? 947s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 947s + res <- colSums(x, na.rm = na.rm) 947s + if (is.na(useNames) || !useNames) names(res) <- NULL 947s + res 947s + } 947s > 947s > for (mode in c("integer", "logical", "double")) { 947s + x <- matrix(-4:4, nrow = 3, ncol = 3) 947s + storage.mode(x) <- mode 947s + if (mode == "double") x <- x + 0.1 947s + 947s + # To check names attribute 947s + dimnames <- list(letters[1:3], LETTERS[1:3]) 947s + 947s + # Test with and without dimnames on x 947s + for (setDimnames in c(TRUE, FALSE)) { 947s + if (setDimnames) dimnames(x) <- dimnames 947s + else dimnames(x) <- NULL 947s + # Check names attribute 947s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 947s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 947s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 947s + stopifnot(all.equal(y1, y0)) 947s + 947s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 947s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 947s + stopifnot(all.equal(y1, y0)) 947s + } 947s + } 947s + } 948s > 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > # Special case: Single-element matrix 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > cat("Special case: Single-element matrix:\n") 948s Special case: Single-element matrix: 948s > for (mode in c("integer", "logical", "double")) { 948s + x <- matrix(1, nrow = 1, ncol = 1) 948s + storage.mode(x) <- mode 948s + 948s + # To check names attribute 948s + dimnames <- list("a", "A") 948s + 948s + # Test with and without dimnames on x 948s + for (setDimnames in c(TRUE, FALSE)) { 948s + if (setDimnames) dimnames(x) <- dimnames 948s + else dimnames(x) <- NULL 948s + # Check names attribute 948s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 948s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 948s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + 948s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 948s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + } 948s + } 948s + } 948s > 948s > 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > # Special case: Empty matrix 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > cat("Special case: Empty matrix:\n") 948s Special case: Empty matrix: 948s > for (mode in c("integer", "logical", "double")) { 948s + x <- matrix(integer(0), nrow = 0, ncol = 0) 948s + storage.mode(x) <- mode 948s + 948s + y0 <- rowSums2_R(x, na.rm = FALSE) 948s + y1 <- rowSums2(x, na.rm = FALSE) 948s + stopifnot(all.equal(y1, y0)) 948s + 948s + y0 <- colSums2_R(x, na.rm = FALSE) 948s + y1 <- colSums2(x, na.rm = FALSE) 948s + stopifnot(all.equal(y1, y0)) 948s + } 948s > 948s > 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > # Special case: All NAs 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > cat("Special case: All NAs:\n") 948s Special case: All NAs: 948s > for (mode in c("integer", "logical", "double")) { 948s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 948s + storage.mode(x) <- mode 948s + 948s + # To check names attribute 948s + dimnames <- list(letters[1:3], LETTERS[1:3]) 948s + 948s + # Test with and without dimnames on x 948s + for (setDimnames in c(TRUE, FALSE)) { 948s + if (setDimnames) dimnames(x) <- dimnames 948s + else dimnames(x) <- NULL 948s + # Check names attribute 948s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 948s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 948s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + 948s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 948s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + } 948s + } 948s + } 948s > 948s > 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > # Special case: All NaNs 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > cat("Special case: All NaNs:\n") 948s Special case: All NaNs: 948s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 948s > 948s > # Test with and without dimnames on x 948s > for (setDimnames in c(TRUE, FALSE)) { 948s + if (setDimnames) dimnames(x) <- dimnames 948s + else dimnames(x) <- NULL 948s + # Check names attribute 948s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 948s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 948s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + 948s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 948s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + } 948s + } 948s > 948s > 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > # Special case: All Infs 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > cat("Special case: All Infs:\n") 948s Special case: All Infs: 948s > x <- matrix(Inf, nrow = 3, ncol = 3) 948s > 948s > # Test with and without dimnames on x 948s > for (setDimnames in c(TRUE, FALSE)) { 948s + if (setDimnames) dimnames(x) <- dimnames 948s + else dimnames(x) <- NULL 948s + # Check names attribute 948s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 948s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 948s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + 948s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 948s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + } 948s + } 948s > 948s > 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > # Special case: All -Infs 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > cat("Special case: All -Infs:\n") 948s Special case: All -Infs: 948s > x <- matrix(-Inf, nrow = 3, ncol = 3) 948s > 948s > # Test with and without dimnames on x 948s > for (setDimnames in c(TRUE, FALSE)) { 948s + if (setDimnames) dimnames(x) <- dimnames 948s + else dimnames(x) <- NULL 948s + # Check names attribute 948s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 948s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 948s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + 948s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 948s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + } 948s + } 948s > 948s > 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > # Special case: Infs and -Infs 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > cat("Special case: Infs and -Infs:\n") 948s Special case: Infs and -Infs: 948s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 948s > 948s > # To check names attribute 948s > dimnames <- list(letters[1:4], LETTERS[1:4]) 948s > 948s > # Test with and without dimnames on x 948s > for (setDimnames in c(TRUE, FALSE)) { 948s + if (setDimnames) dimnames(x) <- dimnames 948s + else dimnames(x) <- NULL 948s + # Check names attribute 948s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 948s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 948s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + 948s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 948s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + } 948s + } 948s > 948s > 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > # Special case: NaNs and NAs 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > cat("Special case: Infs and -Infs:\n") 948s Special case: Infs and -Infs: 948s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 948s > 948s > y0 <- rowSums(x, na.rm = FALSE) 948s > str(y0) 948s num [1:4] NaN NA NaN NA 948s > stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 948s > y1 <- rowSums2(x, na.rm = FALSE) 948s > str(y0) 948s num [1:4] NaN NA NaN NA 948s > stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 948s > stopifnot(all.equal(y1, y0)) 948s > 948s > y0 <- colSums(x, na.rm = FALSE) 948s > stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 948s > y1 <- colSums2(x, na.rm = FALSE) 948s > stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 948s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 948s > ## returned here (as one would expect). NaN might very well be returned, 948s > ## when both NA and NaN are involved. This is an accepted feature in R, 948s > ## which is documented in help("is.nan"). See also 948s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 948s > ## Thus, we cannot guarantee that y1 is identical to y0. 948s > 948s > 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > # Special case: Integer overflow with ties 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > cat("Special case: Integer overflow with ties:\n") 948s Special case: Integer overflow with ties: 948s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 948s > 948s > # Test with and without dimnames on x 948s > for (setDimnames in c(TRUE, FALSE)) { 948s + if (setDimnames) dimnames(x) <- dimnames 948s + else dimnames(x) <- NULL 948s + # Check names attribute 948s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 948s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 948s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + 948s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 948s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 948s + stopifnot(all.equal(y1, y0)) 948s + } 948s + } 948s > 948s > 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > # Consistency checks 948s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 948s > set.seed(1) 948s > 948s > cat("Consistency checks:\n") 948s Consistency checks: 948s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 948s > for (kk in seq_len(n_sims)) { 948s + cat("Random test #", kk, "\n", sep = "") 948s + 948s + # Simulate data in a matrix of any shape 948s + dim <- sample(50:200, size = 2) 948s + n <- prod(dim) 948s + x <- rnorm(n, sd = 100) 948s + dim(x) <- dim 948s + 948s + # Add NAs? 948s + if ((kk %% 4) %in% c(3, 0)) { 948s + cat("Adding NAs\n") 948s + nna <- sample(n, size = 1) 948s + na_values <- c(NA_real_, NaN) 948s + t <- sample(na_values, size = nna, replace = TRUE) 948s + x[sample(length(x), size = nna)] <- t 948s + } 948s + 948s + # Mode? 948s + modes <- "double" 948s + if ((kk %% 4) %in% c(2, 0)) { 948s + modes <- c("integer", "logical") 948s + } 948s + 948s + for (mode in modes) { 948s + if (mode != "double") { 948s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 948s + storage.mode(x) <- mode 948s + } 948s + 948s + na.rm <- sample(c(TRUE, FALSE), size = 1) 948s + 948s + # rowSums2(): 948s + y0 <- rowSums2_R(x, na.rm = na.rm) 948s + y1 <- rowSums2(x, na.rm = na.rm) 948s + stopifnot(all.equal(y1, y0)) 948s + y2 <- colSums2(t(x), na.rm = na.rm) 948s + stopifnot(all.equal(y2, y0)) 948s + 948s + # colSums2(): 948s + y0 <- colSums2_R(x, na.rm = na.rm) 948s + y1 <- colSums2(x, na.rm = na.rm) 948s + stopifnot(all.equal(y1, y0)) 948s + y2 <- rowSums2(t(x), na.rm = na.rm) 948s + stopifnot(all.equal(y2, y0)) 948s + } 948s + } # for (kk ...) 948s Random test #1 948s Random test #2 948s Coercing from double to integer 948s Coercing from integer to logical 948s Random test #3 948s Adding NAs 948s Random test #4 948s Adding NAs 948s Coercing from double to integer 948s Coercing from integer to logical 948s Random test #5 948s Random test #6 948s Coercing from double to integer 948s Coercing from integer to logical 948s Random test #7 948s Adding NAs 948s Random test #8 948s Adding NAs 948s Coercing from double to integer 948s Coercing from integer to logical 948s Random test #9 948s Random test #10 948s Coercing from double to integer 948s Coercing from integer to logical 948s Random test #11 948s Adding NAs 948s Random test #12 948s Adding NAs 948s Coercing from double to integer 948s Coercing from integer to logical 948s Random test #13 948s Random test #14 948s Coercing from double to integer 948s Coercing from integer to logical 948s Random test #15 948s Adding NAs 948s Random test #16 948s Adding NAs 948s Coercing from double to integer 948s Coercing from integer to logical 948s Random test #17 948s Random test #18 948s Coercing from double to integer 948s Coercing from integer to logical 948s Random test #19 948s Adding NAs 948s Random test #20 948s Adding NAs 948s Coercing from double to integer 949s Coercing from integer to logical 949s > 949s 949s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 949s Copyright (C) 2024 The R Foundation for Statistical Computing 949s Platform: aarch64-unknown-linux-gnu (64-bit) 949s 949s R is free software and comes with ABSOLUTELY NO WARRANTY. 949s You are welcome to redistribute it under certain conditions. 949s Type 'license()' or 'licence()' for distribution details. 949s 949s R is a collaborative project with many contributors. 949s Type 'contributors()' for more information and 949s 'citation()' on how to cite R or R packages in publications. 949s 949s Type 'demo()' for some demos, 'help()' for on-line help, or 949s 'help.start()' for an HTML browser interface to help. 949s Type 'q()' to quit R. 949s 949s > library("matrixStats") 949s > 949s > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 949s + ## FIXME: sum() may overflow for integers, whereas 949s + ## base::rowSums() doesn't. What should rowSums2() do? 949s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 949s + res <- rowSums(x, na.rm = na.rm) 949s + if (is.na(useNames) || !useNames) names(res) <- NULL 949s + res 949s + } 949s > 949s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = NA) { 949s + ## FIXME: sum() may overflow for integers, whereas 949s + ## base::colSums() doesn't. What should colSums2() do? 949s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 949s + res <- colSums(x, na.rm = na.rm) 949s + if (is.na(useNames) || !useNames) names(res) <- NULL 949s + res 949s + } 949s > 949s > 949s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 949s > # Subsetted tests 949s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 949s > source("utils/validateIndicesFramework.R") 949s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 949s > storage.mode(x) <- "integer" 949s > 949s > # To check names attribute 949s > dimnames <- list(letters[1:6], LETTERS[1:6]) 949s > 949s > # Test with and without dimnames on x 949s > for (setDimnames in c(TRUE, FALSE)) { 949s + if (setDimnames) dimnames(x) <- dimnames 949s + else dimnames(x) <- NULL 949s + for (rows in index_cases) { 949s + for (cols in index_cases) { 949s + for (na.rm in c(TRUE, FALSE)) { 949s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 949s + validateIndicesTestMatrix(x, rows, cols, 949s + ftest = rowSums2, fsure = rowSums2_R, 949s + na.rm = na.rm, useNames = useNames) 949s + validateIndicesTestMatrix(x, rows, cols, 949s + fcoltest = colSums2, fsure = rowSums2_R, 949s + na.rm = na.rm, useNames = useNames) 949s + } 949s + } 949s + } 949s + } 949s + } 953s > 954s 954s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 954s Copyright (C) 2024 The R Foundation for Statistical Computing 954s Platform: aarch64-unknown-linux-gnu (64-bit) 954s 954s R is free software and comes with ABSOLUTELY NO WARRANTY. 954s You are welcome to redistribute it under certain conditions. 954s Type 'license()' or 'licence()' for distribution details. 954s 954s R is a collaborative project with many contributors. 954s Type 'contributors()' for more information and 954s 'citation()' on how to cite R or R packages in publications. 954s 954s Type 'demo()' for some demos, 'help()' for on-line help, or 954s 'help.start()' for an HTML browser interface to help. 954s Type 'q()' to quit R. 954s 954s > library("matrixStats") 954s > 954s > nrow <- 6L 954s > ncol <- 5L 954s > data <- matrix(0:4, nrow = nrow, ncol = ncol) 954s > 954s > # To check names attribute 954s > dimnames <- list(letters[1:6], LETTERS[1:5]) 954s > 954s > modes <- c("integer", "logical", "raw") 954s > for (mode in modes) { 954s + cat(sprintf("Mode: %s...\n", mode)) 954s + 954s + x <- data 954s + if (mode == "logical") x <- x - 2L 954s + if (mode != "raw") x[c(2,5,7)] <- NA_integer_ 954s + storage.mode(x) <- mode 954s + print(x) 954s + 954s + unique_values <- unique(as.vector(x)) 954s + nbr_of_unique_values <- length(unique_values) 954s + 954s + y <- rowTabulates(x) 954s + print(y) 954s + stopifnot( 954s + identical(dim(y), c(nrow, nbr_of_unique_values)), 954s + all(y >= 0) 954s + ) 954s + if (mode != "raw") { 954s + y0 <- t(table(x, row(x), useNA = "always")[, seq_len(nrow(x))]) 954s + stopifnot(all(y == y0)) 954s + } 954s + # Check names attribute 954s + dimnames(x) <- dimnames 954s + y1 <- rowTabulates(x, useNames = FALSE) 954s + stopifnot(all.equal(y1, y)) 954s + if (!matrixStats:::isUseNamesNADefunct()) { 954s + y2 <- rowTabulates(x, useNames = NA) 954s + stopifnot(all.equal(y2, y)) 954s + } 954s + y <- rowTabulates(x, useNames = TRUE) 954s + stopifnot(identical(rownames(y), rownames(x))) 954s + dimnames(x) <- NULL 954s + 954s + y <- colTabulates(x) 954s + print(y) 954s + stopifnot( 954s + identical(dim(y), c(ncol, nbr_of_unique_values)), 954s + all(y >= 0) 954s + ) 954s + if (mode != "raw") { 954s + y0 <- t(table(x, col(x), useNA = "always")[, seq_len(ncol(x))]) 954s + stopifnot(all(y == y0)) 954s + } 954s + # Check names attribute 954s + dimnames(x) <- dimnames 954s + y1 <- colTabulates(x, useNames = FALSE) 954s + stopifnot(all.equal(y1, y)) 954s + if (!matrixStats:::isUseNamesNADefunct()) { 954s + y2 <- colTabulates(x, useNames = NA) 954s + stopifnot(all.equal(y2, y)) 954s + } 954s + y <- colTabulates(x, useNames = TRUE) 954s + stopifnot(identical(rownames(y), colnames(x))) 954s + dimnames(x) <- NULL 954s + 954s + # Count only certain values 954s + if (mode == "integer") { 954s + subset <- c(0:2, NA_integer_) 954s + } else if (mode == "logical") { 954s + subset <- c(TRUE, FALSE, NA) 954s + } else { 954s + subset <- c(0:2) 954s + } 954s + y <- rowTabulates(x, values = subset) 954s + print(y) 954s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 954s + # Check names attribute 954s + dimnames(x) <- dimnames 954s + y1 <- rowTabulates(x, values = subset, useNames = FALSE) 954s + stopifnot(all.equal(y1, y)) 954s + if (!matrixStats:::isUseNamesNADefunct()) { 954s + y2 <- rowTabulates(x, values = subset, useNames = NA) 954s + stopifnot(all.equal(y2, y)) 954s + } 954s + y <- rowTabulates(x, values = subset, useNames = TRUE) 954s + stopifnot(identical(rownames(y), rownames(x))) 954s + dimnames(x) <- NULL 954s + 954s + y <- colTabulates(x, values = subset) 954s + print(y) 954s + stopifnot(identical(dim(y), c(ncol, length(subset)))) 954s + # Check names attribute 954s + dimnames(x) <- dimnames 954s + y1 <- colTabulates(x, values = subset, useNames = FALSE) 954s + stopifnot(all.equal(y1, y)) 954s + if (!matrixStats:::isUseNamesNADefunct()) { 954s + y2 <- colTabulates(x, values = subset, useNames = NA) 954s + stopifnot(all.equal(y2, y)) 954s + } 954s + y <- colTabulates(x, values = subset, useNames = TRUE) 954s + stopifnot(identical(rownames(y), colnames(x))) 954s + dimnames(x) <- NULL 954s + 954s + # Raw 954s + if (mode %in% c("integer", "raw")) { 954s + subset <- c(0:2) 954s + 954s + y <- rowTabulates(x, values = as.raw(subset)) 954s + print(y) 954s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 954s + # Check names attribute 954s + dimnames(x) <- dimnames 954s + y1 <- rowTabulates(x, values = as.raw(subset), useNames = FALSE) 954s + stopifnot(all.equal(y1, y)) 954s + if (!matrixStats:::isUseNamesNADefunct()) { 954s + y2 <- rowTabulates(x, values = as.raw(subset), useNames = NA) 954s + stopifnot(all.equal(y2, y)) 954s + } 954s + y3 <- rowTabulates(x, values = as.raw(subset), useNames = TRUE) 954s + stopifnot(identical(rownames(y3), rownames(x))) 954s + dimnames(x) <- NULL 954s + 954s + y2 <- colTabulates(t(x), values = as.raw(subset)) 954s + print(y2) 954s + stopifnot( 954s + identical(dim(y2), c(nrow, length(subset))), 954s + identical(y2, y) 954s + ) 954s + # Check names attribute 954s + dimnames(x) <- dimnames 954s + y1 <- colTabulates(t(x), values = as.raw(subset), useNames = FALSE) 954s + stopifnot(all.equal(y1, y)) 954s + if (!matrixStats:::isUseNamesNADefunct()) { 954s + y2 <- colTabulates(t(x), values = as.raw(subset), useNames = NA) 954s + stopifnot(all.equal(y2, y)) 954s + } 954s + y <- colTabulates(t(x), values = as.raw(subset), useNames = TRUE) 954s + stopifnot(identical(rownames(y), colnames(t(x)))) 954s + dimnames(x) <- NULL 954s + } 954s + 954s + cat(sprintf("Mode: %s...done\n", mode)) 954s + } # for (mode ...) 955s Mode: integer... 955s [,1] [,2] [,3] [,4] [,5] 955s [1,] 0 NA 2 3 4 955s [2,] NA 2 3 4 0 955s [3,] 2 3 4 0 1 955s [4,] 3 4 0 1 2 955s [5,] NA 0 1 2 3 955s [6,] 0 1 2 3 4 955s 0 1 2 3 4 955s [1,] 1 0 1 1 1 1 955s [2,] 1 0 1 1 1 1 955s [3,] 1 1 1 1 1 0 955s [4,] 1 1 1 1 1 0 955s [5,] 1 1 1 1 0 1 955s [6,] 1 1 1 1 1 0 955s 0 1 2 3 4 955s [1,] 2 0 1 1 0 2 955s [2,] 1 1 1 1 1 1 955s [3,] 1 1 2 1 1 0 955s [4,] 1 1 1 2 1 0 955s [5,] 1 1 1 1 2 0 955s 0 1 2 955s [1,] 1 0 1 1 955s [2,] 1 0 1 1 955s [3,] 1 1 1 0 955s [4,] 1 1 1 0 955s [5,] 1 1 1 1 955s [6,] 1 1 1 0 955s 0 1 2 955s [1,] 2 0 1 2 955s [2,] 1 1 1 1 955s [3,] 1 1 2 0 955s [4,] 1 1 1 0 955s [5,] 1 1 1 0 955s 0x0 0x1 0x2 955s [1,] 1 0 1 955s [2,] 1 0 1 955s [3,] 1 1 1 955s [4,] 1 1 1 955s [5,] 1 1 1 955s [6,] 1 1 1 955s 0x0 0x1 0x2 955s [1,] 1 0 1 955s [2,] 1 0 1 955s [3,] 1 1 1 955s [4,] 1 1 1 955s [5,] 1 1 1 955s [6,] 1 1 1 955s Mode: integer...done 955s Mode: logical... 955s [,1] [,2] [,3] [,4] [,5] 955s [1,] TRUE NA FALSE TRUE TRUE 955s [2,] NA FALSE TRUE TRUE TRUE 955s [3,] FALSE TRUE TRUE TRUE TRUE 955s [4,] TRUE TRUE TRUE TRUE FALSE 955s [5,] NA TRUE TRUE FALSE TRUE 955s [6,] TRUE TRUE FALSE TRUE TRUE 955s FALSE TRUE 955s [1,] 1 3 1 955s [2,] 1 3 1 955s [3,] 1 4 0 955s [4,] 1 4 0 955s [5,] 1 3 1 955s [6,] 1 4 0 955s FALSE TRUE 955s [1,] 1 3 2 955s [2,] 1 4 1 955s [3,] 2 4 0 955s [4,] 1 5 0 955s [5,] 1 5 0 955s TRUE FALSE 955s [1,] 3 1 1 955s [2,] 3 1 1 955s [3,] 4 1 0 955s [4,] 4 1 0 955s [5,] 3 1 1 955s [6,] 4 1 0 955s TRUE FALSE 955s [1,] 3 1 2 955s [2,] 4 1 1 955s [3,] 4 2 0 955s [4,] 5 1 0 955s [5,] 5 1 0 955s Mode: logical...done 955s Mode: raw... 955s [,1] [,2] [,3] [,4] [,5] 955s [1,] 00 01 02 03 04 955s [2,] 01 02 03 04 00 955s [3,] 02 03 04 00 01 955s [4,] 03 04 00 01 02 955s [5,] 04 00 01 02 03 955s [6,] 00 01 02 03 04 955s 0x0 0x1 0x2 0x3 0x4 955s [1,] 1 1 1 1 1 955s [2,] 1 1 1 1 1 955s [3,] 1 1 1 1 1 955s [4,] 1 1 1 1 1 955s [5,] 1 1 1 1 1 955s [6,] 1 1 1 1 1 955s 0x0 0x1 0x2 0x3 0x4 955s [1,] 2 1 1 1 1 955s [2,] 1 2 1 1 1 955s [3,] 1 1 2 1 1 955s [4,] 1 1 1 2 1 955s [5,] 1 1 1 1 2 955s 0 1 2 955s [1,] 1 1 1 955s [2,] 1 1 1 955s [3,] 1 1 1 955s [4,] 1 1 1 955s [5,] 1 1 1 955s [6,] 1 1 1 955s 0 1 2 955s [1,] 2 1 1 955s [2,] 1 2 1 955s [3,] 1 1 2 955s [4,] 1 1 1 955s [5,] 1 1 1 955s 0x0 0x1 0x2 955s [1,] 1 1 1 955s [2,] 1 1 1 955s [3,] 1 1 1 955s [4,] 1 1 1 955s [5,] 1 1 1 955s [6,] 1 1 1 955s 0x0 0x1 0x2 955s [1,] 1 1 1 955s [2,] 1 1 1 955s [3,] 1 1 1 955s [4,] 1 1 1 955s [5,] 1 1 1 955s [6,] 1 1 1 955s Mode: raw...done 955s > 955s 955s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 955s Copyright (C) 2024 The R Foundation for Statistical Computing 955s Platform: aarch64-unknown-linux-gnu (64-bit) 955s 955s R is free software and comes with ABSOLUTELY NO WARRANTY. 955s You are welcome to redistribute it under certain conditions. 955s Type 'license()' or 'licence()' for distribution details. 955s 955s R is a collaborative project with many contributors. 955s Type 'contributors()' for more information and 955s 'citation()' on how to cite R or R packages in publications. 955s 955s Type 'demo()' for some demos, 'help()' for on-line help, or 955s 'help.start()' for an HTML browser interface to help. 955s Type 'q()' to quit R. 955s 956s > library("matrixStats") 956s > 956s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 956s > # Subsetted tests 956s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 956s > source("utils/validateIndicesFramework.R") 956s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 956s > storage.mode(x) <- "integer" 956s > 956s > # To check names attribute 956s > dimnames <- list(letters[1:6], LETTERS[1:6]) 956s > 956s > # Test with and without dimnames on x 956s > for (setDimnames in c(TRUE, FALSE)) { 956s + if (setDimnames) dimnames(x) <- dimnames 956s + else dimnames(x) <- NULL 956s + 956s + count <- 0L 956s + for (rows in index_cases) { 956s + for (cols in index_cases) { 956s + count <- count + 1L 956s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 956s + useNames <- useNames[count %% length(useNames) + 1] 956s + 956s + validateIndicesTestMatrix(x, rows, cols, 956s + ftest = rowTabulates, fsure = rowTabulates, useNames = useNames) 956s + validateIndicesTestMatrix(x, rows, cols, 956s + ftest = rowTabulates, fsure = rowTabulates, 956s + values = 1:3, useNames = useNames) 956s + 956s + validateIndicesTestMatrix(x, rows, cols, 956s + ftest = colTabulates, fsure = colTabulates, useNames = useNames) 956s + validateIndicesTestMatrix(x, rows, cols, 956s + ftest = colTabulates, fsure = colTabulates, 956s + values = 1:3, useNames = useNames) 956s + } 956s + } 956s + } 963s > 964s 964s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 964s Copyright (C) 2024 The R Foundation for Statistical Computing 964s Platform: aarch64-unknown-linux-gnu (64-bit) 964s 964s R is free software and comes with ABSOLUTELY NO WARRANTY. 964s You are welcome to redistribute it under certain conditions. 964s Type 'license()' or 'licence()' for distribution details. 964s 964s R is a collaborative project with many contributors. 964s Type 'contributors()' for more information and 964s 'citation()' on how to cite R or R packages in publications. 964s 964s Type 'demo()' for some demos, 'help()' for on-line help, or 964s 'help.start()' for an HTML browser interface to help. 964s Type 'q()' to quit R. 964s 964s > library("matrixStats") 964s > 964s > fcns <- list( 964s + rowVarDiffs = list(rowVarDiffs, colVarDiffs), 964s + rowSdDiffs = list(rowSdDiffs, colSdDiffs), 964s + rowMadDiffs = list(rowMadDiffs, colMadDiffs), 964s + rowIQRDiffs = list(rowIQRDiffs, colIQRDiffs) 964s + ) 964s > 964s > for (fcn in names(fcns)) { 964s + cat(sprintf("%s()...\n", fcn)) 964s + row_fcn <- fcns[[fcn]][[1L]] 964s + col_fcn <- fcns[[fcn]][[2L]] 964s + 964s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 964s + # With and without some NAs 964s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 964s + for (mode in c("integer", "double")) { 964s + for (add_na in c(FALSE, TRUE)) { 964s + cat("add_na = ", add_na, "\n", sep = "") 964s + 964s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 964s + if (add_na) { 964s + x[3:7, c(2, 4)] <- NA_real_ 964s + } 964s + cat("mode: ", mode, "\n", sep = "") 964s + storage.mode(x) <- mode 964s + str(x) 964s + 964s + # To check names attribute 964s + dimnames <- list(letters[1:10], LETTERS[1:5]) 964s + 964s + # Test with and without dimnames on x 964s + for (setDimnames in c(TRUE, FALSE)) { 964s + if (setDimnames) dimnames(x) <- dimnames 964s + else dimnames(x) <- NULL 964s + # Row/column ranges 964s + for (na.rm in c(FALSE, TRUE)) { 964s + # Check names attribute 964s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 964s + cat("na.rm = ", na.rm, "\n", sep = "") 964s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 964s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 964s + stopifnot(all.equal(r1, r2)) 964s + } 964s + } 964s + } 964s + } # for (add_na ...) 964s + } 964s + 964s + 964s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 964s + # All NAs 964s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 964s + for (mode in c("integer", "double")) { 964s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 964s + cat("mode: ", mode, "\n", sep = "") 964s + storage.mode(x) <- mode 964s + str(x) 964s + 964s + # Test with and without dimnames on x 964s + for (setDimnames in c(TRUE, FALSE)) { 964s + if (setDimnames) dimnames(x) <- dimnames 964s + else dimnames(x) <- NULL 964s + # Row/column ranges 964s + for (na.rm in c(FALSE, TRUE)) { 964s + # Check names attribute 964s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 964s + cat("na.rm = ", na.rm, "\n", sep = "") 964s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 964s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 964s + stopifnot(all.equal(r1, r2)) 964s + } 964s + } 964s + } 964s + } 964s + 964s + 964s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 964s + # A 1x1 matrix 964s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 964s + x <- matrix(0, nrow = 1L, ncol = 1L) 964s + dimnames <- list("a", "A") 964s + # Test with and without dimnames on x 964s + for (setDimnames in c(TRUE, FALSE)) { 964s + if (setDimnames) dimnames(x) <- dimnames 964s + else dimnames(x) <- NULL 964s + # Row/column ranges 964s + for (na.rm in c(FALSE, TRUE)) { 964s + # Check names attribute 964s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 964s + cat("na.rm = ", na.rm, "\n", sep = "") 964s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 964s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 964s + stopifnot(all.equal(r1, r2)) 964s + } 964s + } 964s + } 964s + 964s + cat(sprintf("%s()...DONE\n", fcn)) 964s + } # for (fcn ...) 965s rowVarDiffs()... 965s add_na = FALSE 965s mode: integer 965s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s add_na = TRUE 965s mode: integer 965s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s add_na = FALSE 965s mode: double 965s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s add_na = TRUE 965s mode: double 965s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s mode: integer 965s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s mode: double 965s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s rowVarDiffs()...DONE 965s rowSdDiffs()... 965s add_na = FALSE 965s mode: integer 965s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s add_na = TRUE 965s mode: integer 965s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s add_na = FALSE 965s mode: double 965s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s add_na = TRUE 965s mode: double 965s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s mode: integer 965s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s mode: double 965s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s rowSdDiffs()...DONE 965s rowMadDiffs()... 965s add_na = FALSE 965s mode: integer 965s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s add_na = TRUE 965s mode: integer 965s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s add_na = FALSE 965s mode: double 965s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s add_na = TRUE 965s mode: double 965s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s na.rm = FALSE 965s na.rm = FALSE 965s na.rm = TRUE 965s na.rm = TRUE 965s mode: integer 965s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 965s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s mode: double 966s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s rowMadDiffs()...DONE 966s rowIQRDiffs()... 966s add_na = FALSE 966s mode: integer 966s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s add_na = TRUE 966s mode: integer 966s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s add_na = FALSE 966s mode: double 966s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s add_na = TRUE 966s mode: double 966s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s mode: integer 966s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s mode: double 966s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s na.rm = FALSE 966s na.rm = FALSE 966s na.rm = TRUE 966s na.rm = TRUE 966s rowIQRDiffs()...DONE 966s > 966s 966s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 966s Copyright (C) 2024 The R Foundation for Statistical Computing 966s Platform: aarch64-unknown-linux-gnu (64-bit) 966s 966s R is free software and comes with ABSOLUTELY NO WARRANTY. 966s You are welcome to redistribute it under certain conditions. 966s Type 'license()' or 'licence()' for distribution details. 966s 966s R is a collaborative project with many contributors. 966s Type 'contributors()' for more information and 966s 'citation()' on how to cite R or R packages in publications. 966s 966s Type 'demo()' for some demos, 'help()' for on-line help, or 966s 'help.start()' for an HTML browser interface to help. 966s Type 'q()' to quit R. 966s 967s > library("matrixStats") 967s > 967s > fcns <- list( 967s + madDiff = c(rowMadDiffs, colMadDiffs), 967s + iqrDiff = c(rowIQRDiffs, colIQRDiffs) 967s + ) 967s > 967s > 967s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 967s > # Subsetted tests 967s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 967s > source("utils/validateIndicesFramework.R") 967s > # To check names attribute 967s > dimnames <- list(letters[1:6], LETTERS[1:6]) 967s > trim <- runif(1, min = 0, max = 0.5) 967s > for (fcn in names(fcns)) { 967s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 967s + row_fcn <- fcns[[fcn]][[1L]] 967s + col_fcn <- fcns[[fcn]][[2L]] 967s + 967s + for (mode in c("numeric", "integer")) { 967s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 967s + storage.mode(x) <- mode 967s + if (mode == "numeric") x[1:2, 3:4] <- Inf 967s + 967s + # Test with and without dimnames on x 967s + for (setDimnames in c(TRUE, FALSE)) { 967s + if (setDimnames) dimnames(x) <- dimnames 967s + else dimnames(x) <- NULL 967s + 967s + count <- 0L 967s + for (diff in 1:2) { 967s + for (rows in index_cases) { 967s + for (cols in index_cases) { 967s + count <- count + 1L 967s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 967s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 967s + useNames <- useNames[count %% length(useNames) + 1] 967s + validateIndicesTestMatrix(x, rows, cols, 967s + ftest = row_fcn, fsure = row_fcn, 967s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 967s + validateIndicesTestMatrix(x, rows, cols, 967s + fcoltest = col_fcn, fsure = row_fcn, 967s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 967s + } 967s + } 967s + } 967s + } 967s + } 967s + cat(sprintf("%s()...DONE\n", fcn)) 967s + } 968s subsetted tests on madDiff()... 987s madDiff()...DONE 987s subsetted tests on iqrDiff()... 1008s iqrDiff()...DONE 1008s > 1008s 1008s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1008s Copyright (C) 2024 The R Foundation for Statistical Computing 1008s Platform: aarch64-unknown-linux-gnu (64-bit) 1008s 1008s R is free software and comes with ABSOLUTELY NO WARRANTY. 1008s You are welcome to redistribute it under certain conditions. 1008s Type 'license()' or 'licence()' for distribution details. 1008s 1008s R is a collaborative project with many contributors. 1008s Type 'contributors()' for more information and 1008s 'citation()' on how to cite R or R packages in publications. 1008s 1008s Type 'demo()' for some demos, 'help()' for on-line help, or 1008s 'help.start()' for an HTML browser interface to help. 1008s Type 'q()' to quit R. 1008s 1009s > library("matrixStats") 1009s > 1009s > fcns <- list( 1009s + varDiff = c(rowVarDiffs, colVarDiffs), 1009s + sdDiff = c(rowSdDiffs, colSdDiffs) 1009s + ) 1009s > 1009s > 1009s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1009s > # Subsetted tests 1009s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1009s > source("utils/validateIndicesFramework.R") 1009s > # To check names attribute 1009s > dimnames <- list(letters[1:6], LETTERS[1:6]) 1009s > trim <- runif(1, min = 0, max = 0.5) 1009s > for (fcn in names(fcns)) { 1009s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 1009s + row_fcn <- fcns[[fcn]][[1L]] 1009s + col_fcn <- fcns[[fcn]][[2L]] 1009s + 1009s + for (mode in c("numeric", "integer")) { 1009s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 1009s + storage.mode(x) <- mode 1009s + if (mode == "numeric") x[1:2, 3:4] <- Inf 1009s + 1009s + # Test with and without dimnames on x 1009s + for (setDimnames in c(TRUE, FALSE)) { 1009s + if (setDimnames) dimnames(x) <- dimnames 1009s + else dimnames(x) <- NULL 1009s + 1009s + count <- 0L 1009s + for (diff in 1:2) { 1009s + for (rows in index_cases) { 1009s + for (cols in index_cases) { 1009s + count <- count + 1L 1009s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 1009s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 1009s + useNames <- useNames[count %% length(useNames) + 1] 1009s + 1009s + validateIndicesTestMatrix(x, rows, cols, 1009s + ftest = row_fcn, fsure = row_fcn, 1009s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 1009s + validateIndicesTestMatrix(x, rows, cols, 1009s + fcoltest = col_fcn, fsure = row_fcn, 1009s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 1009s + } 1009s + } 1009s + } 1009s + } 1009s + } 1009s + cat(sprintf("%s()...DONE\n", fcn)) 1009s + } 1010s subsetted tests on varDiff()... 1032s varDiff()...DONE 1032s subsetted tests on sdDiff()... 1050s sdDiff()...DONE 1050s > 1051s 1051s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1051s Copyright (C) 2024 The R Foundation for Statistical Computing 1051s Platform: aarch64-unknown-linux-gnu (64-bit) 1051s 1051s R is free software and comes with ABSOLUTELY NO WARRANTY. 1051s You are welcome to redistribute it under certain conditions. 1051s Type 'license()' or 'licence()' for distribution details. 1051s 1051s R is a collaborative project with many contributors. 1051s Type 'contributors()' for more information and 1051s 'citation()' on how to cite R or R packages in publications. 1051s 1051s Type 'demo()' for some demos, 'help()' for on-line help, or 1051s 'help.start()' for an HTML browser interface to help. 1051s Type 'q()' to quit R. 1051s 1051s > library("matrixStats") 1051s > 1051s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 1051s > options(matrixStats.center.onUse = "ignore") 1051s > options(matrixStats.vars.formula.freq = Inf) 1051s > 1051s > ## Create isFALSE() if running on an old version of R 1051s > if (!exists("isFALSE", mode="function")) { 1051s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 1051s + } 1051s > 1051s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = NA) { 1051s + suppressWarnings({ 1051s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 1051s + }) 1051s + stopifnot(!any(is.infinite(res))) 1051s + 1051s + # Keep naming support consistency same as rowVars() 1051s + if (is.null(center) || ncol(x) <= 1L) { 1051s + if (is.na(useNames) || isFALSE(useNames)) names(res) <- NULL 1051s + } 1051s + else if (isFALSE(useNames)) names(res) <- NULL 1051s + res 1051s + } 1051s > 1051s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = NA) { 1051s + suppressWarnings({ 1051s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 1051s + }) 1051s + stopifnot(!any(is.infinite(res))) 1051s + 1051s + # Keep naming support consistency same as colVars() 1051s + if (is.null(center) || ncol(x) <= 1L) { 1051s + if (is.na(useNames) || isFALSE(useNames)) names(res) <- NULL 1051s + } 1051s + else if (isFALSE(useNames)) names(res) <- NULL 1051s + res 1051s + } 1051s > 1051s > 1051s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 1051s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 1051s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 1051s + stopifnot(!any(is.infinite(res))) 1051s + res 1051s + } 1051s > 1051s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 1051s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 1051s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 1051s + stopifnot(!any(is.infinite(res))) 1051s + res 1051s + } 1051s > 1051s > rowVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = NA) { 1051s + x <- sweep(x, MARGIN = 1, STATS = as.array(center), FUN = "-") 1051s + x[is.infinite(center), ] <- NaN 1051s + res <- rowVars(x, rows = rows, cols = cols, center = rep(0, times = nrow(x)), na.rm = na.rm, useNames = useNames) 1051s + stopifnot(!any(is.infinite(res))) 1051s + res 1051s + } 1051s > 1051s > colVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = NA) { 1051s + x <- sweep(x, MARGIN = 2, STATS = as.array(center), FUN = "-") 1051s + x[, is.infinite(center)] <- NaN 1051s + res <- colVars(x, rows = rows, cols = cols, center = rep(0, times = ncol(x)), na.rm = na.rm, useNames = useNames) 1051s + stopifnot(!any(is.infinite(res))) 1051s + res 1051s + } 1051s > 1051s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1051s > # With and without some NAs or Infs 1051s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1051s > for (mode in c("integer", "double")) { 1051s + if (mode == "integer") { 1051s + specials <- c(0L, NA_integer_) 1051s + delta <- 0L 1051s + } else { 1051s + specials <- c(0, NA_real_, Inf) 1051s + delta <- 0.1 1051s + } 1051s + 1051s + for (special in specials) { 1051s + cat("special = ", special, "\n", sep = "") 1051s + x <- matrix(1:50 + delta, nrow = 10L, ncol = 5L) 1051s + x[3:7, c(2, 4)] <- special 1051s + cat("mode: ", mode, "\n", sep = "") 1051s + str(x) 1051s + stopifnot(storage.mode(x) == mode) 1051s + 1051s + # To check names attribute 1051s + dimnames <- list(letters[1:10], LETTERS[1:5]) 1051s + 1051s + # Test with and without dimnames on x 1051s + for (setDimnames in c(TRUE, FALSE)) { 1051s + if (setDimnames) dimnames(x) <- dimnames 1051s + else dimnames(x) <- NULL 1051s + # Row/column variance 1051s + for (na.rm in c(FALSE, TRUE)) { 1051s + # Check names attribute 1051s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1051s + cat("na.rm = ", na.rm, "\n", sep = "") 1051s + center <- rowMeans(x, na.rm = na.rm) 1051s + 1051s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 1051s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 1051s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 1051s + r1c <- rowVars(x, center = center, na.rm = na.rm, useNames = useNames) 1051s + 1051s + tx <- t(x) 1051s + r2 <- colVars(tx, na.rm = na.rm, useNames = useNames) 1051s + r2b <- colVars_center(tx, na.rm = na.rm, useNames = useNames) 1051s + r2c <- colVars(tx, center = center, na.rm = na.rm, useNames = useNames) 1051s + tx <- NULL 1051s + 1051s + stopifnot(all.equal(r1, r2)) 1051s + stopifnot(all.equal(r1, r0)) 1051s + stopifnot(all.equal(r1b, r1c)) 1051s + stopifnot(all.equal(r2, r0)) 1051s + stopifnot(all.equal(r2b, r2c)) 1051s + 1051s + center <- colMeans(x, na.rm = na.rm) 1051s + 1051s + r3 <- colVars(x, center = center, na.rm = na.rm, useNames = useNames) 1051s + r3b <- colVars_center_naive(x, center = center, na.rm = na.rm, useNames = useNames) 1051s + r3c <- rowVars(t(x), center = center, na.rm = na.rm, useNames = useNames) 1051s + r3d <- rowVars_center_naive(t(x), center = center, na.rm = na.rm, useNames = useNames) 1051s + stopifnot(all.equal(r3b, r3)) 1051s + stopifnot(all.equal(r3c, r3)) 1051s + stopifnot(all.equal(r3d, r3)) 1051s + 1051s + stopifnot( 1051s + !any(is.infinite(r0)), 1051s + !any(is.infinite(r1)), 1051s + !any(is.infinite(r2)), 1051s + !any(is.infinite(r3)), 1051s + !any(is.infinite(r1b)), 1051s + !any(is.infinite(r1c)), 1051s + !any(is.infinite(r2b)), 1051s + !any(is.infinite(r2c)), 1051s + !any(is.infinite(r3b)), 1051s + !any(is.infinite(r3c)), 1051s + !any(is.infinite(r3d)) 1051s + ) 1051s + } 1051s + } 1051s + } 1051s + } # for (special ...) 1051s + } 1052s special = 0 1052s mode: integer 1052s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 1052s na.rm = FALSE 1052s na.rm = FALSE 1052s na.rm = TRUE 1052s na.rm = TRUE 1052s na.rm = FALSE 1052s na.rm = FALSE 1052s na.rm = TRUE 1052s na.rm = TRUE 1052s special = NA 1052s mode: integer 1052s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 1052s na.rm = FALSE 1052s na.rm = FALSE 1052s na.rm = TRUE 1052s na.rm = TRUE 1052s na.rm = FALSE 1052s na.rm = FALSE 1052s na.rm = TRUE 1052s na.rm = TRUE 1052s special = 0 1052s mode: double 1052s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 1052s na.rm = FALSE 1052s na.rm = FALSE 1052s na.rm = TRUE 1052s na.rm = TRUE 1052s na.rm = FALSE 1052s na.rm = FALSE 1052s na.rm = TRUE 1052s na.rm = TRUE 1052s special = NA 1052s mode: double 1052s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 1052s na.rm = FALSE 1052s na.rm = FALSE 1052s na.rm = TRUE 1053s na.rm = TRUE 1053s na.rm = FALSE 1053s na.rm = FALSE 1053s na.rm = TRUE 1053s na.rm = TRUE 1053s special = Inf 1053s mode: double 1053s num [1:10, 1:5] 1.1 2.1 3.1 4.1 5.1 6.1 7.1 8.1 9.1 10.1 ... 1053s na.rm = FALSE 1053s na.rm = FALSE 1053s na.rm = TRUE 1053s na.rm = TRUE 1053s na.rm = FALSE 1053s na.rm = FALSE 1053s na.rm = TRUE 1053s na.rm = TRUE 1053s > 1053s > 1053s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1053s > # All NAs 1053s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1053s > for (mode in c("integer", "double")) { 1053s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 1053s + cat("mode: ", mode, "\n", sep = "") 1053s + storage.mode(x) <- mode 1053s + str(x) 1053s + 1053s + # Test with and without dimnames on x 1053s + for (setDimnames in c(TRUE, FALSE)) { 1053s + if (setDimnames) dimnames(x) <- dimnames 1053s + else dimnames(x) <- NULL 1053s + # Row/column variance 1053s + for (na.rm in c(FALSE, TRUE)) { 1053s + # Check names attribute 1053s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1053s + cat("na.rm = ", na.rm, "\n", sep = "") 1053s + 1053s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 1053s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 1053s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 1053s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 1053s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 1053s + stopifnot(all.equal(r1, r2)) 1053s + stopifnot(all.equal(r1, r0)) 1053s + stopifnot(all.equal(r2, r0)) 1053s + stopifnot(all.equal(r1b, r2b)) 1053s + stopifnot( 1053s + !any(is.infinite(r0)), 1053s + !any(is.infinite(r1)), 1053s + !any(is.infinite(r2)), 1053s + !any(is.infinite(r1b)), 1053s + !any(is.infinite(r2b)) 1053s + ) 1053s + } 1053s + } 1053s + } 1053s + } 1053s mode: integer 1053s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 1053s na.rm = FALSE 1053s na.rm = FALSE 1053s na.rm = TRUE 1053s na.rm = TRUE 1053s na.rm = FALSE 1053s na.rm = FALSE 1053s na.rm = TRUE 1053s na.rm = TRUE 1053s mode: double 1053s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 1053s na.rm = FALSE 1053s na.rm = FALSE 1053s na.rm = TRUE 1053s na.rm = TRUE 1053s na.rm = FALSE 1053s na.rm = FALSE 1053s na.rm = TRUE 1053s na.rm = TRUE 1053s > 1053s > 1053s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1053s > # A 1x1 matrix 1053s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1053s > x <- matrix(0, nrow = 1L, ncol = 1L) 1053s > dimnames <- list("a", "A") 1053s > # Test with and without dimnames on x 1053s > for (setDimnames in c(TRUE, FALSE)) { 1053s + if (setDimnames) dimnames(x) <- dimnames 1053s + else dimnames(x) <- NULL 1053s + # Row/column variance 1053s + for (na.rm in c(FALSE, TRUE)) { 1053s + # Check names attribute 1053s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1053s + cat("na.rm = ", na.rm, "\n", sep = "") 1053s + 1053s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 1053s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 1053s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 1053s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 1053s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 1053s + stopifnot(all.equal(r1, r2)) 1053s + stopifnot(all.equal(r1, r0)) 1053s + stopifnot(all.equal(r2, r0)) 1053s + stopifnot(all.equal(r1b, r2b)) 1053s + stopifnot( 1053s + !any(is.infinite(r0)), 1053s + !any(is.infinite(r1)), 1053s + !any(is.infinite(r2)), 1053s + !any(is.infinite(r1b)), 1053s + !any(is.infinite(r2b)) 1053s + ) 1053s + } 1053s + } 1053s + } 1053s na.rm = FALSE 1053s na.rm = FALSE 1053s na.rm = TRUE 1053s na.rm = TRUE 1053s na.rm = FALSE 1053s na.rm = FALSE 1053s na.rm = TRUE 1053s na.rm = TRUE 1053s > 1053s > 1053s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1053s > # center and .dim 1053s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1053s > m <- matrix(1:12, nrow = 3L, ncol = 4L) 1053s > a <- array(m, dim = c(3, 2, 2)) 1053s > stopifnot(prod(dim(a)) == prod(dim(m))) 1053s > 1053s > y0 <- rowVars(m, dim. = dim(m)) 1053s > print(y0) 1053s [1] 15 15 15 1053s > y1 <- rowVars(a, dim. = dim(m)) 1053s > print(y1) 1053s [1] 15 15 15 1053s > stopifnot(identical(y1, y0)) 1053s > stopifnot( 1053s + !any(is.infinite(y0)), 1053s + !any(is.infinite(y1)) 1053s + ) 1053s > 1053s > mu <- rowMeans(m) 1053s > y0 <- rowVars(m, center = mu, dim. = dim(m)) 1053s > print(y0) 1053s [1] 15 15 15 1053s > y1 <- rowVars(a, center = mu, dim. = dim(m)) 1053s > print(y1) 1053s [1] 15 15 15 1053s > stopifnot(identical(y1, y0)) 1053s > stopifnot( 1053s + !any(is.infinite(y0)), 1053s + !any(is.infinite(y1)) 1053s + ) 1053s > 1053s > 1053s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1053s > # Corner cases 1053s > # https://github.com/HenrikBengtsson/matrixStats/issues/195 1053s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1053s > x <- matrix(c(1,2,3,4), nrow = 2L, ncol = 2L) 1053s > x[1,1] <- NA_real_ 1053s > x[1,2] <- Inf 1053s > 1053s > center <- colMeans2(x, na.rm = TRUE) 1053s > y <- colVars(x, center = center, na.rm = TRUE) 1053s > stopifnot(!any(is.infinite(y))) 1053s > 1053s > x <- t(x) 1053s > center <- rowMeans2(x, na.rm = TRUE) 1053s > y <- rowVars(x, center = center, na.rm = TRUE) 1053s > stopifnot(!any(is.infinite(y))) 1053s > 1054s 1054s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1054s Copyright (C) 2024 The R Foundation for Statistical Computing 1054s Platform: aarch64-unknown-linux-gnu (64-bit) 1054s 1054s R is free software and comes with ABSOLUTELY NO WARRANTY. 1054s You are welcome to redistribute it under certain conditions. 1054s Type 'license()' or 'licence()' for distribution details. 1054s 1054s R is a collaborative project with many contributors. 1054s Type 'contributors()' for more information and 1054s 'citation()' on how to cite R or R packages in publications. 1054s 1054s Type 'demo()' for some demos, 'help()' for on-line help, or 1054s 'help.start()' for an HTML browser interface to help. 1054s Type 'q()' to quit R. 1054s 1054s > library("matrixStats") 1054s > 1054s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 1054s > options(matrixStats.center.onUse = "ignore") 1054s > 1054s > ## Create isFALSE() if running on an old version of R 1054s > if (!exists("isFALSE", mode="function")) { 1054s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 1054s + } 1054s > 1054s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = NA) { 1054s + suppressWarnings({ 1054s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 1054s + }) 1054s + stopifnot(!any(is.infinite(res))) 1054s + 1054s + # Keep naming support consistency same as rowVars() 1054s + if (is.null(center) || ncol(x) <= 1L) { 1054s + if (is.na(useNames) || isFALSE(useNames)) names(res) <- NULL 1054s + } 1054s + else if (isFALSE(useNames)) names(res) <- NULL 1054s + res 1054s + } 1054s > 1054s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = NA) { 1054s + suppressWarnings({ 1054s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 1054s + }) 1054s + stopifnot(!any(is.infinite(res))) 1054s + 1054s + # Keep naming support consistency same as colVars() 1054s + if (is.null(center) || nrow(x) <= 1L) { 1054s + if (is.na(useNames) || isFALSE(useNames)) names(res) <- NULL 1054s + } 1054s + else if (isFALSE(useNames)) names(res) <- NULL 1054s + res 1054s + } 1054s > 1054s > 1054s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 1054s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 1054s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 1054s + stopifnot(!any(is.infinite(res))) 1054s + res 1054s + } 1054s > 1054s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = NA) { 1054s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 1054s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 1054s + stopifnot(!any(is.infinite(res))) 1054s + res 1054s + } 1054s > 1054s > 1054s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1054s > # Subsetted tests 1054s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1054s > source("utils/validateIndicesFramework.R") 1054s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 1054s > storage.mode(x) <- "integer" 1054s > 1054s > # To check names attribute 1054s > dimnames <- list(letters[1:6], LETTERS[1:6]) 1054s > 1054s > # Test with and without dimnames on x 1054s > for (setDimnames in c(TRUE, FALSE)) { 1054s + if (setDimnames) dimnames(x) <- dimnames 1054s + else dimnames(x) <- NULL 1054s + 1054s + count <- 0L 1054s + for (rows in index_cases) { 1054s + for (cols in index_cases) { 1054s + count <- count + 1L 1054s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 1054s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 1054s + useNames <- useNames[count %% length(useNames) + 1] 1054s + 1054s + validateIndicesTestMatrix(x, rows, cols, 1054s + ftest = rowVars, fsure = rowVars_R, 1054s + na.rm = na.rm, useNames = useNames) 1054s + validateIndicesTestMatrix(x, rows, cols, 1054s + ftest = rowVars_center, fsure = rowVars_R, 1054s + na.rm = na.rm, center = TRUE, useNames = useNames) 1054s + 1054s + validateIndicesTestMatrix(x, rows, cols, 1054s + fcoltest = colVars, fsure = rowVars_R, 1054s + na.rm = na.rm, useNames = useNames) 1054s + validateIndicesTestMatrix(x, rows, cols, 1054s + fcoltest = colVars_center, fsure = rowVars_R, 1054s + na.rm = na.rm, center = TRUE, useNames = useNames) 1054s + } 1054s + } 1054s + } 1059s > 1060s 1060s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1060s Copyright (C) 2024 The R Foundation for Statistical Computing 1060s Platform: aarch64-unknown-linux-gnu (64-bit) 1060s 1060s R is free software and comes with ABSOLUTELY NO WARRANTY. 1060s You are welcome to redistribute it under certain conditions. 1060s Type 'license()' or 'licence()' for distribution details. 1060s 1060s R is a collaborative project with many contributors. 1060s Type 'contributors()' for more information and 1060s 'citation()' on how to cite R or R packages in publications. 1060s 1060s Type 'demo()' for some demos, 'help()' for on-line help, or 1060s 'help.start()' for an HTML browser interface to help. 1060s Type 'q()' to quit R. 1060s 1060s > library("matrixStats") 1060s > 1060s > ## Create isFALSE() if running on an old version of R 1060s > if (!exists("isFALSE", mode="function")) { 1060s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 1060s + } 1060s > 1060s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = NA) { 1060s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 1060s + 1060s + # Keep naming support consistency same as rowWeightedMeans() 1060s + idxs <- which(is.na(w) | w != 0) 1060s + nw <- length(idxs) 1060s + if (na.rm) na.rm <- anyMissing(x) 1060s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 1060s + if (is.na(useNames) || !useNames) names(res) <- NULL 1060s + } 1060s + else if (isFALSE(useNames)) names(res) <- NULL 1060s + 1060s + res 1060s + } 1060s > 1060s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = NA) { 1060s + res <- apply(x, MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 1060s + 1060s + # Keep naming support consistency same as colWeightedMeans() 1060s + idxs <- which(is.na(w) | w != 0) 1060s + nw <- length(idxs) 1060s + if (!is.null(w) && nw == 0L) { 1060s + if (is.na(useNames) || !useNames) names(res) <- NULL 1060s + } 1060s + else if (isFALSE(useNames)) names(res) <- NULL 1060s + 1060s + res 1060s + } 1060s > 1060s > set.seed(1) 1060s > 1060s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 1060s > print(x) 1060s [,1] [,2] [,3] [,4] 1060s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 1060s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 1060s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 1060s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 1060s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 1060s > 1060s > # To check names attribute 1060s > dimnames <- list(letters[1:5], LETTERS[1:4]) 1060s > 1060s > # Non-weighted row averages 1060s > x_est0 <- rowMeans(x) 1060s > x_est1 <- rowWeightedMeans(x) 1060s > print(x_est1) 1060s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 1060s > stopifnot(all.equal(x_est1, x_est0)) 1060s > x_est2 <- colWeightedMeans(t(x)) 1060s > stopifnot(all.equal(x_est2, x_est0)) 1060s > # Check names attribute 1060s > dimnames(x) <- dimnames 1060s > x_est1 <- rowWeightedMeans(x, useNames = FALSE) 1060s > x_est2 <- colWeightedMeans(t(x), useNames = FALSE) 1060s > stopifnot(all.equal(x_est1, x_est0)) 1060s > stopifnot(all.equal(x_est2, x_est0)) 1060s > x_est0 <- rowMeans(x) 1060s > x_est1 <- rowWeightedMeans(x, useNames = TRUE) 1060s > x_est2 <- colWeightedMeans(t(x), useNames = TRUE) 1060s > stopifnot(all.equal(x_est1, x_est0)) 1060s > stopifnot(all.equal(x_est2, x_est0)) 1060s > dimnames(x) <- NULL 1060s > 1060s > 1060s > # Weighted row averages (uniform weights) 1060s > w <- rep(2.5, times = ncol(x)) 1060s > x_est0 <- rowMeans(x) 1060s > x_est1 <- rowWeightedMeans(x, w = w) 1060s > print(x_est1) 1060s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 1060s > stopifnot(all.equal(x_est1, x_est0)) 1060s > x_est2 <- colWeightedMeans(t(x), w = w) 1060s > stopifnot(all.equal(x_est2, x_est0)) 1060s > # Test with and without dimnames on x 1060s > for (setDimnames in c(TRUE, FALSE)) { 1060s + if (setDimnames) dimnames(x) <- dimnames 1060s + else dimnames(x) <- NULL 1060s + # Check names attribute 1060s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1060s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 1060s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 1060s + stopifnot(all.equal(x_est1, x_est0)) 1060s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 1060s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 1060s + stopifnot(all.equal(x_est1, x_est0)) 1060s + } 1060s + } 1061s > 1061s > 1061s > # Weighted row averages (excluding some columns) 1061s > w <- c(1, 1, 0, 1) 1061s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 1061s > x_est1 <- rowWeightedMeans(x, w = w) 1061s > print(x_est1) 1061s [1] -0.4972853 0.2182940 0.2821774 0.9974278 0.2060069 1061s > stopifnot(all.equal(x_est1, x_est0)) 1061s > x_est2 <- colWeightedMeans(t(x), w = w) 1061s > stopifnot(all.equal(x_est2, x_est0)) 1061s > # Test with and without dimnames on x 1061s > for (setDimnames in c(TRUE, FALSE)) { 1061s + if (setDimnames) dimnames(x) <- dimnames 1061s + else dimnames(x) <- NULL 1061s + # Check names attribute 1061s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1061s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 1061s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 1061s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + } 1061s + } 1061s > 1061s > 1061s > # Weighted row averages (excluding some columns) 1061s > w <- c(0, 1, 0, 0) 1061s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 1061s > x_est1 <- rowWeightedMeans(x, w = w) 1061s > stopifnot(all.equal(x_est1, x_est0)) 1061s > x_est2 <- colWeightedMeans(t(x), w = w) 1061s > stopifnot(all.equal(x_est2, x_est0)) 1061s > # Test with and without dimnames on x 1061s > for (setDimnames in c(TRUE, FALSE)) { 1061s + if (setDimnames) dimnames(x) <- dimnames 1061s + else dimnames(x) <- NULL 1061s + # Check names attribute 1061s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1061s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 1061s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 1061s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + } 1061s + } 1061s > 1061s > 1061s > # Weighted row averages (all zero weights) 1061s > w <- c(0, 0, 0, 0) 1061s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 1061s > x_est1 <- rowWeightedMeans(x, w = w) 1061s > stopifnot(all.equal(x_est1, x_est0)) 1061s > x_est2 <- colWeightedMeans(t(x), w = w) 1061s > stopifnot(all.equal(x_est2, x_est0)) 1061s > # Test with and without dimnames on x 1061s > for (setDimnames in c(TRUE, FALSE)) { 1061s + if (setDimnames) dimnames(x) <- dimnames 1061s + else dimnames(x) <- NULL 1061s + # Check names attribute 1061s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1061s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 1061s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 1061s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + } 1061s + } 1061s > 1061s > 1061s > # Weighted averages by rows and columns 1061s > w <- 1:4 1061s > x_est1 <- rowWeightedMeans(x, w = w) 1061s > print(x_est1) 1061s [1] 0.20882185 0.22632701 0.25526439 -0.06123714 0.54691290 1061s > x_est2 <- colWeightedMeans(t(x), w = w) 1061s > stopifnot(all.equal(x_est2, x_est1)) 1061s > # Test with and without dimnames on x 1061s > for (setDimnames in c(TRUE, FALSE)) { 1061s + if (setDimnames) dimnames(x) <- dimnames 1061s + else dimnames(x) <- NULL 1061s + # Check names attribute 1061s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1061s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 1061s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 1061s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + } 1061s + } 1061s > 1061s > 1061s > x[sample(length(x), size = 0.3 * length(x))] <- NA 1061s > print(x) 1061s [,1] [,2] [,3] [,4] 1061s [1,] -0.6264538 NA 1.5117812 -0.04493361 1061s [2,] 0.1836433 NA NA -0.01619026 1061s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 1061s [4,] 1.5952808 NA -2.2146999 0.82122120 1061s [5,] 0.3295078 NA NA 0.59390132 1061s > 1061s > # Non-weighted row averages with missing values 1061s > x_est0 <- rowMeans(x, na.rm = TRUE) 1061s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE) 1061s > print(x_est1) 1061s [1] 0.28013125 0.08372653 0.05632293 0.06726737 0.46170455 1061s > stopifnot(all.equal(x_est1, x_est0)) 1061s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE) 1061s > stopifnot(all.equal(x_est2, x_est0)) 1061s > # Check names attribute 1061s > dimnames(x) <- dimnames 1061s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = FALSE) 1061s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = FALSE) 1061s > stopifnot(all.equal(x_est1, x_est0)) 1061s > stopifnot(all.equal(x_est2, x_est0)) 1061s > x_est0 <- rowMeans(x, na.rm = TRUE) 1061s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = TRUE) 1061s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = TRUE) 1061s > stopifnot(all.equal(x_est1, x_est0)) 1061s > stopifnot(all.equal(x_est2, x_est0)) 1061s > dimnames(x) <- NULL 1061s > 1061s > 1061s > # Weighted row averages with missing values 1061s > x_est0 <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = TRUE) 1061s > print(x_est0) 1061s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 1061s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 1061s > print(x_est1) 1061s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 1061s > stopifnot(all.equal(x_est1, x_est0)) 1061s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 1061s > stopifnot(all.equal(x_est2, x_est0)) 1061s > # Test with and without dimnames on x 1061s > for (setDimnames in c(TRUE, FALSE)) { 1061s + if (setDimnames) dimnames(x) <- dimnames 1061s + else dimnames(x) <- NULL 1061s + # Check names attribute 1061s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1061s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 1061s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 1061s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + } 1061s + } 1061s > 1061s > 1061s > # Weighted averages by rows and columns 1061s > w <- 1:4 1061s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 1061s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 1061s > stopifnot(all.equal(x_est2, x_est1)) 1061s > # Test with and without dimnames on x 1061s > for (setDimnames in c(TRUE, FALSE)) { 1061s + if (setDimnames) dimnames(x) <- dimnames 1061s + else dimnames(x) <- NULL 1061s + # Check names attribute 1061s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1061s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 1061s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 1061s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + } 1061s + } 1061s > 1061s > 1061s > # w contains missing value 1061s > w[1] <- NA_integer_ 1061s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 1061s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 1061s > stopifnot(all.equal(x_est2, x_est1)) 1061s > # Test with and without dimnames on x 1061s > for (setDimnames in c(TRUE, FALSE)) { 1061s + if (setDimnames) dimnames(x) <- dimnames 1061s + else dimnames(x) <- NULL 1061s + # Check names attribute 1061s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1061s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 1061s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 1061s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + } 1061s + } 1061s > 1061s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE) 1061s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = FALSE) 1061s > stopifnot(all.equal(x_est2, x_est1)) 1061s > # Test with and without dimnames on x 1061s > for (setDimnames in c(TRUE, FALSE)) { 1061s + if (setDimnames) dimnames(x) <- dimnames 1061s + else dimnames(x) <- NULL 1061s + # Check names attribute 1061s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1061s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = FALSE, useNames = useNames) 1061s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = FALSE, useNames = useNames) 1061s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = FALSE, useNames = useNames) 1061s + stopifnot(all.equal(x_est1, x_est0)) 1061s + } 1061s + } 1061s > 1061s 1061s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1061s Copyright (C) 2024 The R Foundation for Statistical Computing 1061s Platform: aarch64-unknown-linux-gnu (64-bit) 1061s 1061s R is free software and comes with ABSOLUTELY NO WARRANTY. 1061s You are welcome to redistribute it under certain conditions. 1061s Type 'license()' or 'licence()' for distribution details. 1061s 1061s R is a collaborative project with many contributors. 1061s Type 'contributors()' for more information and 1061s 'citation()' on how to cite R or R packages in publications. 1061s 1061s Type 'demo()' for some demos, 'help()' for on-line help, or 1061s 'help.start()' for an HTML browser interface to help. 1061s Type 'q()' to quit R. 1061s 1062s > library("matrixStats") 1062s > 1062s > ## Create isFALSE() if running on an old version of R 1062s > if (!exists("isFALSE", mode="function")) { 1062s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 1062s + } 1062s > 1062s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = NA) { 1062s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 1062s + 1062s + # Keep naming support consistency same as rowWeightedMeans() 1062s + idxs <- which(is.na(w) | w != 0) 1062s + nw <- length(idxs) 1062s + if (na.rm) na.rm <- anyMissing(x) 1062s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 1062s + if (is.na(useNames) || !useNames) names(res) <- NULL 1062s + } 1062s + else if (isFALSE(useNames)) names(res) <- NULL 1062s + 1062s + res 1062s + } 1062s > 1062s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = NA) { 1062s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 1062s + 1062s + # Keep naming support consistency same as colWeightedMeans() 1062s + idxs <- which(is.na(w) | w != 0) 1062s + nw <- length(idxs) 1062s + if (!is.null(w) && nw == 0L) { 1062s + if (is.na(useNames) || !useNames) names(res) <- NULL 1062s + } 1062s + else if (isFALSE(useNames)) names(res) <- NULL 1062s + 1062s + res 1062s + } 1062s > 1062s > 1062s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1062s > # Subsetted tests 1062s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1062s > source("utils/validateIndicesFramework.R") 1062s > # To check names attribute 1062s > dimnames <- list(letters[1:6], LETTERS[1:6]) 1062s > for (mode in c("numeric", "integer", "logical")) { 1062s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 1062s + w <- runif(6, min = 0, max = 6) 1062s + storage.mode(x) <- mode 1062s + storage.mode(w) <- if (mode == "logical") "integer" else mode 1062s + if (mode == "numeric") w[1] <- Inf 1062s + 1062s + # Test with and without dimnames on x 1062s + for (setDimnames in c(TRUE, FALSE)) { 1062s + if (setDimnames) dimnames(x) <- dimnames 1062s + else dimnames(x) <- NULL 1062s + 1062s + count <- 0L 1062s + for (rows in index_cases) { 1062s + for (cols in index_cases) { 1062s + count <- count + 1L 1062s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 1062s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 1062s + useNames <- useNames[count %% length(useNames) + 1] 1062s + 1062s + validateIndicesTestMatrix_w(x, w, rows, cols, 1062s + ftest = rowWeightedMeans, fsure = rowWeightedMeans_R, 1062s + na.rm = na.rm, useNames = useNames) 1062s + validateIndicesTestMatrix_w(x, w, rows, cols, 1062s + fcoltest = colWeightedMeans, fsure = colWeightedMeans_R, 1062s + na.rm = na.rm, useNames = useNames) 1062s + } 1062s + } 1062s + } 1062s + } 1069s > 1069s 1069s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1069s Copyright (C) 2024 The R Foundation for Statistical Computing 1069s Platform: aarch64-unknown-linux-gnu (64-bit) 1069s 1069s R is free software and comes with ABSOLUTELY NO WARRANTY. 1069s You are welcome to redistribute it under certain conditions. 1069s Type 'license()' or 'licence()' for distribution details. 1069s 1069s R is a collaborative project with many contributors. 1069s Type 'contributors()' for more information and 1069s 'citation()' on how to cite R or R packages in publications. 1069s 1069s Type 'demo()' for some demos, 'help()' for on-line help, or 1069s 'help.start()' for an HTML browser interface to help. 1069s Type 'q()' to quit R. 1069s 1069s > library("matrixStats") 1069s > 1069s > ## Create isFALSE() if running on an old version of R 1069s > if (!exists("isFALSE", mode="function")) { 1069s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 1069s + } 1069s > 1069s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = NA) { 1069s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 1069s + 1069s + # Keep naming support consistency same as rowWeightedMedians() 1069s + if (!is.null(w)) { 1069s + if (isFALSE(useNames)) names(res) <- NULL 1069s + } 1069s + else if (is.na(useNames) || !useNames) names(res) <- NULL 1069s + 1069s + res 1069s + } 1069s > 1069s > colWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = NA) { 1069s + res <- apply(x, MARGIN = 2L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 1069s + 1069s + # Keep naming support consistency same as colWeightedMedians() 1069s + if (!is.null(w)) { 1069s + if (isFALSE(useNames)) names(res) <- NULL 1069s + } 1069s + else if (is.na(useNames) || !useNames) names(res) <- NULL 1069s + 1069s + res 1069s + } 1069s > 1069s > set.seed(1) 1069s > 1069s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 1069s > print(x) 1069s [,1] [,2] [,3] [,4] 1069s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 1069s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 1069s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 1069s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 1069s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 1069s > 1069s > # To check names attribute 1069s > dimnames <- list(letters[1:5], LETTERS[1:4]) 1069s > 1069s > # Non-weighted row medians 1069s > x_est0 <- rowMedians(x) 1069s > x_est1 <- rowWeightedMedians(x) 1069s > stopifnot(all.equal(x_est1, x_est0)) 1069s > x_est2 <- colWeightedMedians(t(x)) 1069s > stopifnot(all.equal(x_est2, x_est0)) 1069s > # Test with and without dimnames on x 1069s > for (setDimnames in c(TRUE, FALSE)) { 1069s + if (setDimnames) dimnames(x) <- dimnames 1069s + else dimnames(x) <- NULL 1069s + # Check names attribute 1069s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1069s + x_est0 <- rowMedians(x, useNames = useNames) 1069s + x_est1 <- rowWeightedMedians(x, useNames = useNames) 1069s + x_est2 <- colWeightedMedians(t(x), useNames = useNames) 1069s + stopifnot(all.equal(x_est1, x_est0)) 1069s + stopifnot(all.equal(x_est2, x_est0)) 1069s + } 1069s + } 1070s > 1070s > 1070s > # Weighted row medians (uniform weights) 1070s > w <- rep(2.5, times = ncol(x)) 1070s > x_est0 <- rowMedians(x) 1070s > x_est1 <- rowWeightedMedians(x, w = w) 1070s > stopifnot(all.equal(x_est1, x_est0)) 1070s > x_est2 <- colWeightedMedians(t(x), w = w) 1070s > stopifnot(all.equal(x_est2, x_est0)) 1070s > # Test with and without dimnames on x 1070s > for (setDimnames in c(TRUE, FALSE)) { 1070s + if (setDimnames) dimnames(x) <- dimnames 1070s + else dimnames(x) <- NULL 1070s + # Check names attribute 1070s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1070s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 1070s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 1070s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + } 1070s + } 1070s > 1070s > 1070s > # Weighted row medians (excluding some columns) 1070s > w <- c(1, 1, 0, 1) 1070s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 1070s > x_est1 <- rowWeightedMedians(x, w = w) 1070s > stopifnot(all.equal(x_est1, x_est0)) 1070s > x_est2 <- colWeightedMedians(t(x), w = w) 1070s > stopifnot(all.equal(x_est2, x_est0)) 1070s > # Test with and without dimnames on x 1070s > for (setDimnames in c(TRUE, FALSE)) { 1070s + if (setDimnames) dimnames(x) <- dimnames 1070s + else dimnames(x) <- NULL 1070s + # Check names attribute 1070s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1070s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 1070s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 1070s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + } 1070s + } 1070s > 1070s > # Weighted row medians (excluding some columns) 1070s > w <- c(0, 1, 0, 0) 1070s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 1070s > x_est1 <- rowWeightedMedians(x, w = w) 1070s > stopifnot(all.equal(x_est1, x_est0)) 1070s > x_est2 <- colWeightedMedians(t(x), w = w) 1070s > stopifnot(all.equal(x_est2, x_est0)) 1070s > # Test with and without dimnames on x 1070s > for (setDimnames in c(TRUE, FALSE)) { 1070s + if (setDimnames) dimnames(x) <- dimnames 1070s + else dimnames(x) <- NULL 1070s + # Check names attribute 1070s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1070s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 1070s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 1070s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + } 1070s + } 1070s > 1070s > # Weighted row medians (all zero weights) 1070s > w <- c(0, 0, 0, 0) 1070s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 1070s > x_est1 <- rowWeightedMedians(x, w = w) 1070s > stopifnot(all.equal(x_est1, x_est0)) 1070s > x_est2 <- colWeightedMedians(t(x), w = w) 1070s > stopifnot(all.equal(x_est2, x_est0)) 1070s > # Test with and without dimnames on x 1070s > for (setDimnames in c(TRUE, FALSE)) { 1070s + if (setDimnames) dimnames(x) <- dimnames 1070s + else dimnames(x) <- NULL 1070s + # Check names attribute 1070s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1070s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 1070s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 1070s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + } 1070s + } 1070s > 1070s > # Weighted medians by rows and columns 1070s > w <- 1:4 1070s > x_est1 <- rowWeightedMedians(x, w = w) 1070s > x_est2 <- colWeightedMedians(t(x), w = w) 1070s > stopifnot(all.equal(x_est2, x_est1)) 1070s > # Test with and without dimnames on x 1070s > for (setDimnames in c(TRUE, FALSE)) { 1070s + if (setDimnames) dimnames(x) <- dimnames 1070s + else dimnames(x) <- NULL 1070s + # Check names attribute 1070s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1070s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 1070s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 1070s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + } 1070s + } 1070s > 1070s > 1070s > # Weighted row medians with missing values 1070s > x_est0 <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = TRUE) 1070s > print(x_est0) 1070s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 1070s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 1070s > print(x_est1) 1070s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 1070s > stopifnot(all.equal(x_est1, x_est0)) 1070s > x_est2 <- colWeightedMedians(t(x), w = w) 1070s > stopifnot(all.equal(x_est2, x_est0)) 1070s > # Test with and without dimnames on x 1070s > for (setDimnames in c(TRUE, FALSE)) { 1070s + if (setDimnames) dimnames(x) <- dimnames 1070s + else dimnames(x) <- NULL 1070s + # Check names attribute 1070s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1070s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 1070s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 1070s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + } 1070s + } 1070s > 1070s > # Weighted medians by rows and columns 1070s > w <- 1:4 1070s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 1070s > x_est2 <- colWeightedMedians(t(x), w = w, na.rm = TRUE) 1070s > stopifnot(all.equal(x_est2, x_est1)) 1070s > # Test with and without dimnames on x 1070s > for (setDimnames in c(TRUE, FALSE)) { 1070s + if (setDimnames) dimnames(x) <- dimnames 1070s + else dimnames(x) <- NULL 1070s + # Check names attribute 1070s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1070s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 1070s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 1070s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + } 1070s + } 1070s > 1070s > 1070s > # Inf weight 1070s > x <- matrix(1:2, nrow = 1, ncol = 2) 1070s > w <- c(7, Inf) 1070s > x_est1 <- rowWeightedMedians(x, w = w) 1070s > x_est2 <- colWeightedMedians(t(x), w = w) 1070s > stopifnot(identical(2, x_est1)) 1070s > stopifnot(identical(2, x_est2)) 1070s > # Test with and without dimnames on x 1070s > dimnames <- list("a", LETTERS[1:2]) 1070s > for (setDimnames in c(TRUE, FALSE)) { 1070s + if (setDimnames) dimnames(x) <- dimnames 1070s + else dimnames(x) <- NULL 1070s + # Check names attribute 1070s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1070s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 1070s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 1070s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 1070s + stopifnot(all.equal(x_est1, x_est0)) 1070s + } 1070s + } 1070s > 1071s 1071s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1071s Copyright (C) 2024 The R Foundation for Statistical Computing 1071s Platform: aarch64-unknown-linux-gnu (64-bit) 1071s 1071s R is free software and comes with ABSOLUTELY NO WARRANTY. 1071s You are welcome to redistribute it under certain conditions. 1071s Type 'license()' or 'licence()' for distribution details. 1071s 1071s R is a collaborative project with many contributors. 1071s Type 'contributors()' for more information and 1071s 'citation()' on how to cite R or R packages in publications. 1071s 1071s Type 'demo()' for some demos, 'help()' for on-line help, or 1071s 'help.start()' for an HTML browser interface to help. 1071s Type 'q()' to quit R. 1071s 1071s > library("matrixStats") 1071s > 1071s > ## Create isFALSE() if running on an old version of R 1071s > if (!exists("isFALSE", mode="function")) { 1071s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 1071s + } 1071s > 1071s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = NA) { 1071s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 1071s + 1071s + # Keep naming support consistency same as rowWeightedMedians() 1071s + if (!is.null(w)) { 1071s + if (isFALSE(useNames)) names(res) <- NULL 1071s + } 1071s + else if (is.na(useNames) || !useNames) names(res) <- NULL 1071s + 1071s + res 1071s + } 1071s > 1071s > 1071s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1071s > # Subsetted tests 1071s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1071s > source("utils/validateIndicesFramework.R") 1071s > # To check names attribute 1071s > dimnames <- list(letters[1:6], LETTERS[1:6]) 1071s > for (mode in c("numeric", "integer", "logical")) { 1071s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 1071s + w <- runif(6, min = 0, max = 6) 1071s + storage.mode(x) <- mode 1071s + storage.mode(w) <- if (mode == "logical") "integer" else mode 1071s + if (mode == "numeric") w[1] <- Inf 1071s + 1071s + # Test with and without dimnames on x 1071s + for (setDimnames in c(TRUE, FALSE)) { 1071s + if (setDimnames) dimnames(x) <- dimnames 1071s + else dimnames(x) <- NULL 1071s + 1071s + count <- 0L 1071s + for (rows in index_cases) { 1071s + for (cols in index_cases) { 1071s + count <- count + 1L 1071s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 1071s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 1071s + useNames <- useNames[count %% length(useNames) + 1] 1071s + 1071s + validateIndicesTestMatrix_w(x, w, rows, cols, 1071s + ftest = rowWeightedMedians, 1071s + fsure = rowWeightedMedians_R, 1071s + na.rm = na.rm, useNames = useNames) 1071s + validateIndicesTestMatrix_w(x, w, rows, cols, 1071s + fcoltest = colWeightedMedians, 1071s + fsure = rowWeightedMedians_R, 1071s + na.rm = na.rm, useNames = useNames) 1071s + } 1071s + } 1071s + } 1071s + } 1079s > 1079s 1079s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1079s Copyright (C) 2024 The R Foundation for Statistical Computing 1079s Platform: aarch64-unknown-linux-gnu (64-bit) 1079s 1079s R is free software and comes with ABSOLUTELY NO WARRANTY. 1079s You are welcome to redistribute it under certain conditions. 1079s Type 'license()' or 'licence()' for distribution details. 1079s 1079s R is a collaborative project with many contributors. 1079s Type 'contributors()' for more information and 1079s 'citation()' on how to cite R or R packages in publications. 1079s 1079s Type 'demo()' for some demos, 'help()' for on-line help, or 1079s 'help.start()' for an HTML browser interface to help. 1079s Type 'q()' to quit R. 1079s 1080s > library("matrixStats") 1080s > 1080s > set.seed(1) 1080s > 1080s > x <- matrix(rnorm(20), nrow = 5L, ncol = 4L) 1080s > print(x) 1080s [,1] [,2] [,3] [,4] 1080s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 1080s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 1080s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 1080s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 1080s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 1080s > 1080s > # To check names attribute 1080s > dimnames <- list(letters[1:5], LETTERS[1:4]) 1080s > 1080s > # Weighted row variances (uniform weights - all w = 1) 1080s > # Non-weighted row variances 1080s > x_est0 <- rowVars(x) 1080s > w <- rep(1, times = ncol(x)) 1080s > x_est1 <- rowWeightedVars(x, w = w) 1080s > print(x_est1) 1080s [1] 1.11767161 0.05022969 0.83582537 2.76819528 0.35351857 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > x_est2 <- colWeightedVars(t(x), w = w) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > # Check names attribute 1080s > dimnames(x) <- dimnames 1080s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 1080s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > x_est0 <- rowVars(x, useNames = TRUE) 1080s > if (!matrixStats:::isUseNamesNADefunct()) { 1080s + x_est1 <- rowWeightedVars(x, w = w, useNames = NA) 1080s + x_est2 <- colWeightedVars(t(x), w = w, useNames = NA) 1080s + stopifnot(all.equal(x_est1, x_est0)) 1080s + stopifnot(all.equal(x_est2, x_est0)) 1080s + } 1080s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 1080s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > dimnames(x) <- NULL 1080s > 1080s > 1080s > # Weighted row variances (uniform weights - all w = 3) 1080s > x3 <- cbind(x, x, x) 1080s > x_est0 <- rowVars(x3) 1080s > w <- rep(3, times = ncol(x)) 1080s > x_est1 <- rowWeightedVars(x, w = w) 1080s > print(x_est1) 1080s [1] 0.91445859 0.04109702 0.68385712 2.26488705 0.28924246 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > x_est2 <- colWeightedVars(t(x), w = w) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > # Check names attribute 1080s > dimnames(x) <- dimnames 1080s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 1080s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > x3 <- cbind(x, x, x) 1080s > x_est0 <- rowVars(x3, useNames = TRUE) 1080s > if (!matrixStats:::isUseNamesNADefunct()) { 1080s + x_est1 <- rowWeightedVars(x, w = w, useNames = NA) 1080s + x_est2 <- colWeightedVars(t(x), w = w, useNames = NA) 1080s + stopifnot(all.equal(x_est1, x_est0)) 1080s + stopifnot(all.equal(x_est2, x_est0)) 1080s + } 1080s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 1080s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > dimnames(x) <- NULL 1080s > 1080s > 1080s > # Weighted row variances (excluding some columns) 1080s > w <- c(1, 1, 0, 1) 1080s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 1080s > x_est1 <- rowWeightedVars(x, w = w) 1080s > print(x_est1) 1080s [1] 0.16287693 0.06430861 0.94767651 0.28313135 0.21361984 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > x_est2 <- colWeightedVars(t(x), w = w) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > # Check names attribute 1080s > dimnames(x) <- dimnames 1080s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 1080s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 1080s > if (!matrixStats:::isUseNamesNADefunct()) { 1080s + x_est1 <- rowWeightedVars(x, w = w, useNames = NA) 1080s + x_est2 <- colWeightedVars(t(x), w = w, useNames = NA) 1080s + stopifnot(all.equal(x_est1, x_est0)) 1080s + stopifnot(all.equal(x_est2, x_est0)) 1080s + } 1080s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 1080s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > dimnames(x) <- NULL 1080s > 1080s > 1080s > # Weighted row variances (excluding some columns) 1080s > w <- c(0, 1, 0, 0) 1080s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 1080s > x_est1 <- rowWeightedVars(x, w = w) 1080s > #stopifnot(all.equal(x_est1, x_est0)) 1080s > x_est2 <- colWeightedVars(t(x), w = w) 1080s > stopifnot(all.equal(x_est2, x_est1)) 1080s > # Check names attribute 1080s > dimnames(x) <- dimnames 1080s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 1080s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 1080s > if (!matrixStats:::isUseNamesNADefunct()) { 1080s + x_est1 <- rowWeightedVars(x, w = w, useNames = NA) 1080s + x_est2 <- colWeightedVars(t(x), w = w, useNames = NA) 1080s + stopifnot(all.equal(x_est1, x_est0)) 1080s + stopifnot(all.equal(x_est2, x_est0)) 1080s + } 1080s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 1080s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > dimnames(x) <- NULL 1080s > 1080s > 1080s > # Weighted row variances (all zero weights) 1080s > w <- c(0, 0, 0, 0) 1080s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 1080s > x_est1 <- rowWeightedVars(x, w = w) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > x_est2 <- colWeightedVars(t(x), w = w) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > # Check names attribute 1080s > dimnames(x) <- dimnames 1080s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 1080s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 1080s > if (!matrixStats:::isUseNamesNADefunct()) { 1080s + x_est1 <- rowWeightedVars(x, w = w, useNames = NA) 1080s + x_est2 <- colWeightedVars(t(x), w = w, useNames = NA) 1080s + stopifnot(all.equal(x_est1, x_est0)) 1080s + stopifnot(all.equal(x_est2, x_est0)) 1080s + } 1080s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 1080s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > dimnames(x) <- NULL 1080s > 1080s > # Weighted variances by rows and columns 1080s > w <- 1:4 1080s > # Test with and without dimnames on x 1080s > for (setDimnames in c(TRUE, FALSE)) { 1080s + if (setDimnames) dimnames(x) <- dimnames 1080s + else dimnames(x) <- NULL 1080s + # Check names attribute 1080s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1080s + x_est1 <- rowWeightedVars(x, w = w, useNames = useNames) 1080s + print(x_est1) 1080s + x_est2 <- colWeightedVars(t(x), w = w, useNames = useNames) 1080s + stopifnot(all.equal(x_est2, x_est1)) 1080s + } 1080s + } 1080s a b c d e 1080s 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 1080s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 1080s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 1080s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 1080s > 1080s > 1080s > x[sample(length(x), size = 0.3 * length(x))] <- NA 1080s > print(x) 1080s [,1] [,2] [,3] [,4] 1080s [1,] -0.6264538 NA 1.5117812 -0.04493361 1080s [2,] 0.1836433 NA NA -0.01619026 1080s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 1080s [4,] 1.5952808 NA -2.2146999 0.82122120 1080s [5,] 0.3295078 NA NA 0.59390132 1080s > 1080s > # Non-weighted row variances with missing values 1080s > x_est0 <- rowVars(x, na.rm = TRUE) 1080s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE) 1080s > print(x_est1) 1080s [1] 1.22226258 0.01996673 0.83582537 4.05532299 0.03495197 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > # Check names attribute 1080s > dimnames(x) <- dimnames 1080s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 1080s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > x_est0 <- rowVars(x, na.rm = TRUE, useNames = TRUE) 1080s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 1080s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > dimnames(x) <- NULL 1080s > 1080s > 1080s > # Weighted row variances with missing values 1080s > # Test with and without dimnames on x 1080s > for (setDimnames in c(TRUE, FALSE)) { 1080s + if (setDimnames) dimnames(x) <- dimnames 1080s + else dimnames(x) <- NULL 1080s + # Check names attribute 1080s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1080s + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 1080s + print(x_est1) 1080s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 1080s + stopifnot(all.equal(x_est2, x_est1)) 1080s + } 1080s + } 1080s a b c d e 1080s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 1080s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 1080s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 1080s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 1080s > 1080s > 1080s > # Weighted variances by rows and columns 1080s > w <- 1:4 1080s > # Test with and without dimnames on x 1080s > for (setDimnames in c(TRUE, FALSE)) { 1080s + if (setDimnames) dimnames(x) <- dimnames 1080s + else dimnames(x) <- NULL 1080s + # Check names attribute 1080s + for (useNames in c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE)) { 1080s + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 1080s + print(x_est1) 1080s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 1080s + stopifnot(all.equal(x_est2, x_est1)) 1080s + } 1080s + } 1080s a b c d e 1080s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 1080s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 1080s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 1080s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 1080s > 1080s > 1080s > # Weighted row standard deviation (excluding some columns) 1080s > w <- c(1, 1, 0, 1) 1080s > ## FIXME: rowVars()/rowSds() needs na.rm = FALSE (wrong default) 1080s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE) 1080s > x_est1 <- rowWeightedSds(x, w = w) 1080s > print(x_est1) 1080s [1] NA NA 0.9734868 NA NA 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > # Check names attribute 1080s > dimnames(x) <- dimnames 1080s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = FALSE) 1080s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = FALSE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE, useNames = TRUE) 1080s > if (!matrixStats:::isUseNamesNADefunct()) { 1080s + x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = NA) 1080s + x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = NA) 1080s + stopifnot(all.equal(x_est1, x_est0)) 1080s + stopifnot(all.equal(x_est2, x_est0)) 1080s + } 1080s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = TRUE) 1080s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = TRUE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > dimnames(x) <- NULL 1080s > 1080s > 1080s > # Weighted row MADs (excluding some columns) 1080s > w <- c(1, 1, 0, 1) 1080s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE]) 1080s > x_est1 <- rowWeightedMads(x, w = w) 1080s > print(x_est1) 1080s [1] NA NA 0.3046914 NA NA 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > x_est2 <- colWeightedMads(t(x), w = w) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > # Check names attribute 1080s > dimnames(x) <- dimnames 1080s > x_est1 <- rowWeightedMads(x, w = w, useNames = FALSE) 1080s > x_est2 <- colWeightedMads(t(x), w = w, useNames = FALSE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE], useNames = TRUE) 1080s > if (!matrixStats:::isUseNamesNADefunct()) { 1080s + x_est1 <- rowWeightedMads(x, w = w, useNames = NA) 1080s + x_est2 <- colWeightedMads(t(x), w = w, useNames = NA) 1080s + stopifnot(all.equal(x_est1, x_est0)) 1080s + stopifnot(all.equal(x_est2, x_est0)) 1080s + } 1080s > x_est1 <- rowWeightedMads(x, w = w, useNames = TRUE) 1080s > x_est2 <- colWeightedMads(t(x), w = w, useNames = TRUE) 1080s > stopifnot(all.equal(x_est1, x_est0)) 1080s > stopifnot(all.equal(x_est2, x_est0)) 1080s > dimnames(x) <- NULL 1080s > 1081s 1081s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1081s Copyright (C) 2024 The R Foundation for Statistical Computing 1081s Platform: aarch64-unknown-linux-gnu (64-bit) 1081s 1081s R is free software and comes with ABSOLUTELY NO WARRANTY. 1081s You are welcome to redistribute it under certain conditions. 1081s Type 'license()' or 'licence()' for distribution details. 1081s 1081s R is a collaborative project with many contributors. 1081s Type 'contributors()' for more information and 1081s 'citation()' on how to cite R or R packages in publications. 1081s 1081s Type 'demo()' for some demos, 'help()' for on-line help, or 1081s 'help.start()' for an HTML browser interface to help. 1081s Type 'q()' to quit R. 1081s 1081s > library("matrixStats") 1081s > 1081s > fcns <- list( 1081s + weightedVar = c(rowWeightedVars, colWeightedVars), 1081s + weightedSd = c(rowWeightedSds, colWeightedSds), 1081s + weightedMad = c(rowWeightedMads, colWeightedMads) 1081s + ) 1081s > 1081s > 1081s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1081s > # Subsetted tests 1081s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1081s > source("utils/validateIndicesFramework.R") 1081s > # To check names attribute 1081s > dimnames <- list(letters[1:6], LETTERS[1:6]) 1081s > for (fcn in names(fcns)) { 1081s + cat(sprintf("subsetted tests on matrix %s()...\n", fcn)) 1081s + row_fcn <- fcns[[fcn]][[1]] 1081s + col_fcn <- fcns[[fcn]][[2]] 1081s + 1081s + for (mode in c("numeric", "integer")) { 1081s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 1081s + w <- runif(6, min = 0, max = 6) 1081s + storage.mode(x) <- mode 1081s + storage.mode(w) <- mode 1081s + if (mode == "numeric") w[1] <- Inf 1081s + 1081s + # Test with and without dimnames on x 1081s + for (setDimnames in c(TRUE, FALSE)) { 1081s + if (setDimnames) dimnames(x) <- dimnames 1081s + else dimnames(x) <- NULL 1081s + 1081s + count <- 0L 1081s + for (rows in index_cases) { 1081s + for (cols in index_cases) { 1081s + count <- count + 1L 1081s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 1081s + useNames <- c(if (!matrixStats:::isUseNamesNADefunct()) NA, TRUE, FALSE) 1081s + useNames <- useNames[count %% length(useNames) + 1] 1081s + 1081s + validateIndicesTestMatrix_w(x, w, rows, cols, 1081s + ftest = row_fcn, fsure = row_fcn, 1081s + na.rm = na.rm, useNames = useNames) 1081s + validateIndicesTestMatrix_w(x, w, rows, cols, 1081s + fcoltest = col_fcn, fsure = row_fcn, 1081s + na.rm = na.rm, useNames = useNames) 1081s + } 1081s + } 1081s + } 1081s + } 1081s + cat(sprintf("%s()...DONE\n", fcn)) 1081s + } 1081s subsetted tests on matrix weightedVar()... 1087s weightedVar()...DONE 1087s subsetted tests on matrix weightedSd()... 1092s weightedSd()...DONE 1092s subsetted tests on matrix weightedMad()... 1097s weightedMad()...DONE 1097s > 1097s 1097s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1097s Copyright (C) 2024 The R Foundation for Statistical Computing 1097s Platform: aarch64-unknown-linux-gnu (64-bit) 1097s 1097s R is free software and comes with ABSOLUTELY NO WARRANTY. 1097s You are welcome to redistribute it under certain conditions. 1097s Type 'license()' or 'licence()' for distribution details. 1097s 1097s R is a collaborative project with many contributors. 1097s Type 'contributors()' for more information and 1097s 'citation()' on how to cite R or R packages in publications. 1097s 1097s Type 'demo()' for some demos, 'help()' for on-line help, or 1097s 'help.start()' for an HTML browser interface to help. 1097s Type 'q()' to quit R. 1097s 1098s > library("matrixStats") 1098s > 1098s > signTabulate0 <- function(x, ...) { 1098s + nneg <- sum(x < 0, na.rm = TRUE) 1098s + nzero <- sum(x == 0, na.rm = TRUE) 1098s + npos <- sum(x > 0, na.rm = TRUE) 1098s + nna <- sum(is.na(x)) 1098s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 1098s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 1098s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 1098s + res <- as.double(res) 1098s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 1098s + if (is.integer(x)) res <- res[1:4] 1098s + res 1098s + } # signTabulate0() 1098s > 1098s > 1098s > # Simulate data 1098s > set.seed(0xBEEF) 1098s > n <- 100L 1098s > x <- runif(n) 1098s > x[sample(n, size = 0.1 * n)] <- 0 1098s > x[sample(n, size = 0.1 * n)] <- NA_real_ 1098s > x[sample(n, size = 0.1 * n)] <- -Inf 1098s > x[sample(n, size = 0.1 * n)] <- +Inf 1098s > 1098s > # Doubles 1098s > message("Doubles:") 1098s > counts0 <- signTabulate0(x) 1098s Doubles: 1098s > print(counts0) 1098s -1 0 +1 NA -Inf +Inf 1098s 9 7 77 7 9 10 1098s > counts1 <- signTabulate(x) 1098s > print(counts1) 1098s -1 0 +1 NA -Inf +Inf 1098s 9 7 77 7 9 10 1098s > stopifnot(identical(counts1, counts0)) 1098s > 1098s > # Integers 1098s > message("Integers:") 1098s > x <- suppressWarnings(as.integer(x)) 1098s > Integers: 1098s counts0 <- signTabulate0(x) 1098s > print(counts0) 1098s -1 0 +1 NA 1098s 0 74 0 26 1098s > counts1 <- signTabulate(x) 1098s > print(counts1) 1098s -1 0 +1 NA 1098s 0 74 0 26 1098s > stopifnot(identical(counts1, counts0)) 1098s > 1098s 1098s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1098s Copyright (C) 2024 The R Foundation for Statistical Computing 1098s Platform: aarch64-unknown-linux-gnu (64-bit) 1098s 1098s R is free software and comes with ABSOLUTELY NO WARRANTY. 1098s You are welcome to redistribute it under certain conditions. 1098s Type 'license()' or 'licence()' for distribution details. 1098s 1098s R is a collaborative project with many contributors. 1098s Type 'contributors()' for more information and 1098s 'citation()' on how to cite R or R packages in publications. 1098s 1098s Type 'demo()' for some demos, 'help()' for on-line help, or 1098s 'help.start()' for an HTML browser interface to help. 1098s Type 'q()' to quit R. 1098s 1099s > library("matrixStats") 1099s > 1099s > signTabulate0 <- function(x, ...) { 1099s + nneg <- sum(x < 0, na.rm = TRUE) 1099s + nzero <- sum(x == 0, na.rm = TRUE) 1099s + npos <- sum(x > 0, na.rm = TRUE) 1099s + nna <- sum(is.na(x)) 1099s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 1099s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 1099s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 1099s + res <- as.double(res) 1099s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 1099s + if (is.integer(x)) res <- res[1:4] 1099s + res 1099s + } # signTabulate0() 1099s > 1099s > 1099s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1099s > # Subsetted tests 1099s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1099s > source("utils/validateIndicesFramework.R") 1099s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 1099s > x[2:3, 4:5] <- +Inf 1099s > x[4:5, 1:2] <- -Inf 1099s > for (idxs in index_cases) { 1099s + validateIndicesTestVector(x, idxs, 1099s + ftest = signTabulate, fsure = signTabulate0) 1099s + } 1099s > 1100s 1100s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1100s Copyright (C) 2024 The R Foundation for Statistical Computing 1100s Platform: aarch64-unknown-linux-gnu (64-bit) 1100s 1100s R is free software and comes with ABSOLUTELY NO WARRANTY. 1100s You are welcome to redistribute it under certain conditions. 1100s Type 'license()' or 'licence()' for distribution details. 1100s 1100s R is a collaborative project with many contributors. 1100s Type 'contributors()' for more information and 1100s 'citation()' on how to cite R or R packages in publications. 1100s 1100s Type 'demo()' for some demos, 'help()' for on-line help, or 1100s 'help.start()' for an HTML browser interface to help. 1100s Type 'q()' to quit R. 1100s 1100s > library("matrixStats") 1100s > options(warn = 1) 1100s > 1100s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1100s > # Consistency checks 1100s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1100s > set.seed(1) 1100s > 1100s > sum2_R <- function(x, na.rm = FALSE, idxs = NULL) { 1100s + if (is.null(idxs)) { 1100s + sum(x, na.rm = na.rm) 1100s + } else { 1100s + sum(x[idxs], na.rm = na.rm) 1100s + } 1100s + } # sum2_R() 1100s > 1100s > 1100s > cat("Consistency checks:\n") 1100s Consistency checks: 1100s > for (kk in 1:20) { 1100s + cat("Random test #", kk, "\n", sep = "") 1100s + 1100s + # Simulate data in a matrix of any shape 1100s + n <- sample(1e3, size = 1L) 1100s + x <- rnorm(n, sd = 100) 1100s + 1100s + # Add NAs? 1100s + if ((kk %% 4) %in% c(3, 0)) { 1100s + cat("Adding NAs\n") 1100s + nna <- sample(n, size = 1L) 1100s + na_values <- c(NA_real_, NaN) 1100s + t <- sample(na_values, size = nna, replace = TRUE) 1100s + x[sample(length(x), size = nna)] <- t 1100s + } 1100s + 1100s + # Integer or double? 1100s + if ((kk %% 4) %in% c(2, 0)) { 1100s + cat("Coercing to integers\n") 1100s + storage.mode(x) <- "integer" 1100s + } 1100s + 1100s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 1100s + 1100s + # Sum over all 1100s + y0 <- sum2_R(x, na.rm = na.rm) 1100s + y1 <- sum2(x, na.rm = na.rm) 1100s + stopifnot(all.equal(y1, y0)) 1100s + 1100s + # Sum over subset 1100s + nidxs <- sample(n, size = 1L) 1100s + idxs <- sample(n, size = nidxs) 1100s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 1100s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 1100s + stopifnot(all.equal(y1, y0)) 1100s + 1100s + if (storage.mode(x) == "integer") { 1100s + storage.mode(x) <- "logical" 1100s + 1100s + y0 <- sum2_R(x, na.rm = na.rm) 1100s + y1 <- sum2(x, na.rm = na.rm) 1100s + stopifnot(all.equal(y1, y0)) 1100s + 1100s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 1100s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 1100s + stopifnot(all.equal(y1, y0)) 1100s + } 1100s + } # for (kk ...) 1101s Random test #1 1101s Random test #2 1101s Coercing to integers 1101s Random test #3 1101s Adding NAs 1101s Random test #4 1101s Adding NAs 1101s Coercing to integers 1101s Random test #5 1101s Random test #6 1101s Coercing to integers 1101s Random test #7 1101s Adding NAs 1101s Random test #8 1101s Adding NAs 1101s Coercing to integers 1101s Random test #9 1101s Random test #10 1101s Coercing to integers 1101s Random test #11 1101s Adding NAs 1101s Random test #12 1101s Adding NAs 1101s Coercing to integers 1101s Random test #13 1101s Random test #14 1101s Coercing to integers 1101s Random test #15 1101s Adding NAs 1101s Random test #16 1101s Adding NAs 1101s Coercing to integers 1101s Random test #17 1101s Random test #18 1101s Coercing to integers 1101s Random test #19 1101s Adding NAs 1101s Random test #20 1101s Adding NAs 1101s Coercing to integers 1101s > 1101s > 1101s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1101s > # All missing values 1101s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1101s > for (n in 0:2) { 1101s + for (na.rm in c(FALSE, TRUE)) { 1101s + x <- rep(NA_real_, times = n) 1101s + y0 <- sum(x, na.rm = na.rm) 1101s + y <- sum2(x, na.rm = na.rm) 1101s + stopifnot(all.equal(y, y0)) 1101s + 1101s + x <- rep(NA_integer_, times = n) 1101s + y0 <- sum(x, na.rm = na.rm) 1101s + y <- sum2(x, na.rm = na.rm) 1101s + stopifnot(all.equal(y, y0)) 1101s + 1101s + x <- rep(NA, times = n) 1101s + y0 <- sum(x, na.rm = na.rm) 1101s + y <- sum2(x, na.rm = na.rm) 1101s + stopifnot(all.equal(y, y0)) 1101s + } 1101s + } 1101s > 1101s > 1101s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1101s > # Special cases 1101s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1101s > for (na.rm in c(FALSE, TRUE)) { 1101s + # Summing over zero elements (integers) 1101s + x <- integer(0) 1101s + s1 <- sum(x, na.rm = na.rm) 1101s + s2 <- sum2(x, na.rm = na.rm) 1101s + stopifnot(identical(s1, s2)) 1101s + 1101s + x <- 1:10 1101s + idxs <- integer(0) 1101s + s1 <- sum(x[idxs], na.rm = na.rm) 1101s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 1101s + stopifnot(identical(s1, s2)) 1101s + 1101s + # Summing over NA_integer_:s 1101s + x <- rep(NA_integer_, times = 10L) 1101s + s1 <- sum(x, na.rm = na.rm) 1101s + s2 <- sum2(x, na.rm = na.rm) 1101s + stopifnot(identical(s1, s2)) 1101s + 1101s + x <- rep(NA_integer_, times = 10L) 1101s + idxs <- 1:5 1101s + s1 <- sum(x[idxs], na.rm = na.rm) 1101s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 1101s + stopifnot(identical(s1, s2)) 1101s + 1101s + 1101s + # Summing over zero elements (doubles) 1101s + x <- double(0) 1101s + s1 <- sum(x) 1101s + s2 <- sum2(x) 1101s + stopifnot( 1101s + identical(s1, 0), 1101s + identical(s1, s2) 1101s + ) 1101s + 1101s + x <- as.double(1:10) 1101s + idxs <- integer(0) 1101s + s1 <- sum(x[idxs]) 1101s + s2 <- sum2(x, idxs = idxs) 1101s + stopifnot( 1101s + identical(s1, 0), 1101s + identical(s1, s2) 1101s + ) 1101s + 1101s + # Summing over NA_real_:s 1101s + x <- rep(NA_real_, times = 10L) 1101s + s1 <- sum(x, na.rm = na.rm) 1101s + s2 <- sum2(x, na.rm = na.rm) 1101s + stopifnot( 1101s + !na.rm || s1 == 0, 1101s + identical(s1, s2) 1101s + ) 1101s + 1101s + x <- rep(NA_real_, times = 10L) 1101s + idxs <- 1:5 1101s + s1 <- sum(x[idxs], na.rm = na.rm) 1101s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 1101s + stopifnot( 1101s + !na.rm || s1 == 0, 1101s + identical(s1, s2) 1101s + ) 1101s + 1101s + # Summing over -Inf:s 1101s + x <- rep(-Inf, times = 3L) 1101s + s1 <- sum(x, na.rm = na.rm) 1101s + s2 <- sum2(x, na.rm = na.rm) 1101s + stopifnot( 1101s + is.infinite(s1) && s1 < 0, 1101s + identical(s1, s2) 1101s + ) 1101s + 1101s + # Summing over +Inf:s 1101s + x <- rep(+Inf, times = 3L) 1101s + s1 <- sum(x, na.rm = na.rm) 1101s + s2 <- sum2(x, na.rm = na.rm) 1101s + stopifnot(identical(s1, s2)) 1101s + stopifnot( 1101s + is.infinite(s1) && s1 > 0, 1101s + identical(s1, s2) 1101s + ) 1101s + 1101s + # Summing over mix of -Inf:s and +Inf:s 1101s + x <- rep(c(-Inf, +Inf), times = 3L) 1101s + s1 <- sum(x, na.rm = na.rm) 1101s + s2 <- sum2(x, na.rm = na.rm) 1101s + stopifnot( 1101s + is.nan(s1), 1101s + identical(s1, s2) 1101s + ) 1101s + 1101s + # Summing over mix of -Inf:s and +Inf:s and numerics 1101s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 1101s + s1 <- sum(x, na.rm = na.rm) 1101s + s2 <- sum2(x, na.rm = na.rm) 1101s + stopifnot( 1101s + is.nan(s1), 1101s + identical(s1, s2) 1101s + ) 1101s + 1101s + # Summing over mix of NaN, NA, +Inf, and numerics 1101s + x <- c(NaN, NA, +Inf, 3.14) 1101s + s1 <- sum(x, na.rm = na.rm) 1101s + s2 <- sum2(x, na.rm = na.rm) 1101s + if (na.rm) { 1101s + stopifnot( 1101s + is.infinite(s1) && s1 > 0, 1101s + identical(s2, s1) 1101s + ) 1101s + } else { 1101s + stopifnot(is.na(s1), is.na(s2)) 1101s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 1101s + ## returned here (as one would expect). NaN might very well be returned, 1101s + ## when both NA and NaN are involved. This is an accepted feature in R, 1101s + ## which is documented in help("is.nan"). See also 1101s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 1101s + ## Thus, we cannot guarantee that s1 is identical to s0. 1101s + } 1101s + 1101s + # Summing over mix of NaN, NA, +Inf, and numerics 1101s + x <- c(NA, NaN, +Inf, 3.14) 1101s + s1 <- sum(x, na.rm = na.rm) 1101s + s2 <- sum2(x, na.rm = na.rm) 1101s + if (na.rm) { 1101s + stopifnot( 1101s + is.infinite(s1) && s1 > 0, 1101s + identical(s2, s1) 1101s + ) 1101s + } else { 1101s + stopifnot(is.na(s1), is.na(s2)) 1101s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 1101s + ## returned here (as one would expect). NaN might very well be returned, 1101s + ## when both NA and NaN are involved. This is an accepted feature in R, 1101s + ## which is documented in help("is.nan"). See also 1101s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 1101s + ## Thus, we cannot guarantee that s1 is identical to s0. 1101s + } 1101s + } 1101s > 1101s > 1101s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1101s > # Summing of large integers 1101s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1101s > x <- c(.Machine$integer.max, 1L, -.Machine$integer.max) 1101s > 1101s > # Total gives integer overflow 1101s > s1 <- sum(x[1:2]) # NA_integer_ w/ warning 1101s > s2 <- sum2(x[1:2]) # NA_integer_ w/ warning 1101s Warning in sum2(x[1:2]) : 1101s Integer overflow. Use sum2(..., mode = "double") to avoid this. 1101s > stopifnot( 1101s + getRversion() >= "3.5.0" || identical(s1, NA_integer_), 1101s + identical(s2, NA_integer_) 1101s + ) 1101s > 1101s > ## Assert above warning 1101s > res <- tryCatch({ 1101s + s2 <- sum2(x[1:2]) 1101s + }, warning = identity) 1101s > stopifnot(inherits(res, "warning")) 1101s > 1101s > 1101s > # Total gives integer overflow (coerce to numeric) 1101s > s1 <- sum(as.numeric(x[1:2])) # 2147483648 1101s > s2 <- sum2(as.numeric(x[1:2])) # 2147483648 1101s > s3 <- sum2(x[1:2], mode = "double") # 2147483648 1101s > stopifnot( 1101s + identical(s1, 2147483648), 1101s + identical(s1, s2), 1101s + identical(s1, s3) 1101s + ) 1101s > 1101s > # Cumulative sum would give integer overflow but not the total 1101s > s1 <- sum(x) # 1L 1101s > s2 <- sum2(x) # 1L 1101s > stopifnot( 1101s + identical(s1, 1L), 1101s + identical(s1, s2) 1101s + ) 1101s > 1101s > # Input is double but coersing result to integer 1101s > x <- c(1, 2, 3.1) 1101s > s1 <- sum2(x) 1101s > s2 <- sum2(x, mode = "integer") 1101s Warning in sum2(x, mode = "integer") : 1101s sum2(x, mode = "integer") called with typeof(x) == "double"; did you mean to use as.integer(sum2(x))? 1101s > stopifnot( 1101s + identical(as.integer(s1), s2) 1101s + ) 1101s > 1101s > ## Assert above warning 1101s > res <- tryCatch({ 1101s + s2 <- sum2(x, mode = "integer") 1101s + }, warning = identity) 1101s > stopifnot(inherits(res, "warning")) 1101s > 1101s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1101s > # Summing of large doubles 1101s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1101s > ## Double overflow 1101s > x <- rep(.Machine$double.xmax, times = 2L) 1101s > y0 <- sum(x) 1101s > print(y0) 1101s [1] Inf 1101s > y <- sum2(x) 1101s > print(y) 1101s [1] Inf 1101s > stopifnot( 1101s + is.infinite(y) && y > 0, 1101s + identical(y, y0) 1101s + ) 1101s > 1101s > x <- rep(-.Machine$double.xmax, times = 2L) 1101s > y0 <- sum(x) 1101s > print(y0) 1101s [1] -Inf 1101s > y <- sum2(x) 1101s > print(y) 1101s [1] -Inf 1101s > stopifnot( 1101s + is.infinite(y) && y < 0, 1101s + identical(y, y0) 1101s + ) 1101s > 1101s > 1101s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1101s > # Argument 'idxs' 1101s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1101s > x <- 1:10 1101s > idxs_list <- list( 1101s + integer = 1:5, 1101s + double = as.double(1:5), 1101s + logical = (x <= 5) 1101s + ) 1101s > 1101s > for (idxs in idxs_list) { 1101s + cat("idxs:\n") 1101s + str(idxs) 1101s + s1 <- sum(x[idxs], na.rm = TRUE) 1101s + s2 <- sum2(x, idxs = idxs, na.rm = TRUE) 1101s + stopifnot(identical(s1, s2)) 1101s + } 1101s idxs: 1101s int [1:5] 1 2 3 4 5 1101s idxs: 1101s num [1:5] 1 2 3 4 5 1101s idxs: 1101s logi [1:10] TRUE TRUE TRUE TRUE TRUE FALSE ... 1101s > 1102s 1102s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1102s Copyright (C) 2024 The R Foundation for Statistical Computing 1102s Platform: aarch64-unknown-linux-gnu (64-bit) 1102s 1102s R is free software and comes with ABSOLUTELY NO WARRANTY. 1102s You are welcome to redistribute it under certain conditions. 1102s Type 'license()' or 'licence()' for distribution details. 1102s 1102s R is a collaborative project with many contributors. 1102s Type 'contributors()' for more information and 1102s 'citation()' on how to cite R or R packages in publications. 1102s 1102s Type 'demo()' for some demos, 'help()' for on-line help, or 1102s 'help.start()' for an HTML browser interface to help. 1102s Type 'q()' to quit R. 1102s 1102s > library("matrixStats") 1102s > 1102s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1102s > # Subsetted tests 1102s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1102s > source("utils/validateIndicesFramework.R") 1102s > x <- runif(6, min = -6, max = 6) 1102s > storage.mode(x) <- "integer" 1102s > for (idxs in index_cases) { 1102s + validateIndicesTestVector(x, idxs, 1102s + ftest = sum2, fsure = sum, 1102s + na.rm = FALSE) 1102s + validateIndicesTestVector(x, idxs, 1102s + ftest = sum2, fsure = sum, 1102s + na.rm = TRUE) 1102s + } 1103s > 1103s 1103s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1103s Copyright (C) 2024 The R Foundation for Statistical Computing 1103s Platform: aarch64-unknown-linux-gnu (64-bit) 1103s 1103s R is free software and comes with ABSOLUTELY NO WARRANTY. 1103s You are welcome to redistribute it under certain conditions. 1103s Type 'license()' or 'licence()' for distribution details. 1103s 1103s R is a collaborative project with many contributors. 1103s Type 'contributors()' for more information and 1103s 'citation()' on how to cite R or R packages in publications. 1103s 1103s Type 'demo()' for some demos, 'help()' for on-line help, or 1103s 'help.start()' for an HTML browser interface to help. 1103s Type 'q()' to quit R. 1103s 1103s > library(matrixStats) 1103s > source("utils/validateIndicesFramework.R") 1103s > 1103s > oopts <- options(matrixStats.validateIndices = "ignore") 1103s > 1103s > ftest <- function(x, idxs) validateIndices(idxs, length(x)) 1103s > 1103s > x <- 1:6 1103s > for (idxs in index_cases) { 1103s + for (mode in c("integer", "numeric", "logical")) { 1103s + if (!is.null(idxs)) { 1103s + suppressWarnings({storage.mode(idxs) <- mode}) 1103s + } 1103s + validateIndicesTestVector(x, idxs, ftest = ftest, fsure = identity) 1103s + } 1103s + } 1104s > 1104s > ftest <- function(x, idxs) validateIndices(idxs, length(x)) 1104s > 1104s > for (idxs in index_error_cases) { 1104s + validateIndicesTestVector(x, idxs, ftest = ftest, fsure = identity) 1104s + } 1104s > 1104s > 1104s > ftest <- function(x, rows, cols) { 1104s + vr <- validateIndices(rows, dim(x)[1], FALSE) 1104s + vc <- validateIndices(cols, dim(x)[2], FALSE) 1104s + 1104s + stopifnot(all((vr > 0 & vr <= dim(x)[1]) | is.na(vr))) 1104s + stopifnot(all((vc > 0 & vc <= dim(x)[2]) | is.na(vc))) 1104s + suppressWarnings(x <- x[vr, vc, drop = FALSE]) 1104s + x 1104s + } 1104s > 1104s > x <- matrix(1:36, nrow = 6, ncol = 6) 1104s > for (rows in index_cases) { 1104s + for (cols in index_cases) { 1104s + validateIndicesTestMatrix(x, rows, cols, ftest = ftest, fsure = identity) 1104s + } 1104s + } 1104s > 1104s > # Testing for 64-bit builds (64 bits = 8 bytes) 1104s > if (.Machine$sizeof.pointer == 8L) { 1104s + validateIndices(c(1.25*2^40, 3, 1*2^38, 1, 1.4*2^39), maxIdx = 1*2^41) 1104s + } 1104s [1] 1.374390e+12 3.000000e+00 2.748779e+11 1.000000e+00 7.696581e+11 1104s > 1104s > options(oopts) 1104s > 1105s 1105s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1105s Copyright (C) 2024 The R Foundation for Statistical Computing 1105s Platform: aarch64-unknown-linux-gnu (64-bit) 1105s 1105s R is free software and comes with ABSOLUTELY NO WARRANTY. 1105s You are welcome to redistribute it under certain conditions. 1105s Type 'license()' or 'licence()' for distribution details. 1105s 1105s R is a collaborative project with many contributors. 1105s Type 'contributors()' for more information and 1105s 'citation()' on how to cite R or R packages in publications. 1105s 1105s Type 'demo()' for some demos, 'help()' for on-line help, or 1105s 'help.start()' for an HTML browser interface to help. 1105s Type 'q()' to quit R. 1105s 1105s > library("matrixStats") 1105s > 1105s > set.seed(1) 1105s > x <- rnorm(1e4) 1105s > 1105s > 1105s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1105s > # Variance estimators 1105s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1105s > sigma2_a <- var(x) 1105s > cat(sprintf("var(x) = %g\n", sigma2_a)) 1105s var(x) = 1.02487 1105s > 1105s > sigma2_b <- varDiff(x) 1105s > cat(sprintf("varDiff(x) = %g\n", sigma2_b)) 1105s varDiff(x) = 1.01224 1105s > 1105s > d <- abs(sigma2_b - sigma2_a) 1105s > cat(sprintf("Absolute difference = %g\n", d)) 1105s Absolute difference = 0.0126268 1105s > stopifnot(d < 0.02) 1105s > 1105s > 1105s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1105s > # Standard deviation estimators 1105s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1105s > sigma_a <- sd(x) 1105s > cat(sprintf("sd(x) = %g\n", sigma_a)) 1105s sd(x) = 1.01236 1105s > 1105s > sigma_b <- sdDiff(x) 1105s > cat(sprintf("sdDiff(x) = %g\n", sigma_b)) 1105s sdDiff(x) = 1.0061 1105s > 1105s > d <- abs(sigma_b - sigma_a) 1105s > cat(sprintf("Absolute difference = %g\n", d)) 1105s Absolute difference = 0.00625567 1105s > stopifnot(d < 0.01) 1105s > 1105s > # Sanity checks 1105s > stopifnot(abs(sigma2_a - sigma_a ^ 2) < 1e-9) 1105s > stopifnot(abs(sigma2_b - sigma_b ^ 2) < 1e-9) 1105s > 1105s > 1105s > sigma_a2 <- mad(x) 1105s > cat(sprintf("mad(x) = %g\n", sigma_a2)) 1105s mad(x) = 0.998376 1105s > 1105s > sigma_b2 <- madDiff(x) 1105s > cat(sprintf("madDiff(x) = %g\n", sigma_b2)) 1105s madDiff(x) = 1.02513 1105s > 1105s > d <- abs(sigma_b2 - sigma_a2) 1105s > cat(sprintf("Absolute difference = %g\n", d)) 1105s Absolute difference = 0.0267497 1105s > stopifnot(d < 0.05) 1105s > 1105s > 1105s > sigma_a3 <- IQR(x) 1105s > cat(sprintf("IQR(x) = %g\n", sigma_a3)) 1105s IQR(x) = 1.35105 1105s > 1105s > sigma_b3 <- iqrDiff(x) 1105s > cat(sprintf("iqrDiff(x) = %g\n", sigma_b3)) 1105s iqrDiff(x) = 1.37797 1105s > 1105s > d <- abs(sigma_b3 - sigma_a3) 1105s > cat(sprintf("Absolute difference = %g\n", d)) 1105s Absolute difference = 0.0269152 1105s > stopifnot(d < 0.05) 1105s > 1105s > 1105s > 1105s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1105s > # Trimmed estimators 1105s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1105s > y <- x 1105s > outliers <- sample(length(x), size = 0.1 * length(x)) 1105s > y[outliers] <- 100 * y[outliers] 1105s > 1105s > sigma_ao <- sd(y[-outliers]) 1105s > cat(sprintf("sd(y) = %g\n", sigma_ao)) 1105s sd(y) = 1.01166 1105s > 1105s > sigma_bo <- sdDiff(y[-outliers]) 1105s > cat(sprintf("sdDiff(y) = %g\n", sigma_bo)) 1105s sdDiff(y) = 1.00743 1105s > 1105s > d <- abs(sigma_b - sigma_a) 1105s > cat(sprintf("Absolute difference = %g\n", d)) 1105s Absolute difference = 0.00625567 1105s > stopifnot(d < 0.01) 1105s > 1105s > sigma_bot <- sdDiff(y, trim = 0.05) 1105s > cat(sprintf("sdDiff(y, trim = 0.05) = %g\n", sigma_bot)) 1105s sdDiff(y, trim = 0.05) = 7.74327 1105s > 1105s > d <- abs(sigma_bot - sigma_a) 1105s > cat(sprintf("Absolute difference = %g\n", d)) 1105s Absolute difference = 6.73091 1105s > #stopifnot(d < 1e-3) 1105s > 1105s > sigma_cot <- madDiff(y, trim = 0.05) 1105s > cat(sprintf("madDiff(y, trim = 0.05) = %g\n", sigma_cot)) 1105s madDiff(y, trim = 0.05) = 1.15278 1105s > 1105s > sigma_dot <- iqrDiff(y, trim = 0.05) 1105s > cat(sprintf("iqrDiff(y, trim = 0.05) = %g\n", sigma_dot)) 1105s iqrDiff(y, trim = 0.05) = 1.55762 1105s > 1105s > 1105s > fcns <- list( 1105s + varDiff = varDiff, 1105s + sdDiff = sdDiff, 1105s + madDiff = madDiff, 1105s + iqrDiff = iqrDiff 1105s + ) 1105s > 1105s > for (name in names(fcns)) { 1105s + cat(sprintf("%s()...\n", name)) 1105s + fcn <- fcns[[name]] 1105s + 1105s + for (mode in c("integer", "double")) { 1105s + cat("mode: ", mode, "", sep = "") 1105s + for (n in 0:3) { 1105s + x <- runif(n, min = -5, max = 5) 1105s + storage.mode(x) <- mode 1105s + str(x) 1105s + 1105s + y <- fcn(x) 1105s + yt <- fcn(x, trim = 0.1) 1105s + str(list("non-trimmed" = y, trimmed = yt)) 1105s + } # for (mode ...) 1105s + } 1105s + 1105s + cat(sprintf("%s()...DONE\n", name)) 1105s + } # for (name ...) 1105s varDiff()... 1105s mode: integer int(0) 1105s List of 2 1105s $ non-trimmed: num NA 1105s $ trimmed : num NA 1105s int -4 1105s List of 2 1105s $ non-trimmed: num NA 1105s $ trimmed : num NA 1105s int [1:2] 3 2 1105s List of 2 1105s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s int [1:3] 1 4 -1 1106s List of 2 1106s $ non-trimmed: num 16 1106s $ trimmed : num 16 1106s mode: double num(0) 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s num -0.794 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s num [1:2] 0.897 -3.728 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s num [1:3] 2.07 -1.13 1.94 1106s List of 2 1106s $ non-trimmed: num 9.83 1106s $ trimmed : num 9.83 1106s varDiff()...DONE 1106s sdDiff()... 1106s mode: integer int(0) 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s int 2 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s int [1:2] -4 1 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s int [1:3] -2 1 -1 1106s List of 2 1106s $ non-trimmed: num 2.5 1106s $ trimmed : num 2.5 1106s mode: double num(0) 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s num -3.78 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s num [1:2] -2.04 2.38 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s num [1:3] 1.42 -2.14 1.14 1106s List of 2 1106s $ non-trimmed: num 3.42 1106s $ trimmed : num 3.42 1106s sdDiff()...DONE 1106s madDiff()... 1106s mode: integer int(0) 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s int -1 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s int [1:2] -1 4 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s int [1:3] -1 0 -3 1106s List of 2 1106s $ non-trimmed: num 2.1 1106s $ trimmed : num 2.1 1106s mode: double num(0) 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s num -1.13 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s num [1:2] -1.7 -1.21 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s num [1:3] -2.39 -0.464 3.086 1106s List of 2 1106s $ non-trimmed: num 0.851 1106s $ trimmed : num 0.851 1106s madDiff()...DONE 1106s iqrDiff()... 1106s mode: integer int(0) 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s int 3 1106s List of 2 1106s $ non-trimmed: num 0 1106s $ trimmed : num 0 1106s int [1:2] -3 4 1106s List of 2 1106s $ non-trimmed: num 0 1106s $ trimmed : num 0 1106s int [1:3] 0 -2 -2 1106s List of 2 1106s $ non-trimmed: num 0.707 1106s $ trimmed : num 0.707 1106s mode: double num(0) 1106s List of 2 1106s $ non-trimmed: num NA 1106s $ trimmed : num NA 1106s num -4.46 1106s List of 2 1106s $ non-trimmed: num 0 1106s $ trimmed : num 0 1106s num [1:2] 3.67 1.02 1106s List of 2 1106s $ non-trimmed: num 0 1106s $ trimmed : num 0 1106s num [1:3] -0.537 -2.733 2.857 1106s List of 2 1106s $ non-trimmed: num 2.75 1106s $ trimmed : num 2.75 1106s iqrDiff()...DONE 1106s > 1106s 1106s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1106s Copyright (C) 2024 The R Foundation for Statistical Computing 1106s Platform: aarch64-unknown-linux-gnu (64-bit) 1106s 1106s R is free software and comes with ABSOLUTELY NO WARRANTY. 1106s You are welcome to redistribute it under certain conditions. 1106s Type 'license()' or 'licence()' for distribution details. 1106s 1106s R is a collaborative project with many contributors. 1106s Type 'contributors()' for more information and 1106s 'citation()' on how to cite R or R packages in publications. 1106s 1106s Type 'demo()' for some demos, 'help()' for on-line help, or 1106s 'help.start()' for an HTML browser interface to help. 1106s Type 'q()' to quit R. 1106s 1107s > library("matrixStats") 1107s > 1107s > fcns <- list( 1107s + varDiff = varDiff, 1107s + sdDiff = sdDiff, 1107s + madDiff = madDiff, 1107s + iqrDiff = iqrDiff 1107s + ) 1107s > 1107s > 1107s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1107s > # Subsetted tests 1107s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1107s > source("utils/validateIndicesFramework.R") 1107s > for (name in names(fcns)) { 1107s + cat(sprintf("subsetted tests on %s()...\n", name)) 1107s + fcn <- fcns[[name]] 1107s + 1107s + for (mode in c("numeric", "integer")) { 1107s + x <- runif(6, min = -6, max = 6) 1107s + storage.mode(x) <- mode 1107s + trim <- runif(1, min = 0, max = 0.5) 1107s + if (mode == "numeric") x[1] <- Inf 1107s + 1107s + for (diff in 1:2) { 1107s + for (idxs in index_cases) { 1107s + validateIndicesTestVector(x, idxs, 1107s + ftest = fcn, fsure = fcn, 1107s + na.rm = TRUE, diff = diff, trim = trim) 1107s + validateIndicesTestVector(x, idxs, 1107s + ftest = fcn, fsure = fcn, 1107s + na.rm = FALSE, diff = diff, trim = trim) 1107s + } 1107s + } 1107s + } 1107s + cat(sprintf("%s()...DONE\n", name)) 1107s + } 1107s subsetted tests on varDiff()... 1108s varDiff()...DONE 1108s subsetted tests on sdDiff()... 1108s sdDiff()...DONE 1108s subsetted tests on madDiff()... 1108s madDiff()...DONE 1108s subsetted tests on iqrDiff()... 1108s iqrDiff()...DONE 1108s > 1108s 1108s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1108s Copyright (C) 2024 The R Foundation for Statistical Computing 1108s Platform: aarch64-unknown-linux-gnu (64-bit) 1108s 1108s R is free software and comes with ABSOLUTELY NO WARRANTY. 1108s You are welcome to redistribute it under certain conditions. 1108s Type 'license()' or 'licence()' for distribution details. 1108s 1108s R is a collaborative project with many contributors. 1108s Type 'contributors()' for more information and 1108s 'citation()' on how to cite R or R packages in publications. 1108s 1108s Type 'demo()' for some demos, 'help()' for on-line help, or 1108s 'help.start()' for an HTML browser interface to help. 1108s Type 'q()' to quit R. 1108s 1109s > library("matrixStats") 1109s > 1109s > for (mode in c("logical", "integer", "double")) { 1109s + cat("mode: ", mode, "", sep = "") 1109s + n <- 2L 1109s + x <- runif(n, min = -5, max = 5) 1109s + if (mode == "logical") { 1109s + x <- x > 0 1109s + } 1109s + storage.mode(x) <- mode 1109s + str(x) 1109s + 1109s + cat("All weights are 1\n") 1109s + w <- rep(1, times = n) 1109s + m0 <- weighted.mean(x, w) 1109s + m1 <- weightedMean(x, w) 1109s + str(list(m0 = m0, m1 = m1)) 1109s + stopifnot(identical(m1, m0)) 1109s + 1109s + cat("First weight is 5\n") 1109s + # Pull the mean towards zero 1109s + w[1] <- 5 1109s + str(w) 1109s + m0 <- weighted.mean(x, w) 1109s + m1 <- weightedMean(x, w) 1109s + str(list(m0 = m0, m1 = m1)) 1109s + stopifnot(identical(m1, m0)) 1109s + 1109s + cat("All weights are 0\n") 1109s + # All weights set to zero 1109s + w <- rep(0, times = n) 1109s + m0 <- weighted.mean(x, w) 1109s + m1 <- weightedMean(x, w) 1109s + str(list(m0 = m0, m1 = m1)) 1109s + stopifnot(identical(m1, m0)) 1109s + 1109s + cat("First weight is 8.5\n") 1109s + # Put even more weight on the zero 1109s + w[1] <- 8.5 1109s + m0 <- weighted.mean(x, w) 1109s + m1 <- weightedMean(x, w) 1109s + str(list(m0 = m0, m1 = m1)) 1109s + stopifnot(identical(m1, m0)) 1109s + 1109s + cat("First weight is Inf\n") 1109s + # All weight on the first value 1109s + w[1] <- Inf 1109s + m0 <- weighted.mean(x, w) 1109s + m1 <- weightedMean(x, w) 1109s + str(list(m0 = m0, m1 = m1)) 1109s + stopifnot(identical(m1, m0)) 1109s + 1109s + cat("Last weight is Inf\n") 1109s + # All weight on the last value 1109s + w[1] <- 1 1109s + w[n] <- Inf 1109s + m0 <- weighted.mean(x, w) 1109s + m1 <- weightedMean(x, w) 1109s + str(list(m0 = m0, m1 = m1)) 1109s + stopifnot(identical(m1, m0)) 1109s + } # for (mode ...) 1109s mode: logical logi [1:2] FALSE FALSE 1109s All weights are 1 1109s List of 2 1109s $ m0: num 0 1109s $ m1: num 0 1109s First weight is 5 1109s num [1:2] 5 1 1109s List of 2 1109s $ m0: num 0 1109s $ m1: num 0 1109s All weights are 0 1109s List of 2 1109s $ m0: num NaN 1109s $ m1: num NaN 1109s First weight is 8.5 1109s List of 2 1109s $ m0: num 0 1109s $ m1: num 0 1109s First weight is Inf 1109s List of 2 1109s $ m0: num NaN 1109s $ m1: num NaN 1109s Last weight is Inf 1109s List of 2 1109s $ m0: num NaN 1109s $ m1: num NaN 1109s mode: integer int [1:2] -1 -2 1109s All weights are 1 1109s List of 2 1109s $ m0: num -1.5 1109s $ m1: num -1.5 1109s First weight is 5 1109s num [1:2] 5 1 1109s List of 2 1109s $ m0: num -1.17 1109s $ m1: num -1.17 1109s All weights are 0 1109s List of 2 1109s $ m0: num NaN 1109s $ m1: num NaN 1109s First weight is 8.5 1109s List of 2 1109s $ m0: num -1 1109s $ m1: num -1 1109s First weight is Inf 1109s List of 2 1109s $ m0: num NaN 1110s $ m1: num NaN 1110s Last weight is Inf 1110s List of 2 1110s $ m0: num NaN 1110s $ m1: num NaN 1110s mode: double num [1:2] 4.35 -4.14 1110s All weights are 1 1110s List of 2 1110s $ m0: num 0.103 1110s $ m1: num 0.103 1110s First weight is 5 1110s num [1:2] 5 1 1110s List of 2 1110s $ m0: num 2.93 1110s $ m1: num 2.93 1110s All weights are 0 1110s List of 2 1110s $ m0: num NaN 1110s $ m1: num NaN 1110s First weight is 8.5 1110s List of 2 1110s $ m0: num 4.35 1110s $ m1: num 4.35 1110s First weight is Inf 1110s List of 2 1110s $ m0: num NaN 1110s $ m1: num NaN 1110s Last weight is Inf 1110s List of 2 1110s $ m0: num NaN 1110s $ m1: num NaN 1110s > 1110s > 1110s > message("*** Testing for missing values") 1110s *** Testing for missing values 1110s > # NA tests 1110s > xs <- list(A = c(1, 2, 3), B = c(NA, 2, 3), C = c(NA, 2, 3)) 1110s > ws <- list(A = c(1, 1, 1), B = c(NA, 1, 1), C = c(1, NA, 1)) 1110s > ## NOTE: The (B, B) case with na.rm = TRUE is interesting because 1110s > ## even if NAs in 'w' are not dropped by na.rm = TRUE, this one 1110s > ## is because 'x' is dropped and therefore that first element 1110s > ## is skipped in the computation. It basically does 1110s > ## keep <- !is.na(x); x <- x[keep]; w <- w[keep] 1110s > ## without looking at 'w'. 1110s > for (x in xs) { 1110s + for (mode in c("logical", "integer", "double")) { 1110s + storage.mode(x) <- mode 1110s + for (w in ws) { 1110s + for (na.rm in c(FALSE, TRUE)) { 1110s + cat(sprintf("mode: %s, na.rm = %s\n", mode, na.rm)) 1110s + str(list(x = x, w = w)) 1110s + m0 <- weighted.mean(x, w, na.rm = na.rm) 1110s + m1 <- weightedMean(x, w, na.rm = na.rm) 1110s + str(list(m0 = m0, m1 = m1)) 1110s + stopifnot(all.equal(m1, m0)) 1110s + } 1110s + } 1110s + } 1110s + } 1110s mode: logical, na.rm = FALSE 1110s List of 2 1110s $ x: logi [1:3] TRUE TRUE TRUE 1110s $ w: num [1:3] 1 1 1 1110s List of 2 1110s $ m0: num 1 1110s $ m1: num 1 1110s mode: logical, na.rm = TRUE 1110s List of 2 1110s $ x: logi [1:3] TRUE TRUE TRUE 1110s $ w: num [1:3] 1 1 1 1110s List of 2 1110s $ m0: num 1 1110s $ m1: num 1 1110s mode: logical, na.rm = FALSE 1110s List of 2 1110s $ x: logi [1:3] TRUE TRUE TRUE 1110s $ w: num [1:3] NA 1 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: logical, na.rm = TRUE 1110s List of 2 1110s $ x: logi [1:3] TRUE TRUE TRUE 1110s $ w: num [1:3] NA 1 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: logical, na.rm = FALSE 1110s List of 2 1110s $ x: logi [1:3] TRUE TRUE TRUE 1110s $ w: num [1:3] 1 NA 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: logical, na.rm = TRUE 1110s List of 2 1110s $ x: logi [1:3] TRUE TRUE TRUE 1110s $ w: num [1:3] 1 NA 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: integer, na.rm = FALSE 1110s List of 2 1110s $ x: int [1:3] 1 1 1 1110s $ w: num [1:3] 1 1 1 1110s List of 2 1110s $ m0: num 1 1110s $ m1: num 1 1110s mode: integer, na.rm = TRUE 1110s List of 2 1110s $ x: int [1:3] 1 1 1 1110s $ w: num [1:3] 1 1 1 1110s List of 2 1110s $ m0: num 1 1110s $ m1: num 1 1110s mode: integer, na.rm = FALSE 1110s List of 2 1110s $ x: int [1:3] 1 1 1 1110s $ w: num [1:3] NA 1 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: integer, na.rm = TRUE 1110s List of 2 1110s $ x: int [1:3] 1 1 1 1110s $ w: num [1:3] NA 1 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: integer, na.rm = FALSE 1110s List of 2 1110s $ x: int [1:3] 1 1 1 1110s $ w: num [1:3] 1 NA 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: integer, na.rm = TRUE 1110s List of 2 1110s $ x: int [1:3] 1 1 1 1110s $ w: num [1:3] 1 NA 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: double, na.rm = FALSE 1110s List of 2 1110s $ x: num [1:3] 1 1 1 1110s $ w: num [1:3] 1 1 1 1110s List of 2 1110s $ m0: num 1 1110s $ m1: num 1 1110s mode: double, na.rm = TRUE 1110s List of 2 1110s $ x: num [1:3] 1 1 1 1110s $ w: num [1:3] 1 1 1 1110s List of 2 1110s $ m0: num 1 1110s $ m1: num 1 1110s mode: double, na.rm = FALSE 1110s List of 2 1110s $ x: num [1:3] 1 1 1 1110s $ w: num [1:3] NA 1 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: double, na.rm = TRUE 1110s List of 2 1110s $ x: num [1:3] 1 1 1 1110s $ w: num [1:3] NA 1 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: double, na.rm = FALSE 1110s List of 2 1110s $ x: num [1:3] 1 1 1 1110s $ w: num [1:3] 1 NA 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: double, na.rm = TRUE 1110s List of 2 1110s $ x: num [1:3] 1 1 1 1110s $ w: num [1:3] 1 NA 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: logical, na.rm = FALSE 1110s List of 2 1110s $ x: logi [1:3] NA TRUE TRUE 1110s $ w: num [1:3] 1 1 1 1110s List of 2 1110s $ m0: num NA 1110s $ m1: num NA 1110s mode: logical, na.rm = TRUE 1110s List of 2 1110s $ x: logi [1:3] NA TRUE TRUE 1110s $ w: num [1:3] 1 1 1 1110s List of 2 1110s $ m0: num 1 1110s $ m1: num 1 1110s mode: logical, na.rm = FALSE 1110s List of 2 1110s $ x: logi [1:3] NA TRUE TRUE 1110s $ w: num [1:3] NA 1 1 1110s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: logical, na.rm = TRUE 1111s List of 2 1111s $ x: logi [1:3] NA TRUE TRUE 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: logical, na.rm = FALSE 1111s List of 2 1111s $ x: logi [1:3] NA TRUE TRUE 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: logical, na.rm = TRUE 1111s List of 2 1111s $ x: logi [1:3] NA TRUE TRUE 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: integer, na.rm = FALSE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] 1 1 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: integer, na.rm = TRUE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] 1 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: integer, na.rm = FALSE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: integer, na.rm = TRUE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: integer, na.rm = FALSE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: integer, na.rm = TRUE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: double, na.rm = FALSE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] 1 1 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: double, na.rm = TRUE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] 1 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: double, na.rm = FALSE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: double, na.rm = TRUE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: double, na.rm = FALSE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: double, na.rm = TRUE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: logical, na.rm = FALSE 1111s List of 2 1111s $ x: logi [1:3] NA TRUE TRUE 1111s $ w: num [1:3] 1 1 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: logical, na.rm = TRUE 1111s List of 2 1111s $ x: logi [1:3] NA TRUE TRUE 1111s $ w: num [1:3] 1 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: logical, na.rm = FALSE 1111s List of 2 1111s $ x: logi [1:3] NA TRUE TRUE 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: logical, na.rm = TRUE 1111s List of 2 1111s $ x: logi [1:3] NA TRUE TRUE 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: logical, na.rm = FALSE 1111s List of 2 1111s $ x: logi [1:3] NA TRUE TRUE 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: logical, na.rm = TRUE 1111s List of 2 1111s $ x: logi [1:3] NA TRUE TRUE 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: integer, na.rm = FALSE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] 1 1 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: integer, na.rm = TRUE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] 1 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: integer, na.rm = FALSE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: integer, na.rm = TRUE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: integer, na.rm = FALSE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: integer, na.rm = TRUE 1111s List of 2 1111s $ x: int [1:3] NA 1 1 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: double, na.rm = FALSE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] 1 1 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: double, na.rm = TRUE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] 1 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: double, na.rm = FALSE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: double, na.rm = TRUE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] NA 1 1 1111s List of 2 1111s $ m0: num 1 1111s $ m1: num 1 1111s mode: double, na.rm = FALSE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s mode: double, na.rm = TRUE 1111s List of 2 1111s $ x: num [1:3] NA 1 1 1111s $ w: num [1:3] 1 NA 1 1111s List of 2 1111s $ m0: num NA 1111s $ m1: num NA 1111s > 1112s 1112s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1112s Copyright (C) 2024 The R Foundation for Statistical Computing 1112s Platform: aarch64-unknown-linux-gnu (64-bit) 1112s 1112s R is free software and comes with ABSOLUTELY NO WARRANTY. 1112s You are welcome to redistribute it under certain conditions. 1112s Type 'license()' or 'licence()' for distribution details. 1112s 1112s R is a collaborative project with many contributors. 1112s Type 'contributors()' for more information and 1112s 'citation()' on how to cite R or R packages in publications. 1112s 1112s Type 'demo()' for some demos, 'help()' for on-line help, or 1112s 'help.start()' for an HTML browser interface to help. 1112s Type 'q()' to quit R. 1112s 1112s > library("matrixStats") 1112s > 1112s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1112s > # Subsetted tests 1112s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1112s > source("utils/validateIndicesFramework.R") 1112s > for (mode in c("numeric", "integer")) { 1112s + x <- runif(6, min = -6, max = 6) 1112s + w <- runif(6, min = 0, max = 6) 1112s + storage.mode(x) <- mode 1112s + storage.mode(w) <- mode 1112s + if (mode == "numeric") w[1] <- Inf 1112s + 1112s + for (idxs in index_cases) { 1112s + validateIndicesTestVector_w(x, w, idxs, 1112s + ftest = weightedMean, fsure = weighted.mean, 1112s + na.rm = TRUE, refine = TRUE) 1112s + validateIndicesTestVector_w(x, w, idxs, 1112s + ftest = weightedMean, fsure = weighted.mean, 1112s + na.rm = FALSE, refine = TRUE) 1112s + } 1112s + } 1113s > 1113s 1113s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1113s Copyright (C) 2024 The R Foundation for Statistical Computing 1113s Platform: aarch64-unknown-linux-gnu (64-bit) 1113s 1113s R is free software and comes with ABSOLUTELY NO WARRANTY. 1113s You are welcome to redistribute it under certain conditions. 1113s Type 'license()' or 'licence()' for distribution details. 1113s 1113s R is a collaborative project with many contributors. 1113s Type 'contributors()' for more information and 1113s 'citation()' on how to cite R or R packages in publications. 1113s 1113s Type 'demo()' for some demos, 'help()' for on-line help, or 1113s 'help.start()' for an HTML browser interface to help. 1113s Type 'q()' to quit R. 1113s 1114s > library("matrixStats") 1114s > 1114s > x <- 1:5 1114s > y <- weightedMedian(x) 1114s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = TRUE) 1114s > print(y) 1114s [1] 3 1114s > 1114s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = FALSE) 1114s > print(y) 1114s [1] NA 1114s > stopifnot(is.na(y)) 1114s > 1114s > x <- 1:10 1114s > n <- length(x) 1114s > 1114s > y1 <- median(x) # 5.5 1114s > y2 <- weightedMedian(x) # 5.5 1114s > stopifnot(all.equal(y1, y2)) 1114s > 1114s > 1114s > w <- rep(1, times = n) 1114s > y1 <- weightedMedian(x, w) # 5.5 (default) 1114s > y2a <- weightedMedian(x, ties = "weighted") # 5.5 (default) 1114s > y2b <- weightedMedian(x, ties = "min") # 5 1114s > y2c <- weightedMedian(x, ties = "max") # 6 1114s > stopifnot(all.equal(y2a, y1)) 1114s > 1114s > y3 <- weightedMedian(x, w) # 5.5 (default) 1114s > 1114s > 1114s > # Pull the median towards zero 1114s > w[1] <- 5 1114s > y1 <- weightedMedian(x, w) # 3.5 1114s > y <- c(rep(0, times = w[1]), x[-1]) # Only possible for integer weights 1114s > y2 <- median(y) # 3.5 1114s > stopifnot(all.equal(y1, y2)) 1114s > 1114s > # Put even more weight on the zero 1114s > w[1] <- 8.5 1114s > y <- weightedMedian(x, w) # 2 1114s > 1114s > # All weight on the first value 1114s > w[1] <- Inf 1114s > y <- weightedMedian(x, w) # 1 1114s > 1114s > # All weight on the last value 1114s > w[1] <- 1 1114s > w[n] <- Inf 1114s > y <- weightedMedian(x, w) # 10 1114s > 1114s > # All weights set to zero 1114s > w <- rep(0, times = n) 1114s > y <- weightedMedian(x, w) # NA 1114s > 1114s > x <- 1:4 1114s > w <- rep(1, times = 4) 1114s > for (mode in c("integer", "double")) { 1114s + storage.mode(x) <- mode 1114s + for (ties in c("weighted", "mean", "min", "max")) { 1114s + cat(sprintf("ties = %s\n", ties)) 1114s + y <- weightedMedian(x, w, ties = ties) 1114s + } 1114s + } 1114s ties = weighted 1114s ties = mean 1114s ties = min 1114s ties = max 1114s ties = weighted 1114s ties = mean 1114s ties = min 1114s ties = max 1114s > 1114s > set.seed(0x42) 1114s > 1114s > y <- weightedMedian(x = double(0L)) 1114s > print(y) 1114s [1] NA 1114s > stopifnot(length(y) == 1L) 1114s > stopifnot(is.na(y)) 1114s > 1114s > y <- weightedMedian(x = x[1]) 1114s > print(y) 1114s [1] 1 1114s > stopifnot(length(y) == 1L) 1114s > stopifnot(all.equal(y, x[1])) 1114s > 1114s > 1114s > n <- 1e3 1114s > x <- runif(n) 1114s > w <- runif(n, min = 0, max = 1) 1114s > for (mode in c("integer", "double")) { 1114s + storage.mode(x) <- mode 1114s + for (ties in c("weighted", "mean", "min", "max")) { 1114s + y <- weightedMedian(x, w, ties = ties) 1114s + cat(sprintf("mode = %s, ties = %s, result = %g\n", mode, ties, y)) 1114s + } 1114s + } 1114s mode = integer, ties = weighted, result = 0 1114s mode = integer, ties = mean, result = 0 1114s mode = integer, ties = min, result = 0 1114s mode = integer, ties = max, result = 0 1114s mode = double, ties = weighted, result = 0 1114s mode = double, ties = mean, result = 0 1114s mode = double, ties = min, result = 0 1114s mode = double, ties = max, result = 0 1114s > 1114s > 1114s > # A large vector 1114s > n <- 1e5 1114s > x <- runif(n) 1114s > w <- runif(n, min = 0, max = 1) 1114s > y <- weightedMedian(x, w) 1114s > 1114s > y <- weightedMedian(x, w, ties = "min") 1114s > 1114s > 1114s > # Single Number 1114s > xs <- c(1, NA_integer_) 1114s > ws <- c(1, NA_integer_) 1114s > for (x in xs) { 1114s + for (w in ws) { 1114s + y <- weightedMedian(x = x, w = w) 1114s + if (is.na(w)) z <- NA_real_ 1114s + else z <- x[1] 1114s + stopifnot(all.equal(y, z)) 1114s + } 1114s + } 1114s > 1114s > ## Logical 1114s > x1 <- c(TRUE, FALSE, TRUE) 1114s > w0 <- c(0, 0, 0) 1114s > stopifnot(!is.finite(weightedMedian(x1, w0)), 1114s + !is.infinite(weightedMedian(x1, w0))) 1114s > 1114s > w1 <- c(1, 1, 1) 1114s > stopifnot(weightedMedian(x1, w1) == 1) 1114s > 1114s > w2 <- c(1, 2, 3) 1114s > stopifnot(weightedMedian(x1, w2) == 1) 1114s > 1114s > ### NA 1114s > stopifnot(is.na(weightedMedian(c(TRUE, FALSE, NA), 1114s + c(1, 2, 3))), 1114s + all.equal(weightedMedian(c(TRUE, FALSE, NA), 1114s + c(1, 2, 3), 1114s + na.rm = TRUE), 1114s + weightedMedian(c(TRUE, FALSE), 1114s + c(1, 2)))) 1114s > ### Identical to as.integer() 1114s > x <- rcauchy(100) 1114s > w <- abs(rcauchy(100)) 1114s > stopifnot(all.equal(weightedMedian(x > 0, w), 1114s + weightedMedian(as.integer(x > 0), w))) 1114s > 1114s > 1114s > 1114s 1114s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1114s Copyright (C) 2024 The R Foundation for Statistical Computing 1114s Platform: aarch64-unknown-linux-gnu (64-bit) 1114s 1114s R is free software and comes with ABSOLUTELY NO WARRANTY. 1114s You are welcome to redistribute it under certain conditions. 1114s Type 'license()' or 'licence()' for distribution details. 1114s 1114s R is a collaborative project with many contributors. 1114s Type 'contributors()' for more information and 1114s 'citation()' on how to cite R or R packages in publications. 1114s 1114s Type 'demo()' for some demos, 'help()' for on-line help, or 1114s 'help.start()' for an HTML browser interface to help. 1114s Type 'q()' to quit R. 1114s 1115s > library("matrixStats") 1115s > 1115s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1115s > # Subsetted tests 1115s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1115s > source("utils/validateIndicesFramework.R") 1115s > for (mode in c("numeric", "integer")) { 1115s + x <- runif(6, min = -6, max = 6) 1115s + w <- runif(6, min = 0, max = 6) 1115s + storage.mode(x) <- mode 1115s + storage.mode(w) <- mode 1115s + if (mode == "numeric") w[1] <- Inf 1115s + 1115s + for (idxs in index_cases) { 1115s + validateIndicesTestVector_w(x, w, idxs, 1115s + ftest = weightedMedian, 1115s + fsure = weightedMedian, 1115s + na.rm = TRUE) 1115s + validateIndicesTestVector_w(x, w, idxs, 1115s + ftest = weightedMedian, 1115s + fsure = weightedMedian, 1115s + na.rm = FALSE) 1115s + 1115s + for (ties in c("weighted", "mean", "min", "max")) { 1115s + validateIndicesTestVector_w(x, w, idxs, 1115s + ftest = weightedMedian, 1115s + fsure = weightedMedian, 1115s + na.rm = TRUE, ties = ties) 1115s + validateIndicesTestVector_w(x, w, idxs, 1115s + ftest = weightedMedian, 1115s + fsure = weightedMedian, 1115s + na.rm = FALSE, ties = ties) 1115s + } 1115s + } 1115s + } 1116s > 1116s 1116s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1116s Copyright (C) 2024 The R Foundation for Statistical Computing 1116s Platform: aarch64-unknown-linux-gnu (64-bit) 1116s 1116s R is free software and comes with ABSOLUTELY NO WARRANTY. 1116s You are welcome to redistribute it under certain conditions. 1116s Type 'license()' or 'licence()' for distribution details. 1116s 1116s R is a collaborative project with many contributors. 1116s Type 'contributors()' for more information and 1116s 'citation()' on how to cite R or R packages in publications. 1116s 1116s Type 'demo()' for some demos, 'help()' for on-line help, or 1116s 'help.start()' for an HTML browser interface to help. 1116s Type 'q()' to quit R. 1116s 1116s > library("matrixStats") 1116s > 1116s > weightedVar_R <- function(x, w) { 1116s + mu <- weighted.mean(x, w = w) 1116s + sum(w * (x - mu) ^ 2) / (sum(w) - 1) 1116s + } 1116s > 1116s > 1116s > n <- 10 1116s > x <- as.double(1:n) 1116s > 1116s > message("*** weightedVar() ...") 1116s *** weightedVar() ... 1116s > 1116s > message("- Zero elements") 1116s - Zero elements 1116s > m0 <- var(integer(0)) 1116s > m1 <- weightedVar(integer(0), w = integer(0)) 1116s > str(list(m0 = m0, m1 = m1)) 1116s List of 2 1117s $ m0: num - One elements 1117s NA 1117s $ m1: int NA 1117s > stopifnot(all.equal(m1, m0)) 1117s > 1117s > 1117s > message("- One elements") 1117s > m0 <- var(1) 1117s > m1 <- weightedVar(1) 1117s > str(list(m0 = m0, m1 = m1)) 1117s List of 2 1117s $ m0: num NA 1117s $ m1: num NA 1117s > stopifnot(all.equal(m1, m0)) 1117s > 1117s > 1117s > message("- Uniform weights (all w = 1)") 1117s - Uniform weights (all w = 1) 1117s > m0 <- var(x) 1117s > w <- rep(1, times = n) 1117s > m1 <- weightedVar(x, w = w) 1117s > str(list(m0 = m0, m1 = m1)) 1117s List of 2 1117s $ m0: num 9.17 1117s $ m1: num 9.17- Uniform weights (all w = 3) 1117s 1117s > stopifnot(all.equal(m1, m0)) 1117s > 1117s > 1117s > message("- Uniform weights (all w = 3)") 1117s > m0 <- var(rep(x, each = 3)) 1117s > w <- rep(3, times = n) 1117s > m1 <- weightedVar(x, w = w) 1117s > str(list(m0 = m0, m1 = m1)) 1117s List of 2 1117s $ m0: num 8.53 1117s $ m1: num 8.53 1117s > stopifnot(all.equal(m1, m0)) 1117s > 1117s > 1117s > message("- Uniform weights on the first five elements") 1117s - Uniform weights on the first five elements 1117s > idxs <- 1:5 1117s > m0 <- var(x[1:5]) 1117s > w <- rep(0, times = n) 1117s > w[idxs] <- 1 1117s > m1 <- weightedVar(x, w = w) 1117s > str(list(m0 = m0, m1 = m1)) 1117s List of 2 1117s $ m0: num 2.5 1117s $ m1: num 2.5 1117s > stopifnot(all.equal(m1, m0)) 1117s > 1117s > 1117s > message("- Uniform weights on every second elements") 1117s > - Uniform weights on every second elements 1117s idxs <- seq(from = 1, to = n, by = 2) 1117s > m0 <- var(x[idxs]) 1117s > w <- rep(0, times = n) 1117s > w[idxs] <- 1 1117s > m1 <- weightedVar(x, w = w) 1117s > str(list(m0 = m0, m1 = m1)) 1117s List of 2 1117s $ m0: num 10 1117s $ m1: num 10 1117s > stopifnot(all.equal(m1, m0)) 1117s > 1117s > 1117s > message("- All weights are zero") 1117s - All weights are zero 1117s > idxs <- integer(0L) 1117s > m0 <- var(x[idxs]) 1117s > w <- rep(0, times = n) 1117s > w[idxs] <- 1 1117s > m1 <- weightedVar(x, w = w) 1117s > str(list(m0 = m0, m1 = m1)) 1117s List of 2 1117s $ m0: num NA 1117s $ m1: num NA 1117s > stopifnot(all.equal(m1, m0)) 1117s > 1117s > message("- Infinite weight on first element") 1117s - Infinite weight on first element 1117s > idxs <- 1L 1117s > m0 <- var(x[idxs]) 1117s > w <- rep(0, times = n) 1117s > w[idxs] <- Inf 1117s > m1 <- weightedVar(x, w = w) 1117s > str(list(m0 = m0, m1 = m1)) 1117s List of 2 1117s $ m0: num NA 1117s $ m1: num NA 1117s > stopifnot(all.equal(m1, m0)) 1117s > - Missing-value weight on first element 1117s 1117s > message("- Missing-value weight on first element") 1117s > idxs <- 1L 1117s > w <- rep(1, times = n) 1117s > w[idxs] <- NA_real_ 1117s > m1 <- weightedVar(x, w = w) 1117s > str(list(m1 = m1)) 1117s List of 1 1117s $ m1: num NA 1117s > stopifnot(identical(m1, NA_real_)) 1117s > 1117s > 1117s > message("- Frequency weights") 1117s - Frequency weights 1117s > 1117s > ## From https://en.wikipedia.org/wiki/Weighted_arithmetic_mean 1117s > y <- c(2, 2, 4, 5, 5, 5) 1117s > x <- unique(y) 1117s > w <- table(y) 1117s > stopifnot(names(w) == x) 1117s > 1117s > m0 <- weightedVar(x, w = w) 1117s > m1 <- var(y) 1117s > stopifnot(all.equal(m1, m0)) 1117s > m2 <- weightedVar(x, w = w) 1117s > str(list(m0 = m0, m1 = m1, m2 = m2)) 1117s List of 3 1117s $ m0: num 2.17 1117s $ m1: num 2.17 1117s $ m2: num 2.17 1117s > stopifnot(all.equal(m2, m0)) 1117s > 1117s > ## From https://github.com/HenrikBengtsson/matrixStats/issues/72 1117s > large <- c(21, 8, 26, 1, 15, 33, 12, 25, 0, 84) 1117s > years <- c(41706, 9301, 33678, 3082, 27040, 44188, 10049, 30591, 2275, 109831) 1117s > 1117s > m0 <- weightedVar(large, w = years) 1117s > m1 <- weightedVar(large, w = years) 1117s > str(list(m0 = m0, m1 = m1)) 1117s List of 2 1117s $ m0: num 899 1117s $ m1: num 899 1117s *** weightedVar() ... DONE 1117s > stopifnot(all.equal(m1, m0)) 1117s > 1117s > message("*** weightedVar() ... DONE") 1117s > 1117s 1117s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1117s Copyright (C) 2024 The R Foundation for Statistical Computing 1117s Platform: aarch64-unknown-linux-gnu (64-bit) 1117s 1117s R is free software and comes with ABSOLUTELY NO WARRANTY. 1117s You are welcome to redistribute it under certain conditions. 1117s Type 'license()' or 'licence()' for distribution details. 1117s 1117s R is a collaborative project with many contributors. 1117s Type 'contributors()' for more information and 1117s 'citation()' on how to cite R or R packages in publications. 1117s 1117s Type 'demo()' for some demos, 'help()' for on-line help, or 1117s 'help.start()' for an HTML browser interface to help. 1117s Type 'q()' to quit R. 1117s 1118s > library("matrixStats") 1118s > 1118s > fcns <- list( 1118s + weightedVar = weightedVar, 1118s + weightedSd = weightedSd, 1118s + weightedMad = weightedMad 1118s + ) 1118s > 1118s > for (name in names(fcns)) { 1118s + cat(sprintf("%s()...\n", name)) 1118s + fcn <- fcns[[name]] 1118s + 1118s + for (mode in c("integer", "double")) { 1118s + cat("mode: ", mode, "\n", sep = "") 1118s + n <- 15L 1118s + x <- runif(n, min = -5, max = 5) 1118s + storage.mode(x) <- mode 1118s + str(x) 1118s + 1118s + for (add_na in c(FALSE, TRUE)) { 1118s + cat("add_na: ", add_na, "\n", sep = "") 1118s + if (add_na) { 1118s + x[c(5, 7)] <- NA 1118s + } 1118s + str(x) 1118s + 1118s + for (na.rm in c(FALSE, TRUE)) { 1118s + cat("na.rm: ", na.rm, "\n", sep = "") 1118s + 1118s + cat("Weights are not specified (all are 1)\n") 1118s + m1 <- fcn(x, na.rm = na.rm) 1118s + str(list(m1 = m1)) 1118s + 1118s + cat("All weights are 1\n") 1118s + w <- rep(1, times = n) 1118s + m1 <- fcn(x, w, na.rm = na.rm) 1118s + str(list(m1 = m1)) 1118s + 1118s + cat("First weight is 5\n") 1118s + # Pull the mean towards zero 1118s + w[1] <- 5 1118s + str(w) 1118s + m1 <- fcn(x, w, na.rm = na.rm) 1118s + str(list(m1 = m1)) 1118s + 1118s + cat("All weights are 0\n") 1118s + # All weights set to zero 1118s + w <- rep(0, times = n) 1118s + m1 <- fcn(x, w, na.rm = na.rm) 1118s + str(list(m1 = m1)) 1118s + 1118s + cat("First weight is 8.5\n") 1118s + # Put even more weight on the zero 1118s + w[1] <- 8.5 1118s + m1 <- fcn(x, w, na.rm = na.rm) 1118s + str(list(m1 = m1)) 1118s + 1118s + cat("First weight is Inf\n") 1118s + # All weight on the first value 1118s + w[1] <- Inf 1118s + m1 <- fcn(x, w, na.rm = na.rm) 1118s + str(list(m1 = m1)) 1118s + 1118s + cat("Last weight is Inf\n") 1118s + # All weight on the last value 1118s + w[1] <- 1 1118s + w[n] <- Inf 1118s + m1 <- fcn(x, w, na.rm = na.rm) 1118s + str(list(m1 = m1)) 1118s + 1118s + cat("Last weight is NA\n") 1118s + # All weight on the last value 1118s + w[1] <- 1 1118s + w[n] <- NA_real_ 1118s + m1 <- fcn(x, w, na.rm = na.rm) 1118s + str(list(m1 = m1)) 1118s + } # for (na.rm ...) 1118s + } # for (add_na ...) 1118s + } # for (mode ...) 1118s + 1118s + cat(sprintf("%s()...DONE\n", name)) 1118s + } # for (name ...) 1118s weightedVar()... 1118s mode: integer 1118s int [1:15] 2 -1 -1 -4 -1 0 -3 0 -4 4 ... 1118s add_na: FALSE 1118s int [1:15] 2 -1 -1 -4 -1 0 -3 0 -4 4 ... 1118s na.rm: FALSE 1118s Weights are not specified (all are 1) 1118s List of 1 1118s $ m1: num 5.64 1118s All weights are 1 1118s List of 1 1118s $ m1: num 5.64 1118s First weight is 5 1118s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1118s List of 1 1118s $ m1: num 5.7 1118s All weights are 0 1118s List of 1 1118s $ m1: int NA 1118s First weight is 8.5 1118s List of 1 1118s $ m1: int NA 1118s First weight is Inf 1118s List of 1 1118s $ m1: int NA 1118s Last weight is Inf 1118s List of 1 1118s $ m1: int NA 1118s Last weight is NA 1118s List of 1 1118s $ m1: int NA 1118s na.rm: TRUE 1118s Weights are not specified (all are 1) 1118s List of 1 1118s $ m1: num 5.64 1118s All weights are 1 1118s List of 1 1118s $ m1: num 5.64 1118s First weight is 5 1118s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1118s List of 1 1118s $ m1: num 5.7 1118s All weights are 0 1118s List of 1 1118s $ m1: int NA 1118s First weight is 8.5 1118s List of 1 1118s $ m1: int NA 1118s First weight is Inf 1118s List of 1 1118s $ m1: int NA 1118s Last weight is Inf 1118s List of 1 1118s $ m1: int NA 1118s Last weight is NA 1118s List of 1 1118s $ m1: int NA 1118s add_na: TRUE 1118s int [1:15] 2 -1 -1 -4 NA 0 NA 0 -4 4 ... 1118s na.rm: FALSE 1118s Weights are not specified (all are 1) 1118s List of 1 1118s $ m1: int NA 1118s All weights are 1 1118s List of 1 1118s $ m1: int NA 1118s First weight is 5 1118s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1118s List of 1 1118s $ m1: int NA 1118s All weights are 0 1118s List of 1 1118s $ m1: int NA 1118s First weight is 8.5 1118s List of 1 1118s $ m1: int NA 1118s First weight is Inf 1118s List of 1 1118s $ m1: int NA 1118s Last weight is Inf 1118s List of 1 1118s $ m1: int NA 1118s Last weight is NA 1118s List of 1 1118s $ m1: int NA 1118s na.rm: TRUE 1118s Weights are not specified (all are 1) 1118s List of 1 1118s $ m1: num 6.1 1118s All weights are 1 1118s List of 1 1118s $ m1: num 6.1 1118s First weight is 5 1118s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1118s List of 1 1118s $ m1: num 5.81 1118s All weights are 0 1118s List of 1 1118s $ m1: int NA 1118s First weight is 8.5 1118s List of 1 1118s $ m1: int NA 1118s First weight is Inf 1118s List of 1 1118s $ m1: int NA 1118s Last weight is Inf 1118s List of 1 1118s $ m1: int NA 1118s Last weight is NA 1118s List of 1 1118s $ m1: int NA 1118s mode: double 1118s num [1:15] 4.03 4.18 1.41 -4.04 -3.26 ... 1118s add_na: FALSE 1118s num [1:15] 4.03 4.18 1.41 -4.04 -3.26 ... 1118s na.rm: FALSE 1118s Weights are not specified (all are 1) 1118s List of 1 1118s $ m1: num 10.1 1118s All weights are 1 1118s List of 1 1118s $ m1: num 10.1 1118s First weight is 5 1118s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1118s List of 1 1118s $ m1: num 10.6 1118s All weights are 0 1118s List of 1 1118s $ m1: num NA 1118s First weight is 8.5 1118s List of 1 1118s $ m1: num NA 1118s First weight is Inf 1118s List of 1 1118s $ m1: num NA 1118s Last weight is Inf 1118s List of 1 1118s $ m1: num NA 1118s Last weight is NA 1118s List of 1 1118s $ m1: num NA 1118s na.rm: TRUE 1118s Weights are not specified (all are 1) 1118s List of 1 1118s $ m1: num 10.1 1118s All weights are 1 1118s List of 1 1118s $ m1: num 10.1 1118s First weight is 5 1118s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1118s List of 1 1118s $ m1: num 10.6 1118s All weights are 0 1118s List of 1 1118s $ m1: num NA 1118s First weight is 8.5 1118s List of 1 1118s $ m1: num NA 1118s First weight is Inf 1118s List of 1 1118s $ m1: num NA 1118s Last weight is Inf 1118s List of 1 1118s $ m1: num NA 1118s Last weight is NA 1118s List of 1 1118s $ m1: num NA 1118s add_na: TRUE 1118s num [1:15] 4.03 4.18 1.41 -4.04 NA ... 1118s na.rm: FALSE 1118s Weights are not specified (all are 1) 1118s List of 1 1118s $ m1: num NA 1118s All weights are 1 1118s List of 1 1118s $ m1: num NA 1118s First weight is 5 1118s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1118s List of 1 1118s $ m1: num NA 1118s All weights are 0 1118s List of 1 1118s $ m1: num NA 1118s First weight is 8.5 1118s List of 1 1118s $ m1: num NA 1118s First weight is Inf 1118s List of 1 1118s $ m1: num NA 1118s Last weight is Inf 1118s List of 1 1118s $ m1: num NA 1118s Last weight is NA 1119s List of 1 1119s $ m1: num NA 1119s na.rm: TRUE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num 10.6 1119s All weights are 1 1119s List of 1 1119s $ m1: num 10.6 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num 10.8 1119s All weights are 0 1119s List of 1 1119s $ m1: num NA 1119s First weight is 8.5 1119s List of 1 1119s $ m1: num NA 1119s First weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is NA 1119s List of 1 1119s $ m1: num NA 1119s weightedVar()...DONE 1119s weightedSd()... 1119s mode: integer 1119s int [1:15] 1 4 4 -2 3 -3 -3 -2 -1 3 ... 1119s add_na: FALSE 1119s int [1:15] 1 4 4 -2 3 -3 -3 -2 -1 3 ... 1119s na.rm: FALSE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num 2.54 1119s All weights are 1 1119s List of 1 1119s $ m1: num 2.54 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num 2.24 1119s All weights are 0 1119s List of 1 1119s $ m1: num NA 1119s First weight is 8.5 1119s List of 1 1119s $ m1: num NA 1119s First weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is NA 1119s List of 1 1119s $ m1: num NA 1119s na.rm: TRUE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num 2.54 1119s All weights are 1 1119s List of 1 1119s $ m1: num 2.54 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num 2.24 1119s All weights are 0 1119s List of 1 1119s $ m1: num NA 1119s First weight is 8.5 1119s List of 1 1119s $ m1: num NA 1119s First weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is NA 1119s List of 1 1119s $ m1: num NA 1119s add_na: TRUE 1119s int [1:15] 1 4 4 -2 NA -3 NA -2 -1 3 ... 1119s na.rm: FALSE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num NA 1119s All weights are 1 1119s List of 1 1119s $ m1: num NA 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num NA 1119s All weights are 0 1119s List of 1 1119s $ m1: num NA 1119s First weight is 8.5 1119s List of 1 1119s $ m1: num NA 1119s First weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is NA 1119s List of 1 1119s $ m1: num NA 1119s na.rm: TRUE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num 2.43 1119s All weights are 1 1119s List of 1 1119s $ m1: num 2.43 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num 2.11 1119s All weights are 0 1119s List of 1 1119s $ m1: num NA 1119s First weight is 8.5 1119s List of 1 1119s $ m1: num NA 1119s First weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is NA 1119s List of 1 1119s $ m1: num NA 1119s mode: double 1119s num [1:15] 0.0325 -0.4882 -3.3576 -1.6179 4.1149 ... 1119s add_na: FALSE 1119s num [1:15] 0.0325 -0.4882 -3.3576 -1.6179 4.1149 ... 1119s na.rm: FALSE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num 3.18 1119s All weights are 1 1119s List of 1 1119s $ m1: num 3.18 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num 2.8 1119s All weights are 0 1119s List of 1 1119s $ m1: num NA 1119s First weight is 8.5 1119s List of 1 1119s $ m1: num NA 1119s First weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is NA 1119s List of 1 1119s $ m1: num NA 1119s na.rm: TRUE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num 3.18 1119s All weights are 1 1119s List of 1 1119s $ m1: num 3.18 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num 2.8 1119s All weights are 0 1119s List of 1 1119s $ m1: num NA 1119s First weight is 8.5 1119s List of 1 1119s $ m1: num NA 1119s First weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is NA 1119s List of 1 1119s $ m1: num NA 1119s add_na: TRUE 1119s num [1:15] 0.0325 -0.4882 -3.3576 -1.6179 NA ... 1119s na.rm: FALSE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num NA 1119s All weights are 1 1119s List of 1 1119s $ m1: num NA 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num NA 1119s All weights are 0 1119s List of 1 1119s $ m1: num NA 1119s First weight is 8.5 1119s List of 1 1119s $ m1: num NA 1119s First weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is NA 1119s List of 1 1119s $ m1: num NA 1119s na.rm: TRUE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num 2.95 1119s All weights are 1 1119s List of 1 1119s $ m1: num 2.95 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num 2.56 1119s All weights are 0 1119s List of 1 1119s $ m1: num NA 1119s First weight is 8.5 1119s List of 1 1119s $ m1: num NA 1119s First weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is Inf 1119s List of 1 1119s $ m1: num NA 1119s Last weight is NA 1119s List of 1 1119s $ m1: num NA 1119s weightedSd()...DONE 1119s weightedMad()... 1119s mode: integer 1119s int [1:15] -2 -1 0 0 2 -4 3 2 2 2 ... 1119s add_na: FALSE 1119s int [1:15] -2 -1 0 0 2 -4 3 2 2 2 ... 1119s na.rm: FALSE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num 2.97 1119s All weights are 1 1119s List of 1 1119s $ m1: num 2.97 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num 2.97 1119s All weights are 0 1119s List of 1 1119s $ m1: int NA 1119s First weight is 8.5 1119s List of 1 1119s $ m1: int 0 1119s First weight is Inf 1119s List of 1 1119s $ m1: int 0 1119s Last weight is Inf 1119s List of 1 1119s $ m1: int 0 1119s Last weight is NA 1119s List of 1 1119s $ m1: int NA 1119s na.rm: TRUE 1119s Weights are not specified (all are 1) 1119s List of 1 1119s $ m1: num 2.97 1119s All weights are 1 1119s List of 1 1119s $ m1: num 2.97 1119s First weight is 5 1119s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1119s List of 1 1119s $ m1: num 2.97 1119s All weights are 0 1119s List of 1 1119s $ m1: int NA 1119s First weight is 8.5 1120s List of 1 1120s $ m1: int 0 1120s First weight is Inf 1120s List of 1 1120s $ m1: int 0 1120s Last weight is Inf 1120s List of 1 1120s $ m1: int 0 1120s Last weight is NA 1120s List of 1 1120s $ m1: int NA 1120s add_na: TRUE 1120s int [1:15] -2 -1 0 0 NA -4 NA 2 2 2 ... 1120s na.rm: FALSE 1120s Weights are not specified (all are 1) 1120s List of 1 1120s $ m1: num NA 1120s All weights are 1 1120s List of 1 1120s $ m1: int NA 1120s First weight is 5 1120s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1120s List of 1 1120s $ m1: int NA 1120s All weights are 0 1120s List of 1 1120s $ m1: int NA 1120s First weight is 8.5 1120s List of 1 1120s $ m1: int 0 1120s First weight is Inf 1120s List of 1 1120s $ m1: int 0 1120s Last weight is Inf 1120s List of 1 1120s $ m1: int 0 1120s Last weight is NA 1120s List of 1 1120s $ m1: int NA 1120s na.rm: TRUE 1120s Weights are not specified (all are 1) 1120s List of 1 1120s $ m1: num 2.97 1120s All weights are 1 1120s List of 1 1120s $ m1: num 2.97 1120s First weight is 5 1120s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1120s List of 1 1120s $ m1: num 1.48 1120s All weights are 0 1120s List of 1 1120s $ m1: int NA 1120s First weight is 8.5 1120s List of 1 1120s $ m1: int 0 1120s First weight is Inf 1120s List of 1 1120s $ m1: int 0 1120s Last weight is Inf 1120s List of 1 1120s $ m1: int 0 1120s Last weight is NA 1120s List of 1 1120s $ m1: int NA 1120s mode: double 1120s num [1:15] -1.21 -0.545 -0.437 -0.536 -1.334 ... 1120s add_na: FALSE 1120s num [1:15] -1.21 -0.545 -0.437 -0.536 -1.334 ... 1120s na.rm: FALSE 1120s Weights are not specified (all are 1) 1120s List of 1 1120s $ m1: num 1.47 1120s All weights are 1 1120s List of 1 1120s $ m1: num 1.47 1120s First weight is 5 1120s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1120s List of 1 1120s $ m1: num 1.18 1120s All weights are 0 1120s List of 1 1120s $ m1: num NA 1120s First weight is 8.5 1120s List of 1 1120s $ m1: num 0 1120s First weight is Inf 1120s List of 1 1120s $ m1: num 0 1120s Last weight is Inf 1120s List of 1 1120s $ m1: num 0 1120s Last weight is NA 1120s List of 1 1120s $ m1: num NA 1120s na.rm: TRUE 1120s Weights are not specified (all are 1) 1120s List of 1 1120s $ m1: num 1.47 1120s All weights are 1 1120s List of 1 1120s $ m1: num 1.47 1120s First weight is 5 1120s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1120s List of 1 1120s $ m1: num 1.18 1120s All weights are 0 1120s List of 1 1120s $ m1: num NA 1120s First weight is 8.5 1120s List of 1 1120s $ m1: num 0 1120s First weight is Inf 1120s List of 1 1120s $ m1: num 0 1120s Last weight is Inf 1120s List of 1 1120s $ m1: num 0 1120s Last weight is NA 1120s List of 1 1120s $ m1: num NA 1120s add_na: TRUE 1120s num [1:15] -1.21 -0.545 -0.437 -0.536 NA ... 1120s na.rm: FALSE 1120s Weights are not specified (all are 1) 1120s List of 1 1120s $ m1: num NA 1120s All weights are 1 1120s List of 1 1120s $ m1: num NA 1120s First weight is 5 1120s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1120s List of 1 1120s $ m1: num NA 1120s All weights are 0 1120s List of 1 1120s $ m1: num NA 1120s First weight is 8.5 1120s List of 1 1120s $ m1: num 0 1120s First weight is Inf 1120s List of 1 1120s $ m1: num 0 1120s Last weight is Inf 1120s List of 1 1120s $ m1: num 0 1120s Last weight is NA 1120s List of 1 1120s $ m1: num NA 1120s na.rm: TRUE 1120s Weights are not specified (all are 1) 1120s List of 1 1120s $ m1: num 1.47 1120s All weights are 1 1120s List of 1 1120s $ m1: num 1.47 1120s First weight is 5 1120s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 1120s List of 1 1120s $ m1: num 1.39 1120s All weights are 0 1120s List of 1 1120s $ m1: num NA 1120s First weight is 8.5 1120s List of 1 1120s $ m1: num 0 1120s First weight is Inf 1120s List of 1 1120s $ m1: num 0 1120s Last weight is Inf 1120s List of 1 1120s $ m1: num 0 1120s Last weight is NA 1120s List of 1 1120s $ m1: num NA 1120s weightedMad()...DONE 1120s > 1120s 1120s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1120s Copyright (C) 2024 The R Foundation for Statistical Computing 1120s Platform: aarch64-unknown-linux-gnu (64-bit) 1120s 1120s R is free software and comes with ABSOLUTELY NO WARRANTY. 1120s You are welcome to redistribute it under certain conditions. 1120s Type 'license()' or 'licence()' for distribution details. 1120s 1120s R is a collaborative project with many contributors. 1120s Type 'contributors()' for more information and 1120s 'citation()' on how to cite R or R packages in publications. 1120s 1120s Type 'demo()' for some demos, 'help()' for on-line help, or 1120s 'help.start()' for an HTML browser interface to help. 1120s Type 'q()' to quit R. 1120s 1121s > library("matrixStats") 1121s > 1121s > fcns <- list( 1121s + weightedVar = weightedVar, 1121s + weightedSd = weightedSd, 1121s + weightedMad = weightedMad 1121s + ) 1121s > 1121s > 1121s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1121s > # Subsetted tests 1121s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1121s > source("utils/validateIndicesFramework.R") 1121s > for (name in names(fcns)) { 1121s + cat(sprintf("subsetted tests on %s()...\n", name)) 1121s + fcn <- fcns[[name]] 1121s + 1121s + for (mode in c("numeric", "integer")) { 1121s + x <- runif(6, min = -6, max = 6) 1121s + w <- runif(6, min = 0, max = 6) 1121s + storage.mode(x) <- mode 1121s + storage.mode(w) <- mode 1121s + if (mode == "numeric") w[1] <- Inf 1121s + 1121s + for (idxs in index_cases) { 1121s + validateIndicesTestVector_w(x, w, idxs, 1121s + ftest = fcn, fsure = fcn, 1121s + na.rm = TRUE) 1121s + validateIndicesTestVector_w(x, w, idxs, 1121s + ftest = fcn, fsure = fcn, 1121s + na.rm = FALSE) 1121s + } 1121s + } 1121s + cat(sprintf("%s()...DONE\n", name)) 1121s + } 1121s subsetted tests on weightedVar()... 1121s weightedVar()...DONE 1121s subsetted tests on weightedSd()... 1121s weightedSd()...DONE 1121s subsetted tests on weightedMad()... 1121s weightedMad()...DONE 1121s > 1122s 1122s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1122s Copyright (C) 2024 The R Foundation for Statistical Computing 1122s Platform: aarch64-unknown-linux-gnu (64-bit) 1122s 1122s R is free software and comes with ABSOLUTELY NO WARRANTY. 1122s You are welcome to redistribute it under certain conditions. 1122s Type 'license()' or 'licence()' for distribution details. 1122s 1122s R is a collaborative project with many contributors. 1122s Type 'contributors()' for more information and 1122s 'citation()' on how to cite R or R packages in publications. 1122s 1122s Type 'demo()' for some demos, 'help()' for on-line help, or 1122s 'help.start()' for an HTML browser interface to help. 1122s Type 'q()' to quit R. 1122s 1122s > library("matrixStats") 1122s > 1122s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 1122s + if (na.rm) { 1122s + xnok <- is.na(x) 1122s + ynok <- is.na(y) 1122s + anok <- xnok & ynok 1122s + unit <- switch(OP, 1122s + "+" = 0, 1122s + "-" = NA_real_, 1122s + "*" = 1, 1122s + "/" = NA_real_, 1122s + stop("Unknown 'OP' operator: ", OP) 1122s + ) 1122s + x[xnok] <- unit 1122s + y[ynok] <- unit 1122s + } 1122s + 1122s + ans <- switch(OP, 1122s + "+" = x + y, 1122s + "-" = x - y, 1122s + "*" = x * y, 1122s + "/" = x / y, 1122s + stop("Unknown 'OP' operator: ", OP) 1122s + ) 1122s + 1122s + if (na.rm) { 1122s + ans[anok] <- NA_real_ 1122s + } 1122s + 1122s + ans 1122s + } # x_OP_y_R() 1122s > 1122s > 1122s > 1122s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 1122s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 1122s + } 1122s > 1122s > 1122s > 1122s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1122s > # No missing values 1122s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1122s > x <- matrix(1:16, nrow = 4, ncol = 4) 1122s > y <- 1:nrow(x) 1122s > storage.mode(y) <- storage.mode(x) 1122s > 1122s > for (OP in c("+", "-", "*", "/")) { 1122s + for (na.rm in c(FALSE, TRUE)) { 1122s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 1122s + 1122s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 1122s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 1122s + str(a1) 1122s + stopifnot(all.equal(a1, a0)) 1122s + 1122s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 1122s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 1122s + str(b1) 1122s + stopifnot(all.equal(b1, b0)) 1122s + } 1122s + } 1122s OP = '+', na.rm = FALSE 1123s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 1123s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 1123s OP = '+', na.rm = TRUE 1123s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 1123s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 1123s OP = '-', na.rm = FALSE 1123s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 1123s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 1123s OP = '-', na.rm = TRUE 1123s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 1123s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 1123s OP = '*', na.rm = FALSE 1123s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 1123s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 1123s OP = '*', na.rm = TRUE 1123s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 1123s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 1123s OP = '/', na.rm = FALSE 1123s num [1:4, 1:4] 1 1 1 1 5 ... 1123s num [1:4, 1:4] 1 2 3 4 2.5 ... 1123s OP = '/', na.rm = TRUE 1123s num [1:4, 1:4] 1 1 1 1 5 ... 1123s num [1:4, 1:4] 1 2 3 4 2.5 ... 1123s > 1123s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1123s > # Missing values in x, y, or both. 1123s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1123s > for (which in c("x", "y", "both")) { 1123s + x <- matrix(1:16, nrow = 4, ncol = 4) 1123s + y <- 1:nrow(x) 1123s + storage.mode(y) <- storage.mode(x) 1123s + 1123s + if (which == "x") { 1123s + x[3:6] <- NA_real_ 1123s + } else if (which == "y") { 1123s + y[c(1, 3)] <- NA_real_ 1123s + } else if (which == "both") { 1123s + x[3:6] <- NA_real_ 1123s + y[c(1, 3)] <- NA_real_ 1123s + } 1123s + 1123s + for (OP in c("+", "-", "*", "/")) { 1123s + for (na.rm in c(FALSE, TRUE)) { 1123s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 1123s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 1123s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 1123s + str(a1) 1123s + stopifnot(all.equal(a1, a0)) 1123s + 1123s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 1123s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 1123s + str(b1) 1123s + stopifnot(all.equal(b1, b0)) 1123s + } 1123s + } 1123s + } 1123s OP = '+', na.rm = FALSE 1123s num [1:4, 1:4] 2 4 NA NA NA NA 10 12 10 12 ... 1123s num [1:4, 1:4] 2 3 NA NA NA NA 9 10 12 13 ... 1123s OP = '+', na.rm = TRUE 1123s num [1:4, 1:4] 2 4 3 4 1 2 10 12 10 12 ... 1123s num [1:4, 1:4] 2 3 1 1 2 2 9 10 12 13 ... 1123s OP = '-', na.rm = FALSE 1123s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 1123s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 1123s OP = '-', na.rm = TRUE 1123s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 1123s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 1123s OP = '*', na.rm = FALSE 1123s num [1:4, 1:4] 1 4 NA NA NA NA 21 32 9 20 ... 1123s num [1:4, 1:4] 1 2 NA NA NA NA 14 16 27 30 ... 1123s OP = '*', na.rm = TRUE 1123s num [1:4, 1:4] 1 4 3 4 1 2 21 32 9 20 ... 1123s num [1:4, 1:4] 1 2 1 1 2 2 14 16 27 30 ... 1123s OP = '/', na.rm = FALSE 1123s num [1:4, 1:4] 1 1 NA NA NA ... 1123s num [1:4, 1:4] 1 2 NA NA NA ... 1123s OP = '/', na.rm = TRUE 1123s num [1:4, 1:4] 1 1 NA NA NA ... 1123s num [1:4, 1:4] 1 2 NA NA NA ... 1123s OP = '+', na.rm = FALSE 1123s num [1:4, 1:4] NA 4 NA 8 NA 8 NA 12 NA 12 ... 1123s num [1:4, 1:4] NA NA NA NA 7 8 9 10 NA NA ... 1123s OP = '+', na.rm = TRUE 1123s num [1:4, 1:4] 1 4 3 8 5 8 7 12 9 12 ... 1123s num [1:4, 1:4] 1 2 3 4 7 8 9 10 9 10 ... 1123s OP = '-', na.rm = FALSE 1123s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 1123s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 1123s OP = '-', na.rm = TRUE 1123s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 1123s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 1123s OP = '*', na.rm = FALSE 1123s num [1:4, 1:4] NA 4 NA 16 NA 12 NA 32 NA 20 ... 1123s num [1:4, 1:4] NA NA NA NA 10 12 14 16 NA NA ... 1123s OP = '*', na.rm = TRUE 1123s num [1:4, 1:4] 1 4 3 16 5 12 7 32 9 20 ... 1123s num [1:4, 1:4] 1 2 3 4 10 12 14 16 9 10 ... 1123s OP = '/', na.rm = FALSE 1123s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 1123s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 1123s OP = '/', na.rm = TRUE 1123s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 1123s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 1123s OP = '+', na.rm = FALSE 1123s num [1:4, 1:4] NA 4 NA NA NA NA NA 12 NA 12 ... 1123s num [1:4, 1:4] NA NA NA NA NA NA 9 10 NA NA ... 1123s OP = '+', na.rm = TRUE 1123s num [1:4, 1:4] 1 4 NA 4 NA 2 7 12 9 12 ... 1123s num [1:4, 1:4] 1 2 NA NA 2 2 9 10 9 10 ... 1123s OP = '-', na.rm = FALSE 1123s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 1123s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 1123s OP = '-', na.rm = TRUE 1123s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 1123s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 1123s OP = '*', na.rm = FALSE 1123s num [1:4, 1:4] NA 4 NA NA NA NA NA 32 NA 20 ... 1123s num [1:4, 1:4] NA NA NA NA NA NA 14 16 NA NA ... 1123s OP = '*', na.rm = TRUE 1123s num [1:4, 1:4] 1 4 NA 4 NA 2 7 32 9 20 ... 1123s num [1:4, 1:4] 1 2 NA NA 2 2 14 16 9 10 ... 1123s OP = '/', na.rm = FALSE 1123s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 1123s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 1123s OP = '/', na.rm = TRUE 1123s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 1123s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 1123s > 1123s > 1123s > 1123s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1123s > # Length differences 1123s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1123s > x <- matrix(1:8, nrow = 2, ncol = 4) 1123s > y <- 1:ncol(x) 1123s > storage.mode(y) <- storage.mode(x) 1123s > 1123s > for (OP in c("+", "-", "*", "/")) { 1123s + for (na.rm in c(FALSE, TRUE)) { 1123s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 1123s + 1123s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 1123s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 1123s + str(a1) 1123s + stopifnot(all.equal(a1, a0)) 1123s + 1123s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 1123s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 1123s + str(b1) 1123s + stopifnot(all.equal(b1, b0)) 1123s + } 1123s + } 1123s OP = '+', na.rm = FALSE 1123s int [1:2, 1:4] 2 4 6 8 6 8 10 12 1123s int [1:2, 1:4] 2 3 5 6 8 9 11 12 1123s OP = '+', na.rm = TRUE 1123s int [1:2, 1:4] 2 4 6 8 6 8 10 12 1123s int [1:2, 1:4] 2 3 5 6 8 9 11 12 1123s OP = '-', na.rm = FALSE 1123s int [1:2, 1:4] 0 0 0 0 4 4 4 4 1123s int [1:2, 1:4] 0 1 1 2 2 3 3 4 1123s OP = '-', na.rm = TRUE 1123s int [1:2, 1:4] 0 0 0 0 4 4 4 4 1123s int [1:2, 1:4] 0 1 1 2 2 3 3 4 1123s OP = '*', na.rm = FALSE 1123s int [1:2, 1:4] 1 4 9 16 5 12 21 32 1123s int [1:2, 1:4] 1 2 6 8 15 18 28 32 1123s OP = '*', na.rm = TRUE 1123s int [1:2, 1:4] 1 4 9 16 5 12 21 32 1123s int [1:2, 1:4] 1 2 6 8 15 18 28 32 1123s OP = '/', na.rm = FALSE 1123s num [1:2, 1:4] 1 1 1 1 5 ... 1123s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 1123s OP = '/', na.rm = TRUE 1123s num [1:2, 1:4] 1 1 1 1 5 ... 1123s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 1123s > 1123s > 1123s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1123s > # All missing values 1123s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1123s > xs <- list( 1123s + A = matrix(1:2, nrow = 2, ncol = 2), 1123s + B = matrix(NA_integer_, nrow = 2, ncol = 2) 1123s + ) 1123s > ys <- list( 1123s + A = 1L, 1123s + B = NA_integer_ 1123s + ) 1123s > 1123s > for (x in xs) { 1123s + for (y in ys) { 1123s + for (mode in c("logical", "integer", "double")) { 1123s + storage.mode(x) <- mode 1123s + storage.mode(y) <- mode 1123s + str(list(x = x, y = y)) 1123s + 1123s + for (OP in c("+", "-", "*", "/")) { 1123s + for (na.rm in c(FALSE, TRUE)) { 1123s + cat(sprintf("mode = '%s', OP = '%s', na.rm = %s\n", mode, OP, na.rm)) 1123s + suppressWarnings({ 1123s + z0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 1123s + z <- x_OP_y(x, y, OP, na.rm = na.rm) 1123s + }) 1123s + str(z) 1123s + stopifnot(all.equal(z, z0)) 1123s + } 1123s + } 1123s + } # for (mode ...) 1123s + } # for (y ...) 1123s + } # for (x ...) 1123s List of 2 1123s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 1123s $ y: logi TRUE 1124s mode = 'logical', OP = '+', na.rm = FALSE 1124s int [1:2, 1:2] 2 2 2 2 1124s mode = 'logical', OP = '+', na.rm = TRUE 1124s int [1:2, 1:2] 2 2 2 2 1124s mode = 'logical', OP = '-', na.rm = FALSE 1124s int [1:2, 1:2] 0 0 0 0 1124s mode = 'logical', OP = '-', na.rm = TRUE 1124s int [1:2, 1:2] 0 0 0 0 1124s mode = 'logical', OP = '*', na.rm = FALSE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'logical', OP = '*', na.rm = TRUE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'logical', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] 1 1 1 1 1124s mode = 'logical', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] 1 1 1 1 1124s List of 2 1124s $ x: int [1:2, 1:2] 1 1 1 1 1124s $ y: int 1 1124s mode = 'integer', OP = '+', na.rm = FALSE 1124s int [1:2, 1:2] 2 2 2 2 1124s mode = 'integer', OP = '+', na.rm = TRUE 1124s int [1:2, 1:2] 2 2 2 2 1124s mode = 'integer', OP = '-', na.rm = FALSE 1124s int [1:2, 1:2] 0 0 0 0 1124s mode = 'integer', OP = '-', na.rm = TRUE 1124s int [1:2, 1:2] 0 0 0 0 1124s mode = 'integer', OP = '*', na.rm = FALSE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'integer', OP = '*', na.rm = TRUE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'integer', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] 1 1 1 1 1124s mode = 'integer', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] 1 1 1 1 1124s List of 2 1124s $ x: num [1:2, 1:2] 1 1 1 1 1124s $ y: num 1 1124s mode = 'double', OP = '+', na.rm = FALSE 1124s num [1:2, 1:2] 2 2 2 2 1124s mode = 'double', OP = '+', na.rm = TRUE 1124s num [1:2, 1:2] 2 2 2 2 1124s mode = 'double', OP = '-', na.rm = FALSE 1124s num [1:2, 1:2] 0 0 0 0 1124s mode = 'double', OP = '-', na.rm = TRUE 1124s num [1:2, 1:2] 0 0 0 0 1124s mode = 'double', OP = '*', na.rm = FALSE 1124s num [1:2, 1:2] 1 1 1 1 1124s mode = 'double', OP = '*', na.rm = TRUE 1124s num [1:2, 1:2] 1 1 1 1 1124s mode = 'double', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] 1 1 1 1 1124s mode = 'double', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] 1 1 1 1 1124s List of 2 1124s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 1124s $ y: logi NA 1124s mode = 'logical', OP = '+', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '+', na.rm = TRUE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'logical', OP = '-', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '-', na.rm = TRUE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '*', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '*', na.rm = TRUE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'logical', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s List of 2 1124s $ x: int [1:2, 1:2] 1 1 1 1 1124s $ y: int NA 1124s mode = 'integer', OP = '+', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '+', na.rm = TRUE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'integer', OP = '-', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '-', na.rm = TRUE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '*', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '*', na.rm = TRUE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'integer', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s List of 2 1124s $ x: num [1:2, 1:2] 1 1 1 1 1124s $ y: num NA 1124s mode = 'double', OP = '+', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '+', na.rm = TRUE 1124s num [1:2, 1:2] 1 1 1 1 1124s mode = 'double', OP = '-', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '-', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '*', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '*', na.rm = TRUE 1124s num [1:2, 1:2] 1 1 1 1 1124s mode = 'double', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s List of 2 1124s $ x: logi [1:2, 1:2] NA NA NA NA 1124s $ y: logi TRUE 1124s mode = 'logical', OP = '+', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '+', na.rm = TRUE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'logical', OP = '-', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '-', na.rm = TRUE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '*', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '*', na.rm = TRUE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'logical', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s List of 2 1124s $ x: int [1:2, 1:2] NA NA NA NA 1124s $ y: int 1 1124s mode = 'integer', OP = '+', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '+', na.rm = TRUE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'integer', OP = '-', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '-', na.rm = TRUE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '*', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '*', na.rm = TRUE 1124s int [1:2, 1:2] 1 1 1 1 1124s mode = 'integer', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s List of 2 1124s $ x: num [1:2, 1:2] NA NA NA NA 1124s $ y: num 1 1124s mode = 'double', OP = '+', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '+', na.rm = TRUE 1124s num [1:2, 1:2] 1 1 1 1 1124s mode = 'double', OP = '-', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '-', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '*', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '*', na.rm = TRUE 1124s num [1:2, 1:2] 1 1 1 1 1124s mode = 'double', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s List of 2 1124s $ x: logi [1:2, 1:2] NA NA NA NA 1124s $ y: logi NA 1124s mode = 'logical', OP = '+', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '+', na.rm = TRUE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '-', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '-', na.rm = TRUE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '*', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '*', na.rm = TRUE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'logical', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s List of 2 1124s $ x: int [1:2, 1:2] NA NA NA NA 1124s $ y: int NA 1124s mode = 'integer', OP = '+', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '+', na.rm = TRUE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '-', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '-', na.rm = TRUE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '*', na.rm = FALSE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '*', na.rm = TRUE 1124s int [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'integer', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s List of 2 1124s $ x: num [1:2, 1:2] NA NA NA NA 1124s $ y: num NA 1124s mode = 'double', OP = '+', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '+', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '-', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '-', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '*', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '*', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '/', na.rm = FALSE 1124s num [1:2, 1:2] NA NA NA NA 1124s mode = 'double', OP = '/', na.rm = TRUE 1124s num [1:2, 1:2] NA NA NA NA 1124s > 1125s 1125s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1125s Copyright (C) 2024 The R Foundation for Statistical Computing 1125s Platform: aarch64-unknown-linux-gnu (64-bit) 1125s 1125s R is free software and comes with ABSOLUTELY NO WARRANTY. 1125s You are welcome to redistribute it under certain conditions. 1125s Type 'license()' or 'licence()' for distribution details. 1125s 1125s R is a collaborative project with many contributors. 1125s Type 'contributors()' for more information and 1125s 'citation()' on how to cite R or R packages in publications. 1125s 1125s Type 'demo()' for some demos, 'help()' for on-line help, or 1125s 'help.start()' for an HTML browser interface to help. 1125s Type 'q()' to quit R. 1125s 1125s > library("matrixStats") 1125s > 1125s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 1125s + if (na.rm) { 1125s + xnok <- is.na(x) 1125s + ynok <- is.na(y) 1125s + anok <- xnok & ynok 1125s + unit <- switch(OP, 1125s + "+" = 0, 1125s + "-" = NA_real_, 1125s + "*" = 1, 1125s + "/" = NA_real_, 1125s + stop("Unknown 'OP' operator: ", OP) 1125s + ) 1125s + x[xnok] <- unit 1125s + y[ynok] <- unit 1125s + } 1125s + 1125s + ans <- switch(OP, 1125s + "+" = x + y, 1125s + "-" = x - y, 1125s + "*" = x * y, 1125s + "/" = x / y, 1125s + stop("Unknown 'OP' operator: ", OP) 1125s + ) 1125s + 1125s + if (na.rm) { 1125s + ans[anok] <- NA_real_ 1125s + } 1125s + 1125s + ans 1125s + } # x_OP_y_R() 1125s > 1125s > 1125s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 1125s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 1125s + } 1125s > 1125s > 1125s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1125s > # Subsetted tests 1125s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1125s > source("utils/validateIndicesFramework.R") 1125s > for (OP in c("+", "-", "*", "/")) { 1125s + for (mode in c("numeric", "integer", "logical")) { 1125s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 1125s + y <- runif(6, min = 0, max = 6) 1125s + storage.mode(x) <- mode 1125s + storage.mode(y) <- mode 1125s + if (mode == "numeric") y[1] <- Inf 1125s + 1125s + for (xrows in index_cases) { 1125s + for (xcols in index_cases) { 1125s + if (is.null(xrows)) xrows <- seq_len(nrow(x)) 1125s + if (is.null(xcols)) xcols <- seq_len(ncol(x)) 1125s + 1125s + for (yidxs in list(xrows, xcols)) { 1125s + for (na.rm in c(TRUE, FALSE)) { 1125s + 1125s + suppressWarnings({ 1125s + actual <- tryCatch( 1125s + x_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 1125s + na.rm = na.rm), 1125s + error = function(c) "error" 1125s + ) 1125s + 1125s + expect <- tryCatch( 1125s + x_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 1125s + na.rm = na.rm), 1125s + error = function(c) "error" 1125s + ) 1125s + }) 1125s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 1125s + 1125s + suppressWarnings({ 1125s + actual <- tryCatch( 1125s + t_tx_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 1125s + na.rm = na.rm), 1125s + error = function(c) "error" 1125s + ) 1125s + 1125s + expect <- tryCatch( 1125s + t_tx_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 1125s + na.rm = na.rm), 1125s + error = function(c) "error" 1125s + ) 1125s + }) 1125s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 1125s + } 1125s + } 1125s + } 1125s + } 1125s + } 1125s + } 1151s > 1152s 1152s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1152s Copyright (C) 2024 The R Foundation for Statistical Computing 1152s Platform: aarch64-unknown-linux-gnu (64-bit) 1152s 1152s R is free software and comes with ABSOLUTELY NO WARRANTY. 1152s You are welcome to redistribute it under certain conditions. 1152s Type 'license()' or 'licence()' for distribution details. 1152s 1152s R is a collaborative project with many contributors. 1152s Type 'contributors()' for more information and 1152s 'citation()' on how to cite R or R packages in publications. 1152s 1152s Type 'demo()' for some demos, 'help()' for on-line help, or 1152s 'help.start()' for an HTML browser interface to help. 1152s Type 'q()' to quit R. 1152s 1152s > ## These tests need to be last of all tests, otherwise 1152s > ## covr::package_coverage() gives an error. 1152s > cat("1. Loading package\n") 1152s 1. Loading package 1152s > loadNamespace("matrixStats") 1152s 1152s > stopifnot("matrixStats" %in% loadedNamespaces()) 1152s > 1152s > cat("2. Unloading package\n") 1152s 2. Unloading package 1152s > unloadNamespace("matrixStats") 1152s > stopifnot(!"matrixStats" %in% loadedNamespaces()) 1152s > 1152s > if (FALSE) { 1152s + ## 'covr' gives "Error in library("matrixStats") : 1152s + ## there is no package called 'matrixStats'" here, cf. 1152s + ## https://travis-ci.org/HenrikBengtsson/matrixStats/builds/48015577 1152s + 1152s + cat("3. Attaching package\n") 1152s + library("matrixStats") 1152s + stopifnot("package:matrixStats" %in% search()) 1152s + 1152s + cat("4. Detaching package\n") 1152s + detach("package:matrixStats") 1152s + stopifnot(!"package:matrixStats" %in% search()) 1152s + stopifnot("matrixStats" %in% loadedNamespaces()) 1152s + 1152s + cat("5. Unloading package\n") 1152s + unloadNamespace("matrixStats") 1152s + stopifnot(!"matrixStats" %in% loadedNamespaces()) 1152s + 1152s + cat("6. Attaching package (again)\n") 1152s + library("matrixStats") 1152s + stopifnot("package:matrixStats" %in% search()) 1152s + 1152s + cat("7. Detaching package (again)\n") 1152s + detach("package:matrixStats") 1152s + stopifnot(!"package:matrixStats" %in% search()) 1152s + stopifnot("matrixStats" %in% loadedNamespaces()) 1152s + } 1152s > 1152s > cat("7. DONE\n") 1152s 7. DONE 1152s > 1153s autopkgtest [19:29:51]: test run-unit-test: -----------------------] 1154s autopkgtest [19:29:52]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - 1154s run-unit-test PASS 1155s autopkgtest [19:29:53]: test pkg-r-autopkgtest: preparing testbed 1449s autopkgtest [19:34:47]: testbed dpkg architecture: arm64 1449s autopkgtest [19:34:47]: testbed apt version: 2.7.12 1449s autopkgtest [19:34:47]: @@@@@@@@@@@@@@@@@@@@ test bed setup 1452s Get:1 http://ftpmaster.internal/ubuntu noble-proposed InRelease [117 kB] 1453s Get:2 http://ftpmaster.internal/ubuntu noble-proposed/multiverse Sources [51.4 kB] 1454s Get:3 http://ftpmaster.internal/ubuntu noble-proposed/main Sources [474 kB] 1454s Get:4 http://ftpmaster.internal/ubuntu noble-proposed/restricted Sources [6540 B] 1455s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/universe Sources [3657 kB] 1457s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 Packages [646 kB] 1458s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 c-n-f Metadata [3144 B] 1458s Get:8 http://ftpmaster.internal/ubuntu noble-proposed/restricted arm64 Packages [33.6 kB] 1458s Get:9 http://ftpmaster.internal/ubuntu noble-proposed/restricted arm64 c-n-f Metadata [116 B] 1458s Get:10 http://ftpmaster.internal/ubuntu noble-proposed/universe arm64 Packages [4013 kB] 1459s Get:11 http://ftpmaster.internal/ubuntu noble-proposed/universe arm64 c-n-f Metadata [8528 B] 1459s Get:12 http://ftpmaster.internal/ubuntu noble-proposed/multiverse arm64 Packages [55.5 kB] 1459s Get:13 http://ftpmaster.internal/ubuntu noble-proposed/multiverse arm64 c-n-f Metadata [116 B] 1483s Fetched 9065 kB in 13s (688 kB/s) 1484s Reading package lists... 1499s Reading package lists... 1501s Building dependency tree... 1501s Reading state information... 1505s Calculating upgrade... 1508s The following packages will be REMOVED: 1508s libglib2.0-0 libssl3 1508s The following NEW packages will be installed: 1508s libglib2.0-0t64 libssl3t64 xdg-user-dirs 1508s The following packages have been kept back: 1508s curl 1508s The following packages will be upgraded: 1508s gir1.2-glib-2.0 libglib2.0-data libtirpc-common openssl readline-common 1509s 5 upgraded, 3 newly installed, 2 to remove and 1 not upgraded. 1509s Need to get 4592 kB of archives. 1509s After this operation, 211 kB of additional disk space will be used. 1509s Get:1 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 gir1.2-glib-2.0 arm64 2.79.3-3ubuntu5 [182 kB] 1509s Get:2 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libglib2.0-0t64 arm64 2.79.3-3ubuntu5 [1527 kB] 1510s Get:3 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 openssl arm64 3.0.13-0ubuntu1 [983 kB] 1510s Get:4 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libssl3t64 arm64 3.0.13-0ubuntu1 [1770 kB] 1510s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libglib2.0-data all 2.79.3-3ubuntu5 [46.6 kB] 1510s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libtirpc-common all 1.3.4+ds-1.1 [8018 B] 1510s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 readline-common all 8.2-3.1 [56.4 kB] 1510s Get:8 http://ftpmaster.internal/ubuntu noble/main arm64 xdg-user-dirs arm64 0.18-1 [18.1 kB] 1513s Fetched 4592 kB in 1s (3347 kB/s) 1515s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75850 files and directories currently installed.) 1515s Preparing to unpack .../gir1.2-glib-2.0_2.79.3-3ubuntu5_arm64.deb ... 1515s Unpacking gir1.2-glib-2.0:arm64 (2.79.3-3ubuntu5) over (2.79.2-1~ubuntu1) ... 1515s dpkg: libglib2.0-0:arm64: dependency problems, but removing anyway as you requested: 1515s udisks2 depends on libglib2.0-0 (>= 2.77.0). 1515s shared-mime-info depends on libglib2.0-0 (>= 2.75.3). 1515s python3-gi depends on libglib2.0-0 (>= 2.77.0). 1515s python3-dbus depends on libglib2.0-0 (>= 2.16.0). 1515s netplan.io depends on libglib2.0-0 (>= 2.70.0). 1515s netplan-generator depends on libglib2.0-0 (>= 2.70.0). 1515s libxmlb2:arm64 depends on libglib2.0-0 (>= 2.54.0). 1515s libvolume-key1:arm64 depends on libglib2.0-0 (>= 2.18.0). 1515s libudisks2-0:arm64 depends on libglib2.0-0 (>= 2.75.3). 1515s libqrtr-glib0:arm64 depends on libglib2.0-0 (>= 2.56). 1515s libqmi-proxy depends on libglib2.0-0 (>= 2.30.0). 1515s libqmi-glib5:arm64 depends on libglib2.0-0 (>= 2.54.0). 1515s libpolkit-gobject-1-0:arm64 depends on libglib2.0-0 (>= 2.38.0). 1515s libpolkit-agent-1-0:arm64 depends on libglib2.0-0 (>= 2.38.0). 1515s libnetplan0:arm64 depends on libglib2.0-0 (>= 2.75.3). 1515s libmm-glib0:arm64 depends on libglib2.0-0 (>= 2.62.0). 1515s libmbim-proxy depends on libglib2.0-0 (>= 2.56). 1515s libmbim-glib4:arm64 depends on libglib2.0-0 (>= 2.56). 1515s libjson-glib-1.0-0:arm64 depends on libglib2.0-0 (>= 2.75.3). 1515s libjcat1:arm64 depends on libglib2.0-0 (>= 2.75.3). 1515s libgusb2:arm64 depends on libglib2.0-0 (>= 2.75.3). 1515s libgudev-1.0-0:arm64 depends on libglib2.0-0 (>= 2.38.0). 1515s libgirepository-1.0-1:arm64 depends on libglib2.0-0 (>= 2.79.0). 1515s libfwupd2:arm64 depends on libglib2.0-0 (>= 2.79.0). 1515s libblockdev3:arm64 depends on libglib2.0-0 (>= 2.42.2). 1515s libblockdev-utils3:arm64 depends on libglib2.0-0 (>= 2.75.3). 1515s libblockdev-swap3:arm64 depends on libglib2.0-0 (>= 2.42.2). 1515s libblockdev-part3:arm64 depends on libglib2.0-0 (>= 2.42.2). 1515s libblockdev-nvme3:arm64 depends on libglib2.0-0 (>= 2.42.2). 1515s libblockdev-mdraid3:arm64 depends on libglib2.0-0 (>= 2.42.2). 1515s libblockdev-loop3:arm64 depends on libglib2.0-0 (>= 2.42.2). 1515s libblockdev-fs3:arm64 depends on libglib2.0-0 (>= 2.42.2). 1515s libblockdev-crypto3:arm64 depends on libglib2.0-0 (>= 2.42.2). 1515s fwupd depends on libglib2.0-0 (>= 2.79.0). 1515s bolt depends on libglib2.0-0 (>= 2.56.0). 1515s 1516s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75850 files and directories currently installed.) 1516s Removing libglib2.0-0:arm64 (2.79.2-1~ubuntu1) ... 1517s Selecting previously unselected package libglib2.0-0t64:arm64. 1517s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75825 files and directories currently installed.) 1517s Preparing to unpack .../libglib2.0-0t64_2.79.3-3ubuntu5_arm64.deb ... 1517s libglib2.0-0t64.preinst: Removing /var/lib/dpkg/info/libglib2.0-0:arm64.postrm to avoid loss of /usr/share/glib-2.0/schemas/gschemas.compiled... 1517s removed '/var/lib/dpkg/info/libglib2.0-0:arm64.postrm' 1517s Unpacking libglib2.0-0t64:arm64 (2.79.3-3ubuntu5) ... 1518s Preparing to unpack .../openssl_3.0.13-0ubuntu1_arm64.deb ... 1518s Unpacking openssl (3.0.13-0ubuntu1) over (3.0.10-1ubuntu4) ... 1519s dpkg: libssl3:arm64: dependency problems, but removing anyway as you requested: 1519s wget depends on libssl3 (>= 3.0.0). 1519s u-boot-tools depends on libssl3 (>= 3.0.0). 1519s tnftp depends on libssl3 (>= 3.0.0). 1519s tcpdump depends on libssl3 (>= 3.0.0). 1519s systemd-resolved depends on libssl3 (>= 3.0.0). 1519s systemd depends on libssl3 (>= 3.0.0). 1519s sudo depends on libssl3 (>= 3.0.0). 1519s sbsigntool depends on libssl3 (>= 3.0.0). 1519s rsync depends on libssl3 (>= 3.0.0). 1519s python3-cryptography depends on libssl3 (>= 3.0.0). 1519s openssh-server depends on libssl3 (>= 3.0.10). 1519s openssh-client depends on libssl3 (>= 3.0.10). 1519s mtd-utils depends on libssl3 (>= 3.0.0). 1519s mokutil depends on libssl3 (>= 3.0.0). 1519s linux-headers-6.8.0-11-generic depends on libssl3 (>= 3.0.0). 1519s libsystemd-shared:arm64 depends on libssl3 (>= 3.0.0). 1519s libssh-4:arm64 depends on libssl3 (>= 3.0.0). 1519s libsasl2-modules:arm64 depends on libssl3 (>= 3.0.0). 1519s libsasl2-2:arm64 depends on libssl3 (>= 3.0.0). 1519s libpython3.12-minimal:arm64 depends on libssl3 (>= 3.0.0). 1519s libpython3.11-minimal:arm64 depends on libssl3 (>= 3.0.0). 1519s libnvme1 depends on libssl3 (>= 3.0.0). 1519s libkrb5-3:arm64 depends on libssl3 (>= 3.0.0). 1519s libkmod2:arm64 depends on libssl3 (>= 3.0.0). 1519s libfido2-1:arm64 depends on libssl3 (>= 3.0.0). 1519s libcurl4:arm64 depends on libssl3 (>= 3.0.0). 1519s libcryptsetup12:arm64 depends on libssl3 (>= 3.0.0). 1519s kmod depends on libssl3 (>= 3.0.0). 1519s dhcpcd-base depends on libssl3 (>= 3.0.0). 1519s bind9-libs:arm64 depends on libssl3 (>= 3.0.0). 1519s 1520s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75850 files and directories currently installed.) 1520s Removing libssl3:arm64 (3.0.10-1ubuntu4) ... 1520s Selecting previously unselected package libssl3t64:arm64. 1520s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75839 files and directories currently installed.) 1520s Preparing to unpack .../libssl3t64_3.0.13-0ubuntu1_arm64.deb ... 1520s Unpacking libssl3t64:arm64 (3.0.13-0ubuntu1) ... 1521s Preparing to unpack .../libglib2.0-data_2.79.3-3ubuntu5_all.deb ... 1521s Unpacking libglib2.0-data (2.79.3-3ubuntu5) over (2.79.2-1~ubuntu1) ... 1521s Preparing to unpack .../libtirpc-common_1.3.4+ds-1.1_all.deb ... 1521s Unpacking libtirpc-common (1.3.4+ds-1.1) over (1.3.4+ds-1build1) ... 1521s Preparing to unpack .../readline-common_8.2-3.1_all.deb ... 1521s Unpacking readline-common (8.2-3.1) over (8.2-3) ... 1521s Selecting previously unselected package xdg-user-dirs. 1521s Preparing to unpack .../xdg-user-dirs_0.18-1_arm64.deb ... 1521s Unpacking xdg-user-dirs (0.18-1) ... 1522s Setting up xdg-user-dirs (0.18-1) ... 1522s Setting up libssl3t64:arm64 (3.0.13-0ubuntu1) ... 1522s Setting up libtirpc-common (1.3.4+ds-1.1) ... 1522s Setting up libglib2.0-0t64:arm64 (2.79.3-3ubuntu5) ... 1522s No schema files found: doing nothing. 1522s Setting up libglib2.0-data (2.79.3-3ubuntu5) ... 1522s Setting up gir1.2-glib-2.0:arm64 (2.79.3-3ubuntu5) ... 1522s Setting up openssl (3.0.13-0ubuntu1) ... 1522s Setting up readline-common (8.2-3.1) ... 1522s Processing triggers for man-db (2.12.0-3) ... 1526s Processing triggers for install-info (7.1-3) ... 1527s Processing triggers for libc-bin (2.39-0ubuntu2) ... 1529s Reading package lists... 1531s Building dependency tree... 1531s Reading state information... 1534s 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 1535s Hit:1 http://ftpmaster.internal/ubuntu noble-proposed InRelease 1535s Hit:2 http://ftpmaster.internal/ubuntu noble InRelease 1535s Hit:3 http://ftpmaster.internal/ubuntu noble-updates InRelease 1535s Hit:4 http://ftpmaster.internal/ubuntu noble-security InRelease 1548s Reading package lists... 1548s Reading package lists... 1550s Building dependency tree... 1550s Reading state information... 1554s Calculating upgrade... 1556s The following packages have been kept back: 1556s curl 1556s 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 1556s Reading package lists... 1558s Building dependency tree... 1558s Reading state information... 1563s 0 upgraded, 0 newly installed, 0 to remove and 1 not upgraded. 1574s Reading package lists... 1578s Building dependency tree... 1578s Reading state information... 1580s Starting pkgProblemResolver with broken count: 0 1581s Starting 2 pkgProblemResolver with broken count: 0 1581s Done 1585s The following additional packages will be installed: 1585s build-essential cpp cpp-13 cpp-13-aarch64-linux-gnu cpp-aarch64-linux-gnu 1585s curl dctrl-tools fontconfig fontconfig-config fonts-dejavu-core 1585s fonts-dejavu-mono fonts-glyphicons-halflings fonts-mathjax g++ g++-13 1585s g++-13-aarch64-linux-gnu g++-aarch64-linux-gnu gcc gcc-13 1585s gcc-13-aarch64-linux-gnu gcc-aarch64-linux-gnu gfortran gfortran-13 1585s gfortran-13-aarch64-linux-gnu gfortran-aarch64-linux-gnu icu-devtools 1585s libasan8 libatomic1 libblas-dev libblas3 libbz2-dev libc-dev-bin libc6-dev 1585s libcairo2 libcc1-0 libcrypt-dev libcurl4t64 libdatrie1 libdeflate0 1585s libfontconfig1 libgcc-13-dev libgfortran-13-dev libgfortran5 libgomp1 1585s libgraphite2-3 libharfbuzz0b libhwasan0 libice6 libicu-dev libisl23 libitm1 1585s libjbig0 libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev 1585s libjs-bootstrap libjs-highlight.js libjs-jquery libjs-jquery-datatables 1585s libjs-mathjax liblapack-dev liblapack3 liblerc4 liblsan0 liblzma-dev libmpc3 1585s libncurses-dev libnsl-dev libpango-1.0-0 libpangocairo-1.0-0 1585s libpangoft2-1.0-0 libpaper-utils libpaper1 libpcre2-16-0 libpcre2-32-0 1585s libpcre2-dev libpcre2-posix3 libpixman-1-0 libpkgconf3 libpng-dev 1585s libpng16-16t64 libpsl5t64 libreadline-dev libreadline8t64 libsharpyuv0 1585s libsm6 libstdc++-13-dev libtcl8.6 libthai-data libthai0 libtiff6 1585s libtirpc-dev libtirpc3t64 libtk8.6 libtsan2 libubsan1 libwebp7 1585s libxcb-render0 libxcb-shm0 libxft2 libxrender1 libxss1 libxt6t64 1585s linux-libc-dev node-normalize.css pkg-config pkg-r-autopkgtest pkgconf 1585s pkgconf-bin r-base-core r-base-dev r-cran-base64enc r-cran-cli 1585s r-cran-colorspace r-cran-commonmark r-cran-evaluate r-cran-fansi 1585s r-cran-farver r-cran-ggplot2 r-cran-glue r-cran-gtable r-cran-highr 1585s r-cran-isoband r-cran-knitr r-cran-labeling r-cran-lattice r-cran-lifecycle 1585s r-cran-magrittr r-cran-markdown r-cran-mass r-cran-matrix r-cran-matrixstats 1585s r-cran-mgcv r-cran-munsell r-cran-nlme r-cran-pillar r-cran-pkgconfig 1585s r-cran-r6 r-cran-rcolorbrewer r-cran-rlang r-cran-scales r-cran-tibble 1585s r-cran-utf8 r-cran-vctrs r-cran-viridislite r-cran-withr r-cran-xfun 1585s r-cran-yaml rpcsvc-proto unzip x11-common xdg-utils zip zlib1g-dev 1585s Suggested packages: 1585s cpp-doc gcc-13-locales cpp-13-doc debtags gcc-13-doc gcc-multilib 1585s manpages-dev autoconf automake libtool flex bison gdb gcc-doc 1585s gdb-aarch64-linux-gnu gfortran-doc gfortran-13-doc libcoarrays-dev 1585s liblapack-doc glibc-doc icu-doc fonts-mathjax-extras fonts-stix 1585s libjs-mathjax-doc liblzma-doc ncurses-doc readline-doc libstdc++-13-doc 1585s tcl8.6 tk8.6 libjs-html5shiv elpa-ess r-doc-info | r-doc-pdf r-mathlib 1585s r-base-html texlive-base texlive-latex-base texlive-plain-generic 1585s texlive-fonts-recommended texlive-fonts-extra texlive-extra-utils 1585s texlive-latex-recommended texlive-latex-extra texinfo r-cran-kernsmooth 1585s r-cran-kernlab r-cran-mvtnorm r-cran-vcd r-cran-shiny r-cran-shinyjs 1585s r-cran-dplyr r-cran-png r-cran-jpeg r-cran-rmarkdown r-cran-viridis 1585s r-cran-covr r-cran-magick r-cran-sf r-cran-bit64 r-cran-dbi 1585s r-cran-formattable r-cran-nanotime r-cran-palmerpenguins r-cran-stringi 1585s r-cran-survival r-cran-units r-cran-vdiffr r-cran-testthat r-cran-bench 1585s r-cran-blob r-cran-brio r-cran-callr r-cran-crayon r-cran-here r-cran-hms 1585s r-cran-htmltools r-cran-pkgbuild r-cran-pkgload r-cran-purrr r-cran-tidyr 1585s Recommended packages: 1585s bzip2-doc manpages manpages-dev libc-devtools javascript-common libpng-tools 1585s r-recommended r-doc-html r-cran-callr r-cran-covr r-cran-crayon 1585s r-cran-digest r-cran-htmltools r-cran-htmlwidgets r-cran-mockery 1585s r-cran-processx r-cran-ps r-cran-rmarkdown r-cran-rprojroot 1585s r-cran-rstudioapi r-cran-testthat r-cran-whoami r-cran-curl r-cran-xml2 1585s r-cran-unitizer r-cran-dplyr r-cran-hexbin r-cran-hmisc r-cran-mapproj 1585s r-cran-maps r-cran-multcomp r-cran-profvis r-cran-quantreg r-cran-ragg 1585s r-cran-rpart r-cran-sf r-cran-svglite r-cran-vdiffr r-cran-dbi 1585s r-cran-rsqlite r-cran-waldo r-cran-testit r-cran-bslib r-cran-codetools 1585s r-cran-formatr r-cran-gridsvg r-cran-jpeg r-cran-magick r-cran-png 1585s r-cran-reticulate r-cran-rgl r-cran-sass r-cran-tikzdevice r-cran-tinytex 1585s r-cran-webshot node-highlight.js r-cran-lintr r-cran-tidyverse r-cran-rcurl 1585s r-cran-r.devices r-cran-r.rsp r-cran-lubridate r-cran-fs r-cran-usethis 1585s r-cran-bit64 r-cran-dichromat r-cran-hms r-cran-stringi r-cran-data.table 1585s r-cran-mockr r-cran-formattable r-cran-generics r-cran-pkgdown 1585s r-cran-zeallot r-cran-mime r-cran-remotes r-cran-renv r-cran-jsonlite 1585s r-cran-runit libfile-mimeinfo-perl libnet-dbus-perl libx11-protocol-perl 1585s x11-utils x11-xserver-utils 1586s The following packages will be REMOVED: 1586s libcurl4 libpng16-16 libpsl5 libreadline8 libtirpc3 1586s The following NEW packages will be installed: 1586s autopkgtest-satdep build-essential cpp cpp-13 cpp-13-aarch64-linux-gnu 1586s cpp-aarch64-linux-gnu dctrl-tools fontconfig fontconfig-config 1586s fonts-dejavu-core fonts-dejavu-mono fonts-glyphicons-halflings fonts-mathjax 1586s g++ g++-13 g++-13-aarch64-linux-gnu g++-aarch64-linux-gnu gcc gcc-13 1586s gcc-13-aarch64-linux-gnu gcc-aarch64-linux-gnu gfortran gfortran-13 1586s gfortran-13-aarch64-linux-gnu gfortran-aarch64-linux-gnu icu-devtools 1586s libasan8 libatomic1 libblas-dev libblas3 libbz2-dev libc-dev-bin libc6-dev 1586s libcairo2 libcc1-0 libcrypt-dev libcurl4t64 libdatrie1 libdeflate0 1586s libfontconfig1 libgcc-13-dev libgfortran-13-dev libgfortran5 libgomp1 1586s libgraphite2-3 libharfbuzz0b libhwasan0 libice6 libicu-dev libisl23 libitm1 1586s libjbig0 libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev 1586s libjs-bootstrap libjs-highlight.js libjs-jquery libjs-jquery-datatables 1586s libjs-mathjax liblapack-dev liblapack3 liblerc4 liblsan0 liblzma-dev libmpc3 1586s libncurses-dev libnsl-dev libpango-1.0-0 libpangocairo-1.0-0 1586s libpangoft2-1.0-0 libpaper-utils libpaper1 libpcre2-16-0 libpcre2-32-0 1586s libpcre2-dev libpcre2-posix3 libpixman-1-0 libpkgconf3 libpng-dev 1586s libpng16-16t64 libpsl5t64 libreadline-dev libreadline8t64 libsharpyuv0 1586s libsm6 libstdc++-13-dev libtcl8.6 libthai-data libthai0 libtiff6 1586s libtirpc-dev libtirpc3t64 libtk8.6 libtsan2 libubsan1 libwebp7 1586s libxcb-render0 libxcb-shm0 libxft2 libxrender1 libxss1 libxt6t64 1586s linux-libc-dev node-normalize.css pkg-config pkg-r-autopkgtest pkgconf 1586s pkgconf-bin r-base-core r-base-dev r-cran-base64enc r-cran-cli 1586s r-cran-colorspace r-cran-commonmark r-cran-evaluate r-cran-fansi 1586s r-cran-farver r-cran-ggplot2 r-cran-glue r-cran-gtable r-cran-highr 1586s r-cran-isoband r-cran-knitr r-cran-labeling r-cran-lattice r-cran-lifecycle 1586s r-cran-magrittr r-cran-markdown r-cran-mass r-cran-matrix r-cran-matrixstats 1586s r-cran-mgcv r-cran-munsell r-cran-nlme r-cran-pillar r-cran-pkgconfig 1586s r-cran-r6 r-cran-rcolorbrewer r-cran-rlang r-cran-scales r-cran-tibble 1586s r-cran-utf8 r-cran-vctrs r-cran-viridislite r-cran-withr r-cran-xfun 1586s r-cran-yaml rpcsvc-proto unzip x11-common xdg-utils zip zlib1g-dev 1586s The following packages will be upgraded: 1586s curl 1586s 1 upgraded, 156 newly installed, 5 to remove and 0 not upgraded. 1586s Need to get 170 MB/170 MB of archives. 1586s After this operation, 520 MB of additional disk space will be used. 1586s Get:1 /tmp/autopkgtest.LWEqT8/2-autopkgtest-satdep.deb autopkgtest-satdep arm64 0 [756 B] 1586s Get:2 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libpsl5t64 arm64 0.21.2-1.1 [57.4 kB] 1586s Get:3 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 curl arm64 8.5.0-2ubuntu7 [222 kB] 1587s Get:4 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libcurl4t64 arm64 8.5.0-2ubuntu7 [332 kB] 1587s Get:5 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libpng16-16t64 arm64 1.6.43-3 [185 kB] 1587s Get:6 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libreadline8t64 arm64 8.2-3.1 [153 kB] 1587s Get:7 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libtirpc3t64 arm64 1.3.4+ds-1.1 [83.5 kB] 1587s Get:8 http://ftpmaster.internal/ubuntu noble/main arm64 libc-dev-bin arm64 2.39-0ubuntu2 [19.7 kB] 1587s Get:9 http://ftpmaster.internal/ubuntu noble/main arm64 linux-libc-dev arm64 6.8.0-11.11 [1569 kB] 1587s Get:10 http://ftpmaster.internal/ubuntu noble/main arm64 libcrypt-dev arm64 1:4.4.36-4 [136 kB] 1587s Get:11 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libtirpc-dev arm64 1.3.4+ds-1.1 [201 kB] 1587s Get:12 http://ftpmaster.internal/ubuntu noble/main arm64 libnsl-dev arm64 1.3.0-3 [71.9 kB] 1587s Get:13 http://ftpmaster.internal/ubuntu noble/main arm64 rpcsvc-proto arm64 1.4.2-0ubuntu6 [65.4 kB] 1587s Get:14 http://ftpmaster.internal/ubuntu noble/main arm64 libc6-dev arm64 2.39-0ubuntu2 [1596 kB] 1587s Get:15 http://ftpmaster.internal/ubuntu noble/main arm64 libisl23 arm64 0.26-3 [713 kB] 1587s Get:16 http://ftpmaster.internal/ubuntu noble/main arm64 libmpc3 arm64 1.3.1-1 [55.3 kB] 1587s Get:17 http://ftpmaster.internal/ubuntu noble/main arm64 cpp-13-aarch64-linux-gnu arm64 13.2.0-17ubuntu2 [10.3 MB] 1588s Get:18 http://ftpmaster.internal/ubuntu noble/main arm64 cpp-13 arm64 13.2.0-17ubuntu2 [1028 B] 1588s Get:19 http://ftpmaster.internal/ubuntu noble/main arm64 cpp-aarch64-linux-gnu arm64 4:13.2.0-7ubuntu1 [5316 B] 1588s Get:20 http://ftpmaster.internal/ubuntu noble/main arm64 cpp arm64 4:13.2.0-7ubuntu1 [22.4 kB] 1588s Get:21 http://ftpmaster.internal/ubuntu noble/main arm64 libcc1-0 arm64 14-20240303-1ubuntu1 [44.7 kB] 1589s Get:22 http://ftpmaster.internal/ubuntu noble/main arm64 libgomp1 arm64 14-20240303-1ubuntu1 [144 kB] 1589s Get:23 http://ftpmaster.internal/ubuntu noble/main arm64 libitm1 arm64 14-20240303-1ubuntu1 [27.7 kB] 1589s Get:24 http://ftpmaster.internal/ubuntu noble/main arm64 libatomic1 arm64 14-20240303-1ubuntu1 [11.4 kB] 1589s Get:25 http://ftpmaster.internal/ubuntu noble/main arm64 libasan8 arm64 14-20240303-1ubuntu1 [2919 kB] 1589s Get:26 http://ftpmaster.internal/ubuntu noble/main arm64 liblsan0 arm64 14-20240303-1ubuntu1 [1282 kB] 1589s Get:27 http://ftpmaster.internal/ubuntu noble/main arm64 libtsan2 arm64 14-20240303-1ubuntu1 [2687 kB] 1589s Get:28 http://ftpmaster.internal/ubuntu noble/main arm64 libubsan1 arm64 14-20240303-1ubuntu1 [1151 kB] 1589s Get:29 http://ftpmaster.internal/ubuntu noble/main arm64 libhwasan0 arm64 14-20240303-1ubuntu1 [1597 kB] 1590s Get:30 http://ftpmaster.internal/ubuntu noble/main arm64 libgcc-13-dev arm64 13.2.0-17ubuntu2 [2464 kB] 1590s Get:31 http://ftpmaster.internal/ubuntu noble/main arm64 gcc-13-aarch64-linux-gnu arm64 13.2.0-17ubuntu2 [20.1 MB] 1591s Get:32 http://ftpmaster.internal/ubuntu noble/main arm64 gcc-13 arm64 13.2.0-17ubuntu2 [467 kB] 1591s Get:33 http://ftpmaster.internal/ubuntu noble/main arm64 gcc-aarch64-linux-gnu arm64 4:13.2.0-7ubuntu1 [1198 B] 1591s Get:34 http://ftpmaster.internal/ubuntu noble/main arm64 gcc arm64 4:13.2.0-7ubuntu1 [5018 B] 1591s Get:35 http://ftpmaster.internal/ubuntu noble/main arm64 libstdc++-13-dev arm64 13.2.0-17ubuntu2 [2322 kB] 1591s Get:36 http://ftpmaster.internal/ubuntu noble/main arm64 g++-13-aarch64-linux-gnu arm64 13.2.0-17ubuntu2 [11.7 MB] 1592s Get:37 http://ftpmaster.internal/ubuntu noble/main arm64 g++-13 arm64 13.2.0-17ubuntu2 [14.4 kB] 1592s Get:38 http://ftpmaster.internal/ubuntu noble/main arm64 g++-aarch64-linux-gnu arm64 4:13.2.0-7ubuntu1 [962 B] 1592s Get:39 http://ftpmaster.internal/ubuntu noble/main arm64 g++ arm64 4:13.2.0-7ubuntu1 [1082 B] 1593s Get:40 http://ftpmaster.internal/ubuntu noble/main arm64 build-essential arm64 12.10ubuntu1 [4932 B] 1593s Get:41 http://ftpmaster.internal/ubuntu noble/main arm64 dctrl-tools arm64 2.24-3build2 [65.2 kB] 1593s Get:42 http://ftpmaster.internal/ubuntu noble/main arm64 fonts-dejavu-mono all 2.37-8 [502 kB] 1593s Get:43 http://ftpmaster.internal/ubuntu noble/main arm64 fonts-dejavu-core all 2.37-8 [835 kB] 1593s Get:44 http://ftpmaster.internal/ubuntu noble/main arm64 fontconfig-config arm64 2.15.0-1ubuntu1 [37.0 kB] 1593s Get:45 http://ftpmaster.internal/ubuntu noble/main arm64 libfontconfig1 arm64 2.15.0-1ubuntu1 [142 kB] 1593s Get:46 http://ftpmaster.internal/ubuntu noble/main arm64 fontconfig arm64 2.15.0-1ubuntu1 [190 kB] 1593s Get:47 http://ftpmaster.internal/ubuntu noble/universe arm64 fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-3 [118 kB] 1593s Get:48 http://ftpmaster.internal/ubuntu noble/main arm64 fonts-mathjax all 2.7.9+dfsg-1 [2208 kB] 1593s Get:49 http://ftpmaster.internal/ubuntu noble/main arm64 libgfortran5 arm64 14-20240303-1ubuntu1 [444 kB] 1593s Get:50 http://ftpmaster.internal/ubuntu noble/main arm64 libgfortran-13-dev arm64 13.2.0-17ubuntu2 [478 kB] 1593s Get:51 http://ftpmaster.internal/ubuntu noble/main arm64 gfortran-13-aarch64-linux-gnu arm64 13.2.0-17ubuntu2 [10.8 MB] 1595s Get:52 http://ftpmaster.internal/ubuntu noble/main arm64 gfortran-13 arm64 13.2.0-17ubuntu2 [10.3 kB] 1595s Get:53 http://ftpmaster.internal/ubuntu noble/main arm64 gfortran-aarch64-linux-gnu arm64 4:13.2.0-7ubuntu1 [1022 B] 1595s Get:54 http://ftpmaster.internal/ubuntu noble/main arm64 gfortran arm64 4:13.2.0-7ubuntu1 [1164 B] 1595s Get:55 http://ftpmaster.internal/ubuntu noble/main arm64 icu-devtools arm64 74.2-1ubuntu1 [209 kB] 1595s Get:56 http://ftpmaster.internal/ubuntu noble/main arm64 libblas3 arm64 3.12.0-3 [143 kB] 1595s Get:57 http://ftpmaster.internal/ubuntu noble/main arm64 libblas-dev arm64 3.12.0-3 [111 kB] 1595s Get:58 http://ftpmaster.internal/ubuntu noble/main arm64 libbz2-dev arm64 1.0.8-5ubuntu1 [35.8 kB] 1595s Get:59 http://ftpmaster.internal/ubuntu noble/main arm64 libpixman-1-0 arm64 0.42.2-1 [193 kB] 1595s Get:60 http://ftpmaster.internal/ubuntu noble/main arm64 libxcb-render0 arm64 1.15-1 [16.1 kB] 1595s Get:61 http://ftpmaster.internal/ubuntu noble/main arm64 libxcb-shm0 arm64 1.15-1 [5780 B] 1595s Get:62 http://ftpmaster.internal/ubuntu noble/main arm64 libxrender1 arm64 1:0.9.10-1.1 [19.1 kB] 1595s Get:63 http://ftpmaster.internal/ubuntu noble/main arm64 libcairo2 arm64 1.18.0-1 [550 kB] 1595s Get:64 http://ftpmaster.internal/ubuntu noble/main arm64 libdatrie1 arm64 0.2.13-3 [21.7 kB] 1595s Get:65 http://ftpmaster.internal/ubuntu noble/main arm64 libdeflate0 arm64 1.19-1 [43.4 kB] 1595s Get:66 http://ftpmaster.internal/ubuntu noble/main arm64 libgraphite2-3 arm64 1.3.14-2 [81.5 kB] 1595s Get:67 http://ftpmaster.internal/ubuntu noble/main arm64 libharfbuzz0b arm64 8.3.0-2 [463 kB] 1595s Get:68 http://ftpmaster.internal/ubuntu noble/main arm64 x11-common all 1:7.7+23ubuntu2 [23.4 kB] 1595s Get:69 http://ftpmaster.internal/ubuntu noble/main arm64 libice6 arm64 2:1.0.10-1build2 [41.7 kB] 1595s Get:70 http://ftpmaster.internal/ubuntu noble/main arm64 libicu-dev arm64 74.2-1ubuntu1 [11.9 MB] 1597s Get:71 http://ftpmaster.internal/ubuntu noble/main arm64 libjpeg-turbo8 arm64 2.1.5-2ubuntu1 [160 kB] 1597s Get:72 http://ftpmaster.internal/ubuntu noble/main arm64 libjpeg-turbo8-dev arm64 2.1.5-2ubuntu1 [304 kB] 1597s Get:73 http://ftpmaster.internal/ubuntu noble/main arm64 libjpeg8 arm64 8c-2ubuntu11 [2148 B] 1597s Get:74 http://ftpmaster.internal/ubuntu noble/main arm64 libjpeg8-dev arm64 8c-2ubuntu11 [1484 B] 1597s Get:75 http://ftpmaster.internal/ubuntu noble/main arm64 libjpeg-dev arm64 8c-2ubuntu11 [1482 B] 1597s Get:76 http://ftpmaster.internal/ubuntu noble/universe arm64 libjs-bootstrap all 3.4.1+dfsg-3 [129 kB] 1597s Get:77 http://ftpmaster.internal/ubuntu noble/universe arm64 libjs-highlight.js all 9.18.5+dfsg1-2 [385 kB] 1597s Get:78 http://ftpmaster.internal/ubuntu noble/main arm64 libjs-jquery all 3.6.1+dfsg+~3.5.14-1 [328 kB] 1597s Get:79 http://ftpmaster.internal/ubuntu noble/universe arm64 libjs-jquery-datatables all 1.11.5+dfsg-2 [146 kB] 1597s Get:80 http://ftpmaster.internal/ubuntu noble/main arm64 liblapack3 arm64 3.12.0-3 [2241 kB] 1598s Get:81 http://ftpmaster.internal/ubuntu noble/main arm64 liblapack-dev arm64 3.12.0-3 [4293 kB] 1598s Get:82 http://ftpmaster.internal/ubuntu noble/main arm64 liblerc4 arm64 4.0.0+ds-4ubuntu1 [153 kB] 1598s Get:83 http://ftpmaster.internal/ubuntu noble/main arm64 libncurses-dev arm64 6.4+20240113-1ubuntu1 [385 kB] 1598s Get:84 http://ftpmaster.internal/ubuntu noble/main arm64 libthai-data all 0.1.29-2 [158 kB] 1598s Get:85 http://ftpmaster.internal/ubuntu noble/main arm64 libthai0 arm64 0.1.29-2 [18.1 kB] 1598s Get:86 http://ftpmaster.internal/ubuntu noble/main arm64 libpango-1.0-0 arm64 1.51.0+ds-4 [226 kB] 1598s Get:87 http://ftpmaster.internal/ubuntu noble/main arm64 libpangoft2-1.0-0 arm64 1.51.0+ds-4 [41.2 kB] 1599s Get:88 http://ftpmaster.internal/ubuntu noble/main arm64 libpangocairo-1.0-0 arm64 1.51.0+ds-4 [27.6 kB] 1599s Get:89 http://ftpmaster.internal/ubuntu noble/main arm64 libpaper1 arm64 1.1.29 [13.1 kB] 1599s Get:90 http://ftpmaster.internal/ubuntu noble/main arm64 libpaper-utils arm64 1.1.29 [8480 B] 1599s Get:91 http://ftpmaster.internal/ubuntu noble/main arm64 libpcre2-16-0 arm64 10.42-4ubuntu1 [195 kB] 1599s Get:92 http://ftpmaster.internal/ubuntu noble/main arm64 libpcre2-32-0 arm64 10.42-4ubuntu1 [183 kB] 1599s Get:93 http://ftpmaster.internal/ubuntu noble/main arm64 libpcre2-posix3 arm64 10.42-4ubuntu1 [6654 B] 1599s Get:94 http://ftpmaster.internal/ubuntu noble/main arm64 libpcre2-dev arm64 10.42-4ubuntu1 [679 kB] 1599s Get:95 http://ftpmaster.internal/ubuntu noble/main arm64 libpkgconf3 arm64 1.8.1-2 [31.2 kB] 1599s Get:96 http://ftpmaster.internal/ubuntu noble/main arm64 zlib1g-dev arm64 1:1.3.dfsg-3ubuntu1 [895 kB] 1599s Get:97 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libpng-dev arm64 1.6.43-3 [267 kB] 1599s Get:98 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libreadline-dev arm64 8.2-3.1 [177 kB] 1599s Get:99 http://ftpmaster.internal/ubuntu noble/main arm64 libsharpyuv0 arm64 1.3.2-0.4 [14.4 kB] 1599s Get:100 http://ftpmaster.internal/ubuntu noble/main arm64 libsm6 arm64 2:1.2.3-1build2 [16.1 kB] 1599s Get:101 http://ftpmaster.internal/ubuntu noble/main arm64 libtcl8.6 arm64 8.6.13+dfsg-2 [980 kB] 1599s Get:102 http://ftpmaster.internal/ubuntu noble/main arm64 libjbig0 arm64 2.1-6.1ubuntu1 [28.9 kB] 1599s Get:103 http://ftpmaster.internal/ubuntu noble/main arm64 libwebp7 arm64 1.3.2-0.4 [191 kB] 1600s Get:104 http://ftpmaster.internal/ubuntu noble/main arm64 libtiff6 arm64 4.5.1+git230720-3ubuntu1 [226 kB] 1600s Get:105 http://ftpmaster.internal/ubuntu noble/main arm64 libxft2 arm64 2.3.6-1 [43.3 kB] 1600s Get:106 http://ftpmaster.internal/ubuntu noble/main arm64 libxss1 arm64 1:1.2.3-1build2 [8252 B] 1600s Get:107 http://ftpmaster.internal/ubuntu noble/main arm64 libtk8.6 arm64 8.6.13-2 [760 kB] 1600s Get:108 http://ftpmaster.internal/ubuntu noble-proposed/main arm64 libxt6t64 arm64 1:1.2.1-1.2 [168 kB] 1600s Get:109 http://ftpmaster.internal/ubuntu noble/universe arm64 node-normalize.css all 8.0.1-5 [10.8 kB] 1600s Get:110 http://ftpmaster.internal/ubuntu noble/main arm64 pkgconf-bin arm64 1.8.1-2 [20.4 kB] 1600s Get:111 http://ftpmaster.internal/ubuntu noble/main arm64 pkgconf arm64 1.8.1-2 [16.7 kB] 1600s Get:112 http://ftpmaster.internal/ubuntu noble/main arm64 pkg-config arm64 1.8.1-2 [7170 B] 1600s Get:113 http://ftpmaster.internal/ubuntu noble/main arm64 zip arm64 3.0-13 [172 kB] 1600s Get:114 http://ftpmaster.internal/ubuntu noble/main arm64 unzip arm64 6.0-28ubuntu3 [171 kB] 1600s Get:115 http://ftpmaster.internal/ubuntu noble/main arm64 xdg-utils all 1.1.3-4.1ubuntu3 [62.0 kB] 1600s Get:116 http://ftpmaster.internal/ubuntu noble-proposed/universe arm64 r-base-core arm64 4.3.3-2build1 [26.8 MB] 1603s Get:117 http://ftpmaster.internal/ubuntu noble/main arm64 liblzma-dev arm64 5.4.5-0.3 [209 kB] 1603s Get:118 http://ftpmaster.internal/ubuntu noble-proposed/universe arm64 r-base-dev all 4.3.3-2build1 [4334 B] 1603s Get:119 http://ftpmaster.internal/ubuntu noble/universe arm64 pkg-r-autopkgtest all 20231212ubuntu1 [6448 B] 1603s Get:120 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-base64enc arm64 0.1-3-3 [27.4 kB] 1603s Get:121 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-cli arm64 3.6.2-1 [1377 kB] 1603s Get:122 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-colorspace arm64 2.1-0+dfsg-1 [1540 kB] 1603s Get:123 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-commonmark arm64 1.9.1-1 [127 kB] 1603s Get:124 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-evaluate all 0.23-1 [90.2 kB] 1603s Get:125 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-fansi arm64 1.0.5-1 [616 kB] 1603s Get:126 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-farver arm64 2.1.1-1 [1336 kB] 1603s Get:127 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-glue arm64 1.7.0-1 [154 kB] 1603s Get:128 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-rlang arm64 1.1.3-1 [1663 kB] 1603s Get:129 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-lifecycle all 1.0.4+dfsg-1 [110 kB] 1603s Get:130 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-gtable all 0.3.4+dfsg-1 [191 kB] 1603s Get:131 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-isoband arm64 0.2.7-1 [1481 kB] 1603s Get:132 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-mass arm64 7.3-60.0.1-1 [1119 kB] 1604s Get:133 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-lattice arm64 0.22-5-1 [1342 kB] 1604s Get:134 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-nlme arm64 3.1.164-1 [2259 kB] 1604s Get:135 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-matrix arm64 1.6-5-1 [3776 kB] 1604s Get:136 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-mgcv arm64 1.9-1-1 [3248 kB] 1605s Get:137 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-labeling all 0.4.3-1 [62.1 kB] 1605s Get:138 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-munsell all 0.5.0-2build1 [208 kB] 1605s Get:139 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-r6 all 2.5.1-1 [99.0 kB] 1605s Get:140 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-rcolorbrewer all 1.1-3-1build1 [55.4 kB] 1605s Get:141 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-viridislite all 0.4.2-2 [1088 kB] 1605s Get:142 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-scales all 1.3.0-1 [603 kB] 1605s Get:143 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-magrittr arm64 2.0.3-1 [154 kB] 1605s Get:144 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-utf8 arm64 1.2.4-1 [140 kB] 1605s Get:145 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-vctrs arm64 0.6.5-1 [1327 kB] 1605s Get:146 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-pillar all 1.9.0+dfsg-1 [464 kB] 1605s Get:147 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-pkgconfig all 2.0.3-2build1 [19.7 kB] 1605s Get:148 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-tibble arm64 3.2.1+dfsg-2 [415 kB] 1605s Get:149 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-withr all 2.5.0-1 [225 kB] 1605s Get:150 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-ggplot2 all 3.4.4+dfsg-1 [3411 kB] 1606s Get:151 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-xfun arm64 0.41+dfsg-1 [415 kB] 1606s Get:152 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-highr all 0.10+dfsg-1 [38.3 kB] 1606s Get:153 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-yaml arm64 2.3.8-1 [107 kB] 1606s Get:154 http://ftpmaster.internal/ubuntu noble/main arm64 libjs-mathjax all 2.7.9+dfsg-1 [5665 kB] 1607s Get:155 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-knitr all 1.45+dfsg-1 [917 kB] 1607s Get:156 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-markdown all 1.12+dfsg-1 [179 kB] 1607s Get:157 http://ftpmaster.internal/ubuntu noble/universe arm64 r-cran-matrixstats arm64 1.2.0-1 [475 kB] 1611s Preconfiguring packages ... 1612s Fetched 170 MB in 21s (8042 kB/s) 1612s dpkg: libpsl5:arm64: dependency problems, but removing anyway as you requested: 1612s wget depends on libpsl5 (>= 0.16.0). 1612s libcurl4:arm64 depends on libpsl5 (>= 0.16.0). 1612s libcurl3-gnutls:arm64 depends on libpsl5 (>= 0.16.0). 1612s 1612s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75866 files and directories currently installed.) 1612s Removing libpsl5:arm64 (0.21.2-1build1) ... 1613s Selecting previously unselected package libpsl5t64:arm64. 1613s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75861 files and directories currently installed.) 1613s Preparing to unpack .../libpsl5t64_0.21.2-1.1_arm64.deb ... 1613s Unpacking libpsl5t64:arm64 (0.21.2-1.1) ... 1613s Preparing to unpack .../curl_8.5.0-2ubuntu7_arm64.deb ... 1613s Unpacking curl (8.5.0-2ubuntu7) over (8.5.0-2ubuntu2) ... 1614s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75867 files and directories currently installed.) 1614s Removing libcurl4:arm64 (8.5.0-2ubuntu2) ... 1615s Selecting previously unselected package libcurl4t64:arm64. 1615s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75862 files and directories currently installed.) 1615s Preparing to unpack .../libcurl4t64_8.5.0-2ubuntu7_arm64.deb ... 1615s Unpacking libcurl4t64:arm64 (8.5.0-2ubuntu7) ... 1615s dpkg: libpng16-16:arm64: dependency problems, but removing anyway as you requested: 1615s libplymouth5:arm64 depends on libpng16-16 (>= 1.6.2). 1615s libfreetype6:arm64 depends on libpng16-16 (>= 1.6.2-1). 1615s 1616s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75868 files and directories currently installed.) 1616s Removing libpng16-16:arm64 (1.6.43-1) ... 1616s Selecting previously unselected package libpng16-16t64:arm64. 1617s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75858 files and directories currently installed.) 1617s Preparing to unpack .../libpng16-16t64_1.6.43-3_arm64.deb ... 1617s Unpacking libpng16-16t64:arm64 (1.6.43-3) ... 1617s dpkg: libreadline8:arm64: dependency problems, but removing anyway as you requested: 1617s parted depends on libreadline8 (>= 6.0). 1617s libpython3.12-stdlib:arm64 depends on libreadline8 (>= 7.0~beta). 1617s libpython3.11-stdlib:arm64 depends on libreadline8 (>= 7.0~beta). 1617s gpgsm depends on libreadline8 (>= 6.0). 1617s gpgconf depends on libreadline8 (>= 6.0). 1617s gpg depends on libreadline8 (>= 6.0). 1617s gawk depends on libreadline8 (>= 6.0). 1617s fdisk depends on libreadline8 (>= 6.0). 1617s 1617s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75869 files and directories currently installed.) 1617s Removing libreadline8:arm64 (8.2-3) ... 1618s Selecting previously unselected package libreadline8t64:arm64. 1618s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75857 files and directories currently installed.) 1618s Preparing to unpack .../libreadline8t64_8.2-3.1_arm64.deb ... 1619s Adding 'diversion of /lib/aarch64-linux-gnu/libhistory.so.8 to /lib/aarch64-linux-gnu/libhistory.so.8.usr-is-merged by libreadline8t64' 1619s Adding 'diversion of /lib/aarch64-linux-gnu/libhistory.so.8.2 to /lib/aarch64-linux-gnu/libhistory.so.8.2.usr-is-merged by libreadline8t64' 1619s Adding 'diversion of /lib/aarch64-linux-gnu/libreadline.so.8 to /lib/aarch64-linux-gnu/libreadline.so.8.usr-is-merged by libreadline8t64' 1619s Adding 'diversion of /lib/aarch64-linux-gnu/libreadline.so.8.2 to /lib/aarch64-linux-gnu/libreadline.so.8.2.usr-is-merged by libreadline8t64' 1619s Unpacking libreadline8t64:arm64 (8.2-3.1) ... 1619s dpkg: libtirpc3:arm64: dependency problems, but removing anyway as you requested: 1619s lsof depends on libtirpc3 (>= 1.0.2). 1619s libpython3.12-stdlib:arm64 depends on libtirpc3 (>= 1.0.2). 1619s libpython3.11-stdlib:arm64 depends on libtirpc3 (>= 1.0.2). 1619s libnsl2:arm64 depends on libtirpc3 (>= 1.0.2). 1619s iproute2 depends on libtirpc3 (>= 1.0.2). 1619s 1620s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75877 files and directories currently installed.) 1620s Removing libtirpc3:arm64 (1.3.4+ds-1build1) ... 1620s Selecting previously unselected package libtirpc3t64:arm64. 1620s (Reading database ... (Reading database ... 5% (Reading database ... 10% (Reading database ... 15% (Reading database ... 20% (Reading database ... 25% (Reading database ... 30% (Reading database ... 35% (Reading database ... 40% (Reading database ... 45% (Reading database ... 50% (Reading database ... 55% (Reading database ... 60% (Reading database ... 65% (Reading database ... 70% (Reading database ... 75% (Reading database ... 80% (Reading database ... 85% (Reading database ... 90% (Reading database ... 95% (Reading database ... 100% (Reading database ... 75871 files and directories currently installed.) 1620s Preparing to unpack .../000-libtirpc3t64_1.3.4+ds-1.1_arm64.deb ... 1621s Adding 'diversion of /lib/aarch64-linux-gnu/libtirpc.so.3 to /lib/aarch64-linux-gnu/libtirpc.so.3.usr-is-merged by libtirpc3t64' 1621s Adding 'diversion of /lib/aarch64-linux-gnu/libtirpc.so.3.0.0 to /lib/aarch64-linux-gnu/libtirpc.so.3.0.0.usr-is-merged by libtirpc3t64' 1621s Unpacking libtirpc3t64:arm64 (1.3.4+ds-1.1) ... 1621s Selecting previously unselected package libc-dev-bin. 1621s Preparing to unpack .../001-libc-dev-bin_2.39-0ubuntu2_arm64.deb ... 1621s Unpacking libc-dev-bin (2.39-0ubuntu2) ... 1621s Selecting previously unselected package linux-libc-dev:arm64. 1621s Preparing to unpack .../002-linux-libc-dev_6.8.0-11.11_arm64.deb ... 1621s Unpacking linux-libc-dev:arm64 (6.8.0-11.11) ... 1624s Selecting previously unselected package libcrypt-dev:arm64. 1624s Preparing to unpack .../003-libcrypt-dev_1%3a4.4.36-4_arm64.deb ... 1624s Unpacking libcrypt-dev:arm64 (1:4.4.36-4) ... 1624s Selecting previously unselected package libtirpc-dev:arm64. 1624s Preparing to unpack .../004-libtirpc-dev_1.3.4+ds-1.1_arm64.deb ... 1624s Unpacking libtirpc-dev:arm64 (1.3.4+ds-1.1) ... 1624s Selecting previously unselected package libnsl-dev:arm64. 1624s Preparing to unpack .../005-libnsl-dev_1.3.0-3_arm64.deb ... 1624s Unpacking libnsl-dev:arm64 (1.3.0-3) ... 1625s Selecting previously unselected package rpcsvc-proto. 1625s Preparing to unpack .../006-rpcsvc-proto_1.4.2-0ubuntu6_arm64.deb ... 1625s Unpacking rpcsvc-proto (1.4.2-0ubuntu6) ... 1625s Selecting previously unselected package libc6-dev:arm64. 1625s Preparing to unpack .../007-libc6-dev_2.39-0ubuntu2_arm64.deb ... 1625s Unpacking libc6-dev:arm64 (2.39-0ubuntu2) ... 1626s Selecting previously unselected package libisl23:arm64. 1626s Preparing to unpack .../008-libisl23_0.26-3_arm64.deb ... 1626s Unpacking libisl23:arm64 (0.26-3) ... 1626s Selecting previously unselected package libmpc3:arm64. 1626s Preparing to unpack .../009-libmpc3_1.3.1-1_arm64.deb ... 1626s Unpacking libmpc3:arm64 (1.3.1-1) ... 1626s Selecting previously unselected package cpp-13-aarch64-linux-gnu. 1627s Preparing to unpack .../010-cpp-13-aarch64-linux-gnu_13.2.0-17ubuntu2_arm64.deb ... 1627s Unpacking cpp-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 1628s Selecting previously unselected package cpp-13. 1628s Preparing to unpack .../011-cpp-13_13.2.0-17ubuntu2_arm64.deb ... 1628s Unpacking cpp-13 (13.2.0-17ubuntu2) ... 1628s Selecting previously unselected package cpp-aarch64-linux-gnu. 1628s Preparing to unpack .../012-cpp-aarch64-linux-gnu_4%3a13.2.0-7ubuntu1_arm64.deb ... 1628s Unpacking cpp-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 1629s Selecting previously unselected package cpp. 1629s Preparing to unpack .../013-cpp_4%3a13.2.0-7ubuntu1_arm64.deb ... 1629s Unpacking cpp (4:13.2.0-7ubuntu1) ... 1629s Selecting previously unselected package libcc1-0:arm64. 1629s Preparing to unpack .../014-libcc1-0_14-20240303-1ubuntu1_arm64.deb ... 1629s Unpacking libcc1-0:arm64 (14-20240303-1ubuntu1) ... 1629s Selecting previously unselected package libgomp1:arm64. 1629s Preparing to unpack .../015-libgomp1_14-20240303-1ubuntu1_arm64.deb ... 1629s Unpacking libgomp1:arm64 (14-20240303-1ubuntu1) ... 1629s Selecting previously unselected package libitm1:arm64. 1629s Preparing to unpack .../016-libitm1_14-20240303-1ubuntu1_arm64.deb ... 1629s Unpacking libitm1:arm64 (14-20240303-1ubuntu1) ... 1630s Selecting previously unselected package libatomic1:arm64. 1630s Preparing to unpack .../017-libatomic1_14-20240303-1ubuntu1_arm64.deb ... 1630s Unpacking libatomic1:arm64 (14-20240303-1ubuntu1) ... 1630s Selecting previously unselected package libasan8:arm64. 1630s Preparing to unpack .../018-libasan8_14-20240303-1ubuntu1_arm64.deb ... 1630s Unpacking libasan8:arm64 (14-20240303-1ubuntu1) ... 1631s Selecting previously unselected package liblsan0:arm64. 1631s Preparing to unpack .../019-liblsan0_14-20240303-1ubuntu1_arm64.deb ... 1631s Unpacking liblsan0:arm64 (14-20240303-1ubuntu1) ... 1631s Selecting previously unselected package libtsan2:arm64. 1632s Preparing to unpack .../020-libtsan2_14-20240303-1ubuntu1_arm64.deb ... 1632s Unpacking libtsan2:arm64 (14-20240303-1ubuntu1) ... 1633s Selecting previously unselected package libubsan1:arm64. 1633s Preparing to unpack .../021-libubsan1_14-20240303-1ubuntu1_arm64.deb ... 1633s Unpacking libubsan1:arm64 (14-20240303-1ubuntu1) ... 1634s Selecting previously unselected package libhwasan0:arm64. 1634s Preparing to unpack .../022-libhwasan0_14-20240303-1ubuntu1_arm64.deb ... 1634s Unpacking libhwasan0:arm64 (14-20240303-1ubuntu1) ... 1634s Selecting previously unselected package libgcc-13-dev:arm64. 1635s Preparing to unpack .../023-libgcc-13-dev_13.2.0-17ubuntu2_arm64.deb ... 1635s Unpacking libgcc-13-dev:arm64 (13.2.0-17ubuntu2) ... 1636s Selecting previously unselected package gcc-13-aarch64-linux-gnu. 1636s Preparing to unpack .../024-gcc-13-aarch64-linux-gnu_13.2.0-17ubuntu2_arm64.deb ... 1636s Unpacking gcc-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 1642s Selecting previously unselected package gcc-13. 1642s Preparing to unpack .../025-gcc-13_13.2.0-17ubuntu2_arm64.deb ... 1642s Unpacking gcc-13 (13.2.0-17ubuntu2) ... 1642s Selecting previously unselected package gcc-aarch64-linux-gnu. 1642s Preparing to unpack .../026-gcc-aarch64-linux-gnu_4%3a13.2.0-7ubuntu1_arm64.deb ... 1642s Unpacking gcc-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 1643s Selecting previously unselected package gcc. 1643s Preparing to unpack .../027-gcc_4%3a13.2.0-7ubuntu1_arm64.deb ... 1643s Unpacking gcc (4:13.2.0-7ubuntu1) ... 1643s Selecting previously unselected package libstdc++-13-dev:arm64. 1643s Preparing to unpack .../028-libstdc++-13-dev_13.2.0-17ubuntu2_arm64.deb ... 1643s Unpacking libstdc++-13-dev:arm64 (13.2.0-17ubuntu2) ... 1645s Selecting previously unselected package g++-13-aarch64-linux-gnu. 1645s Preparing to unpack .../029-g++-13-aarch64-linux-gnu_13.2.0-17ubuntu2_arm64.deb ... 1645s Unpacking g++-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 1647s Selecting previously unselected package g++-13. 1647s Preparing to unpack .../030-g++-13_13.2.0-17ubuntu2_arm64.deb ... 1647s Unpacking g++-13 (13.2.0-17ubuntu2) ... 1648s Selecting previously unselected package g++-aarch64-linux-gnu. 1648s Preparing to unpack .../031-g++-aarch64-linux-gnu_4%3a13.2.0-7ubuntu1_arm64.deb ... 1648s Unpacking g++-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 1648s Selecting previously unselected package g++. 1648s Preparing to unpack .../032-g++_4%3a13.2.0-7ubuntu1_arm64.deb ... 1648s Unpacking g++ (4:13.2.0-7ubuntu1) ... 1648s Selecting previously unselected package build-essential. 1648s Preparing to unpack .../033-build-essential_12.10ubuntu1_arm64.deb ... 1648s Unpacking build-essential (12.10ubuntu1) ... 1648s Selecting previously unselected package dctrl-tools. 1648s Preparing to unpack .../034-dctrl-tools_2.24-3build2_arm64.deb ... 1648s Unpacking dctrl-tools (2.24-3build2) ... 1649s Selecting previously unselected package fonts-dejavu-mono. 1649s Preparing to unpack .../035-fonts-dejavu-mono_2.37-8_all.deb ... 1649s Unpacking fonts-dejavu-mono (2.37-8) ... 1649s Selecting previously unselected package fonts-dejavu-core. 1649s Preparing to unpack .../036-fonts-dejavu-core_2.37-8_all.deb ... 1649s Unpacking fonts-dejavu-core (2.37-8) ... 1649s Selecting previously unselected package fontconfig-config. 1649s Preparing to unpack .../037-fontconfig-config_2.15.0-1ubuntu1_arm64.deb ... 1651s Unpacking fontconfig-config (2.15.0-1ubuntu1) ... 1651s Selecting previously unselected package libfontconfig1:arm64. 1651s Preparing to unpack .../038-libfontconfig1_2.15.0-1ubuntu1_arm64.deb ... 1651s Unpacking libfontconfig1:arm64 (2.15.0-1ubuntu1) ... 1651s Selecting previously unselected package fontconfig. 1651s Preparing to unpack .../039-fontconfig_2.15.0-1ubuntu1_arm64.deb ... 1651s Unpacking fontconfig (2.15.0-1ubuntu1) ... 1652s Selecting previously unselected package fonts-glyphicons-halflings. 1652s Preparing to unpack .../040-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-3_all.deb ... 1652s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-3) ... 1652s Selecting previously unselected package fonts-mathjax. 1652s Preparing to unpack .../041-fonts-mathjax_2.7.9+dfsg-1_all.deb ... 1652s Unpacking fonts-mathjax (2.7.9+dfsg-1) ... 1653s Selecting previously unselected package libgfortran5:arm64. 1654s Preparing to unpack .../042-libgfortran5_14-20240303-1ubuntu1_arm64.deb ... 1654s Unpacking libgfortran5:arm64 (14-20240303-1ubuntu1) ... 1654s Selecting previously unselected package libgfortran-13-dev:arm64. 1654s Preparing to unpack .../043-libgfortran-13-dev_13.2.0-17ubuntu2_arm64.deb ... 1654s Unpacking libgfortran-13-dev:arm64 (13.2.0-17ubuntu2) ... 1654s Selecting previously unselected package gfortran-13-aarch64-linux-gnu. 1654s Preparing to unpack .../044-gfortran-13-aarch64-linux-gnu_13.2.0-17ubuntu2_arm64.deb ... 1654s Unpacking gfortran-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 1656s Selecting previously unselected package gfortran-13. 1656s Preparing to unpack .../045-gfortran-13_13.2.0-17ubuntu2_arm64.deb ... 1656s Unpacking gfortran-13 (13.2.0-17ubuntu2) ... 1657s Selecting previously unselected package gfortran-aarch64-linux-gnu. 1657s Preparing to unpack .../046-gfortran-aarch64-linux-gnu_4%3a13.2.0-7ubuntu1_arm64.deb ... 1657s Unpacking gfortran-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 1657s Selecting previously unselected package gfortran. 1657s Preparing to unpack .../047-gfortran_4%3a13.2.0-7ubuntu1_arm64.deb ... 1657s Unpacking gfortran (4:13.2.0-7ubuntu1) ... 1657s Selecting previously unselected package icu-devtools. 1657s Preparing to unpack .../048-icu-devtools_74.2-1ubuntu1_arm64.deb ... 1657s Unpacking icu-devtools (74.2-1ubuntu1) ... 1658s Selecting previously unselected package libblas3:arm64. 1658s Preparing to unpack .../049-libblas3_3.12.0-3_arm64.deb ... 1658s Unpacking libblas3:arm64 (3.12.0-3) ... 1658s Selecting previously unselected package libblas-dev:arm64. 1658s Preparing to unpack .../050-libblas-dev_3.12.0-3_arm64.deb ... 1658s Unpacking libblas-dev:arm64 (3.12.0-3) ... 1659s Selecting previously unselected package libbz2-dev:arm64. 1659s Preparing to unpack .../051-libbz2-dev_1.0.8-5ubuntu1_arm64.deb ... 1659s Unpacking libbz2-dev:arm64 (1.0.8-5ubuntu1) ... 1659s Selecting previously unselected package libpixman-1-0:arm64. 1659s Preparing to unpack .../052-libpixman-1-0_0.42.2-1_arm64.deb ... 1659s Unpacking libpixman-1-0:arm64 (0.42.2-1) ... 1659s Selecting previously unselected package libxcb-render0:arm64. 1659s Preparing to unpack .../053-libxcb-render0_1.15-1_arm64.deb ... 1659s Unpacking libxcb-render0:arm64 (1.15-1) ... 1660s Selecting previously unselected package libxcb-shm0:arm64. 1660s Preparing to unpack .../054-libxcb-shm0_1.15-1_arm64.deb ... 1660s Unpacking libxcb-shm0:arm64 (1.15-1) ... 1660s Selecting previously unselected package libxrender1:arm64. 1660s Preparing to unpack .../055-libxrender1_1%3a0.9.10-1.1_arm64.deb ... 1660s Unpacking libxrender1:arm64 (1:0.9.10-1.1) ... 1660s Selecting previously unselected package libcairo2:arm64. 1661s Preparing to unpack .../056-libcairo2_1.18.0-1_arm64.deb ... 1661s Unpacking libcairo2:arm64 (1.18.0-1) ... 1661s Selecting previously unselected package libdatrie1:arm64. 1662s Preparing to unpack .../057-libdatrie1_0.2.13-3_arm64.deb ... 1662s Unpacking libdatrie1:arm64 (0.2.13-3) ... 1662s Selecting previously unselected package libdeflate0:arm64. 1662s Preparing to unpack .../058-libdeflate0_1.19-1_arm64.deb ... 1662s Unpacking libdeflate0:arm64 (1.19-1) ... 1662s Selecting previously unselected package libgraphite2-3:arm64. 1663s Preparing to unpack .../059-libgraphite2-3_1.3.14-2_arm64.deb ... 1663s Unpacking libgraphite2-3:arm64 (1.3.14-2) ... 1663s Selecting previously unselected package libharfbuzz0b:arm64. 1663s Preparing to unpack .../060-libharfbuzz0b_8.3.0-2_arm64.deb ... 1663s Unpacking libharfbuzz0b:arm64 (8.3.0-2) ... 1663s Selecting previously unselected package x11-common. 1663s Preparing to unpack .../061-x11-common_1%3a7.7+23ubuntu2_all.deb ... 1663s Unpacking x11-common (1:7.7+23ubuntu2) ... 1663s Selecting previously unselected package libice6:arm64. 1663s Preparing to unpack .../062-libice6_2%3a1.0.10-1build2_arm64.deb ... 1663s Unpacking libice6:arm64 (2:1.0.10-1build2) ... 1663s Selecting previously unselected package libicu-dev:arm64. 1663s Preparing to unpack .../063-libicu-dev_74.2-1ubuntu1_arm64.deb ... 1663s Unpacking libicu-dev:arm64 (74.2-1ubuntu1) ... 1667s Selecting previously unselected package libjpeg-turbo8:arm64. 1667s Preparing to unpack .../064-libjpeg-turbo8_2.1.5-2ubuntu1_arm64.deb ... 1667s Unpacking libjpeg-turbo8:arm64 (2.1.5-2ubuntu1) ... 1667s Selecting previously unselected package libjpeg-turbo8-dev:arm64. 1667s Preparing to unpack .../065-libjpeg-turbo8-dev_2.1.5-2ubuntu1_arm64.deb ... 1667s Unpacking libjpeg-turbo8-dev:arm64 (2.1.5-2ubuntu1) ... 1668s Selecting previously unselected package libjpeg8:arm64. 1668s Preparing to unpack .../066-libjpeg8_8c-2ubuntu11_arm64.deb ... 1668s Unpacking libjpeg8:arm64 (8c-2ubuntu11) ... 1668s Selecting previously unselected package libjpeg8-dev:arm64. 1668s Preparing to unpack .../067-libjpeg8-dev_8c-2ubuntu11_arm64.deb ... 1668s Unpacking libjpeg8-dev:arm64 (8c-2ubuntu11) ... 1668s Selecting previously unselected package libjpeg-dev:arm64. 1668s Preparing to unpack .../068-libjpeg-dev_8c-2ubuntu11_arm64.deb ... 1668s Unpacking libjpeg-dev:arm64 (8c-2ubuntu11) ... 1669s Selecting previously unselected package libjs-bootstrap. 1669s Preparing to unpack .../069-libjs-bootstrap_3.4.1+dfsg-3_all.deb ... 1669s Unpacking libjs-bootstrap (3.4.1+dfsg-3) ... 1669s Selecting previously unselected package libjs-highlight.js. 1669s Preparing to unpack .../070-libjs-highlight.js_9.18.5+dfsg1-2_all.deb ... 1669s Unpacking libjs-highlight.js (9.18.5+dfsg1-2) ... 1669s Selecting previously unselected package libjs-jquery. 1669s Preparing to unpack .../071-libjs-jquery_3.6.1+dfsg+~3.5.14-1_all.deb ... 1669s Unpacking libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 1669s Selecting previously unselected package libjs-jquery-datatables. 1670s Preparing to unpack .../072-libjs-jquery-datatables_1.11.5+dfsg-2_all.deb ... 1670s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2) ... 1670s Selecting previously unselected package liblapack3:arm64. 1670s Preparing to unpack .../073-liblapack3_3.12.0-3_arm64.deb ... 1670s Unpacking liblapack3:arm64 (3.12.0-3) ... 1670s Selecting previously unselected package liblapack-dev:arm64. 1670s Preparing to unpack .../074-liblapack-dev_3.12.0-3_arm64.deb ... 1670s Unpacking liblapack-dev:arm64 (3.12.0-3) ... 1671s Selecting previously unselected package liblerc4:arm64. 1671s Preparing to unpack .../075-liblerc4_4.0.0+ds-4ubuntu1_arm64.deb ... 1671s Unpacking liblerc4:arm64 (4.0.0+ds-4ubuntu1) ... 1672s Selecting previously unselected package libncurses-dev:arm64. 1672s Preparing to unpack .../076-libncurses-dev_6.4+20240113-1ubuntu1_arm64.deb ... 1672s Unpacking libncurses-dev:arm64 (6.4+20240113-1ubuntu1) ... 1672s Selecting previously unselected package libthai-data. 1673s Preparing to unpack .../077-libthai-data_0.1.29-2_all.deb ... 1673s Unpacking libthai-data (0.1.29-2) ... 1673s Selecting previously unselected package libthai0:arm64. 1673s Preparing to unpack .../078-libthai0_0.1.29-2_arm64.deb ... 1673s Unpacking libthai0:arm64 (0.1.29-2) ... 1673s Selecting previously unselected package libpango-1.0-0:arm64. 1673s Preparing to unpack .../079-libpango-1.0-0_1.51.0+ds-4_arm64.deb ... 1673s Unpacking libpango-1.0-0:arm64 (1.51.0+ds-4) ... 1673s Selecting previously unselected package libpangoft2-1.0-0:arm64. 1673s Preparing to unpack .../080-libpangoft2-1.0-0_1.51.0+ds-4_arm64.deb ... 1673s Unpacking libpangoft2-1.0-0:arm64 (1.51.0+ds-4) ... 1674s Selecting previously unselected package libpangocairo-1.0-0:arm64. 1674s Preparing to unpack .../081-libpangocairo-1.0-0_1.51.0+ds-4_arm64.deb ... 1674s Unpacking libpangocairo-1.0-0:arm64 (1.51.0+ds-4) ... 1674s Selecting previously unselected package libpaper1:arm64. 1674s Preparing to unpack .../082-libpaper1_1.1.29_arm64.deb ... 1674s Unpacking libpaper1:arm64 (1.1.29) ... 1674s Selecting previously unselected package libpaper-utils. 1674s Preparing to unpack .../083-libpaper-utils_1.1.29_arm64.deb ... 1674s Unpacking libpaper-utils (1.1.29) ... 1675s Selecting previously unselected package libpcre2-16-0:arm64. 1675s Preparing to unpack .../084-libpcre2-16-0_10.42-4ubuntu1_arm64.deb ... 1675s Unpacking libpcre2-16-0:arm64 (10.42-4ubuntu1) ... 1676s Selecting previously unselected package libpcre2-32-0:arm64. 1676s Preparing to unpack .../085-libpcre2-32-0_10.42-4ubuntu1_arm64.deb ... 1676s Unpacking libpcre2-32-0:arm64 (10.42-4ubuntu1) ... 1676s Selecting previously unselected package libpcre2-posix3:arm64. 1676s Preparing to unpack .../086-libpcre2-posix3_10.42-4ubuntu1_arm64.deb ... 1676s Unpacking libpcre2-posix3:arm64 (10.42-4ubuntu1) ... 1676s Selecting previously unselected package libpcre2-dev:arm64. 1676s Preparing to unpack .../087-libpcre2-dev_10.42-4ubuntu1_arm64.deb ... 1676s Unpacking libpcre2-dev:arm64 (10.42-4ubuntu1) ... 1677s Selecting previously unselected package libpkgconf3:arm64. 1677s Preparing to unpack .../088-libpkgconf3_1.8.1-2_arm64.deb ... 1677s Unpacking libpkgconf3:arm64 (1.8.1-2) ... 1677s Selecting previously unselected package zlib1g-dev:arm64. 1677s Preparing to unpack .../089-zlib1g-dev_1%3a1.3.dfsg-3ubuntu1_arm64.deb ... 1677s Unpacking zlib1g-dev:arm64 (1:1.3.dfsg-3ubuntu1) ... 1677s Selecting previously unselected package libpng-dev:arm64. 1677s Preparing to unpack .../090-libpng-dev_1.6.43-3_arm64.deb ... 1677s Unpacking libpng-dev:arm64 (1.6.43-3) ... 1678s Selecting previously unselected package libreadline-dev:arm64. 1678s Preparing to unpack .../091-libreadline-dev_8.2-3.1_arm64.deb ... 1678s Unpacking libreadline-dev:arm64 (8.2-3.1) ... 1678s Selecting previously unselected package libsharpyuv0:arm64. 1679s Preparing to unpack .../092-libsharpyuv0_1.3.2-0.4_arm64.deb ... 1679s Unpacking libsharpyuv0:arm64 (1.3.2-0.4) ... 1679s Selecting previously unselected package libsm6:arm64. 1679s Preparing to unpack .../093-libsm6_2%3a1.2.3-1build2_arm64.deb ... 1679s Unpacking libsm6:arm64 (2:1.2.3-1build2) ... 1679s Selecting previously unselected package libtcl8.6:arm64. 1679s Preparing to unpack .../094-libtcl8.6_8.6.13+dfsg-2_arm64.deb ... 1679s Unpacking libtcl8.6:arm64 (8.6.13+dfsg-2) ... 1680s Selecting previously unselected package libjbig0:arm64. 1680s Preparing to unpack .../095-libjbig0_2.1-6.1ubuntu1_arm64.deb ... 1680s Unpacking libjbig0:arm64 (2.1-6.1ubuntu1) ... 1680s Selecting previously unselected package libwebp7:arm64. 1680s Preparing to unpack .../096-libwebp7_1.3.2-0.4_arm64.deb ... 1680s Unpacking libwebp7:arm64 (1.3.2-0.4) ... 1680s Selecting previously unselected package libtiff6:arm64. 1680s Preparing to unpack .../097-libtiff6_4.5.1+git230720-3ubuntu1_arm64.deb ... 1680s Unpacking libtiff6:arm64 (4.5.1+git230720-3ubuntu1) ... 1680s Selecting previously unselected package libxft2:arm64. 1680s Preparing to unpack .../098-libxft2_2.3.6-1_arm64.deb ... 1680s Unpacking libxft2:arm64 (2.3.6-1) ... 1681s Selecting previously unselected package libxss1:arm64. 1681s Preparing to unpack .../099-libxss1_1%3a1.2.3-1build2_arm64.deb ... 1681s Unpacking libxss1:arm64 (1:1.2.3-1build2) ... 1681s Selecting previously unselected package libtk8.6:arm64. 1681s Preparing to unpack .../100-libtk8.6_8.6.13-2_arm64.deb ... 1681s Unpacking libtk8.6:arm64 (8.6.13-2) ... 1681s Selecting previously unselected package libxt6t64:arm64. 1681s Preparing to unpack .../101-libxt6t64_1%3a1.2.1-1.2_arm64.deb ... 1681s Unpacking libxt6t64:arm64 (1:1.2.1-1.2) ... 1682s Selecting previously unselected package node-normalize.css. 1682s Preparing to unpack .../102-node-normalize.css_8.0.1-5_all.deb ... 1682s Unpacking node-normalize.css (8.0.1-5) ... 1682s Selecting previously unselected package pkgconf-bin. 1682s Preparing to unpack .../103-pkgconf-bin_1.8.1-2_arm64.deb ... 1682s Unpacking pkgconf-bin (1.8.1-2) ... 1682s Selecting previously unselected package pkgconf:arm64. 1682s Preparing to unpack .../104-pkgconf_1.8.1-2_arm64.deb ... 1682s Unpacking pkgconf:arm64 (1.8.1-2) ... 1683s Selecting previously unselected package pkg-config:arm64. 1683s Preparing to unpack .../105-pkg-config_1.8.1-2_arm64.deb ... 1683s Unpacking pkg-config:arm64 (1.8.1-2) ... 1683s Selecting previously unselected package zip. 1683s Preparing to unpack .../106-zip_3.0-13_arm64.deb ... 1683s Unpacking zip (3.0-13) ... 1683s Selecting previously unselected package unzip. 1683s Preparing to unpack .../107-unzip_6.0-28ubuntu3_arm64.deb ... 1683s Unpacking unzip (6.0-28ubuntu3) ... 1684s Selecting previously unselected package xdg-utils. 1684s Preparing to unpack .../108-xdg-utils_1.1.3-4.1ubuntu3_all.deb ... 1684s Unpacking xdg-utils (1.1.3-4.1ubuntu3) ... 1684s Selecting previously unselected package r-base-core. 1684s Preparing to unpack .../109-r-base-core_4.3.3-2build1_arm64.deb ... 1684s Unpacking r-base-core (4.3.3-2build1) ... 1689s Selecting previously unselected package liblzma-dev:arm64. 1689s Preparing to unpack .../110-liblzma-dev_5.4.5-0.3_arm64.deb ... 1689s Unpacking liblzma-dev:arm64 (5.4.5-0.3) ... 1690s Selecting previously unselected package r-base-dev. 1690s Preparing to unpack .../111-r-base-dev_4.3.3-2build1_all.deb ... 1690s Unpacking r-base-dev (4.3.3-2build1) ... 1691s Selecting previously unselected package pkg-r-autopkgtest. 1691s Preparing to unpack .../112-pkg-r-autopkgtest_20231212ubuntu1_all.deb ... 1691s Unpacking pkg-r-autopkgtest (20231212ubuntu1) ... 1691s Selecting previously unselected package r-cran-base64enc. 1691s Preparing to unpack .../113-r-cran-base64enc_0.1-3-3_arm64.deb ... 1691s Unpacking r-cran-base64enc (0.1-3-3) ... 1691s Selecting previously unselected package r-cran-cli. 1691s Preparing to unpack .../114-r-cran-cli_3.6.2-1_arm64.deb ... 1691s Unpacking r-cran-cli (3.6.2-1) ... 1692s Selecting previously unselected package r-cran-colorspace. 1692s Preparing to unpack .../115-r-cran-colorspace_2.1-0+dfsg-1_arm64.deb ... 1692s Unpacking r-cran-colorspace (2.1-0+dfsg-1) ... 1692s Selecting previously unselected package r-cran-commonmark. 1692s Preparing to unpack .../116-r-cran-commonmark_1.9.1-1_arm64.deb ... 1692s Unpacking r-cran-commonmark (1.9.1-1) ... 1692s Selecting previously unselected package r-cran-evaluate. 1693s Preparing to unpack .../117-r-cran-evaluate_0.23-1_all.deb ... 1693s Unpacking r-cran-evaluate (0.23-1) ... 1693s Selecting previously unselected package r-cran-fansi. 1693s Preparing to unpack .../118-r-cran-fansi_1.0.5-1_arm64.deb ... 1693s Unpacking r-cran-fansi (1.0.5-1) ... 1694s Selecting previously unselected package r-cran-farver. 1694s Preparing to unpack .../119-r-cran-farver_2.1.1-1_arm64.deb ... 1694s Unpacking r-cran-farver (2.1.1-1) ... 1694s Selecting previously unselected package r-cran-glue. 1694s Preparing to unpack .../120-r-cran-glue_1.7.0-1_arm64.deb ... 1694s Unpacking r-cran-glue (1.7.0-1) ... 1695s Selecting previously unselected package r-cran-rlang. 1695s Preparing to unpack .../121-r-cran-rlang_1.1.3-1_arm64.deb ... 1695s Unpacking r-cran-rlang (1.1.3-1) ... 1695s Selecting previously unselected package r-cran-lifecycle. 1695s Preparing to unpack .../122-r-cran-lifecycle_1.0.4+dfsg-1_all.deb ... 1695s Unpacking r-cran-lifecycle (1.0.4+dfsg-1) ... 1696s Selecting previously unselected package r-cran-gtable. 1696s Preparing to unpack .../123-r-cran-gtable_0.3.4+dfsg-1_all.deb ... 1696s Unpacking r-cran-gtable (0.3.4+dfsg-1) ... 1696s Selecting previously unselected package r-cran-isoband. 1696s Preparing to unpack .../124-r-cran-isoband_0.2.7-1_arm64.deb ... 1696s Unpacking r-cran-isoband (0.2.7-1) ... 1697s Selecting previously unselected package r-cran-mass. 1697s Preparing to unpack .../125-r-cran-mass_7.3-60.0.1-1_arm64.deb ... 1697s Unpacking r-cran-mass (7.3-60.0.1-1) ... 1697s Selecting previously unselected package r-cran-lattice. 1697s Preparing to unpack .../126-r-cran-lattice_0.22-5-1_arm64.deb ... 1697s Unpacking r-cran-lattice (0.22-5-1) ... 1698s Selecting previously unselected package r-cran-nlme. 1698s Preparing to unpack .../127-r-cran-nlme_3.1.164-1_arm64.deb ... 1698s Unpacking r-cran-nlme (3.1.164-1) ... 1698s Selecting previously unselected package r-cran-matrix. 1698s Preparing to unpack .../128-r-cran-matrix_1.6-5-1_arm64.deb ... 1698s Unpacking r-cran-matrix (1.6-5-1) ... 1699s Selecting previously unselected package r-cran-mgcv. 1699s Preparing to unpack .../129-r-cran-mgcv_1.9-1-1_arm64.deb ... 1699s Unpacking r-cran-mgcv (1.9-1-1) ... 1700s Selecting previously unselected package r-cran-labeling. 1700s Preparing to unpack .../130-r-cran-labeling_0.4.3-1_all.deb ... 1700s Unpacking r-cran-labeling (0.4.3-1) ... 1700s Selecting previously unselected package r-cran-munsell. 1700s Preparing to unpack .../131-r-cran-munsell_0.5.0-2build1_all.deb ... 1700s Unpacking r-cran-munsell (0.5.0-2build1) ... 1701s Selecting previously unselected package r-cran-r6. 1701s Preparing to unpack .../132-r-cran-r6_2.5.1-1_all.deb ... 1701s Unpacking r-cran-r6 (2.5.1-1) ... 1701s Selecting previously unselected package r-cran-rcolorbrewer. 1701s Preparing to unpack .../133-r-cran-rcolorbrewer_1.1-3-1build1_all.deb ... 1701s Unpacking r-cran-rcolorbrewer (1.1-3-1build1) ... 1701s Selecting previously unselected package r-cran-viridislite. 1701s Preparing to unpack .../134-r-cran-viridislite_0.4.2-2_all.deb ... 1701s Unpacking r-cran-viridislite (0.4.2-2) ... 1702s Selecting previously unselected package r-cran-scales. 1702s Preparing to unpack .../135-r-cran-scales_1.3.0-1_all.deb ... 1702s Unpacking r-cran-scales (1.3.0-1) ... 1702s Selecting previously unselected package r-cran-magrittr. 1702s Preparing to unpack .../136-r-cran-magrittr_2.0.3-1_arm64.deb ... 1702s Unpacking r-cran-magrittr (2.0.3-1) ... 1702s Selecting previously unselected package r-cran-utf8. 1702s Preparing to unpack .../137-r-cran-utf8_1.2.4-1_arm64.deb ... 1702s Unpacking r-cran-utf8 (1.2.4-1) ... 1703s Selecting previously unselected package r-cran-vctrs. 1703s Preparing to unpack .../138-r-cran-vctrs_0.6.5-1_arm64.deb ... 1703s Unpacking r-cran-vctrs (0.6.5-1) ... 1703s Selecting previously unselected package r-cran-pillar. 1703s Preparing to unpack .../139-r-cran-pillar_1.9.0+dfsg-1_all.deb ... 1703s Unpacking r-cran-pillar (1.9.0+dfsg-1) ... 1704s Selecting previously unselected package r-cran-pkgconfig. 1704s Preparing to unpack .../140-r-cran-pkgconfig_2.0.3-2build1_all.deb ... 1704s Unpacking r-cran-pkgconfig (2.0.3-2build1) ... 1705s Selecting previously unselected package r-cran-tibble. 1705s Preparing to unpack .../141-r-cran-tibble_3.2.1+dfsg-2_arm64.deb ... 1705s Unpacking r-cran-tibble (3.2.1+dfsg-2) ... 1706s Selecting previously unselected package r-cran-withr. 1706s Preparing to unpack .../142-r-cran-withr_2.5.0-1_all.deb ... 1706s Unpacking r-cran-withr (2.5.0-1) ... 1706s Selecting previously unselected package r-cran-ggplot2. 1706s Preparing to unpack .../143-r-cran-ggplot2_3.4.4+dfsg-1_all.deb ... 1706s Unpacking r-cran-ggplot2 (3.4.4+dfsg-1) ... 1707s Selecting previously unselected package r-cran-xfun. 1707s Preparing to unpack .../144-r-cran-xfun_0.41+dfsg-1_arm64.deb ... 1707s Unpacking r-cran-xfun (0.41+dfsg-1) ... 1707s Selecting previously unselected package r-cran-highr. 1707s Preparing to unpack .../145-r-cran-highr_0.10+dfsg-1_all.deb ... 1707s Unpacking r-cran-highr (0.10+dfsg-1) ... 1707s Selecting previously unselected package r-cran-yaml. 1707s Preparing to unpack .../146-r-cran-yaml_2.3.8-1_arm64.deb ... 1707s Unpacking r-cran-yaml (2.3.8-1) ... 1708s Selecting previously unselected package libjs-mathjax. 1708s Preparing to unpack .../147-libjs-mathjax_2.7.9+dfsg-1_all.deb ... 1708s Unpacking libjs-mathjax (2.7.9+dfsg-1) ... 1719s Selecting previously unselected package r-cran-knitr. 1719s Preparing to unpack .../148-r-cran-knitr_1.45+dfsg-1_all.deb ... 1719s Unpacking r-cran-knitr (1.45+dfsg-1) ... 1720s Selecting previously unselected package r-cran-markdown. 1720s Preparing to unpack .../149-r-cran-markdown_1.12+dfsg-1_all.deb ... 1720s Unpacking r-cran-markdown (1.12+dfsg-1) ... 1720s Selecting previously unselected package r-cran-matrixstats. 1720s Preparing to unpack .../150-r-cran-matrixstats_1.2.0-1_arm64.deb ... 1720s Unpacking r-cran-matrixstats (1.2.0-1) ... 1721s Selecting previously unselected package autopkgtest-satdep. 1721s Preparing to unpack .../151-2-autopkgtest-satdep.deb ... 1721s Unpacking autopkgtest-satdep (0) ... 1721s Setting up libgraphite2-3:arm64 (1.3.14-2) ... 1721s Setting up libpixman-1-0:arm64 (0.42.2-1) ... 1721s Setting up libsharpyuv0:arm64 (1.3.2-0.4) ... 1721s Setting up libpaper1:arm64 (1.1.29) ... 1723s 1723s Creating config file /etc/papersize with new version 1724s Setting up fonts-mathjax (2.7.9+dfsg-1) ... 1724s Setting up liblerc4:arm64 (4.0.0+ds-4ubuntu1) ... 1724s Setting up libjs-mathjax (2.7.9+dfsg-1) ... 1724s Setting up libxrender1:arm64 (1:0.9.10-1.1) ... 1724s Setting up libdatrie1:arm64 (0.2.13-3) ... 1724s Setting up libtirpc3t64:arm64 (1.3.4+ds-1.1) ... 1724s Setting up libxcb-render0:arm64 (1.15-1) ... 1724s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-3) ... 1724s Setting up unzip (6.0-28ubuntu3) ... 1724s Setting up x11-common (1:7.7+23ubuntu2) ... 1727s Setting up libpsl5t64:arm64 (0.21.2-1.1) ... 1727s Setting up libdeflate0:arm64 (1.19-1) ... 1727s Setting up linux-libc-dev:arm64 (6.8.0-11.11) ... 1727s Setting up libxcb-shm0:arm64 (1.15-1) ... 1727s Setting up libpaper-utils (1.1.29) ... 1727s Setting up libgomp1:arm64 (14-20240303-1ubuntu1) ... 1727s Setting up libjbig0:arm64 (2.1-6.1ubuntu1) ... 1727s Setting up libpcre2-16-0:arm64 (10.42-4ubuntu1) ... 1727s Setting up zip (3.0-13) ... 1728s Setting up libpcre2-32-0:arm64 (10.42-4ubuntu1) ... 1728s Setting up libblas3:arm64 (3.12.0-3) ... 1728s update-alternatives: using /usr/lib/aarch64-linux-gnu/blas/libblas.so.3 to provide /usr/lib/aarch64-linux-gnu/libblas.so.3 (libblas.so.3-aarch64-linux-gnu) in auto mode 1728s Setting up libtirpc-dev:arm64 (1.3.4+ds-1.1) ... 1728s Setting up libpkgconf3:arm64 (1.8.1-2) ... 1728s Setting up rpcsvc-proto (1.4.2-0ubuntu6) ... 1728s Setting up fonts-dejavu-mono (2.37-8) ... 1728s Setting up libpng16-16t64:arm64 (1.6.43-3) ... 1728s Setting up libmpc3:arm64 (1.3.1-1) ... 1728s Setting up libatomic1:arm64 (14-20240303-1ubuntu1) ... 1728s Setting up libtcl8.6:arm64 (8.6.13+dfsg-2) ... 1728s Setting up icu-devtools (74.2-1ubuntu1) ... 1728s Setting up fonts-dejavu-core (2.37-8) ... 1728s Setting up pkgconf-bin (1.8.1-2) ... 1728s Setting up libjpeg-turbo8:arm64 (2.1.5-2ubuntu1) ... 1728s Setting up libgfortran5:arm64 (14-20240303-1ubuntu1) ... 1728s Setting up libwebp7:arm64 (1.3.2-0.4) ... 1728s Setting up libreadline8t64:arm64 (8.2-3.1) ... 1728s Setting up liblzma-dev:arm64 (5.4.5-0.3) ... 1728s Setting up libubsan1:arm64 (14-20240303-1ubuntu1) ... 1728s Setting up libpcre2-posix3:arm64 (10.42-4ubuntu1) ... 1728s Setting up libjs-highlight.js (9.18.5+dfsg1-2) ... 1728s Setting up libnsl-dev:arm64 (1.3.0-3) ... 1728s Setting up libhwasan0:arm64 (14-20240303-1ubuntu1) ... 1728s Setting up libcrypt-dev:arm64 (1:4.4.36-4) ... 1729s Setting up libasan8:arm64 (14-20240303-1ubuntu1) ... 1729s Setting up libharfbuzz0b:arm64 (8.3.0-2) ... 1729s Setting up libthai-data (0.1.29-2) ... 1729s Setting up libxss1:arm64 (1:1.2.3-1build2) ... 1729s Setting up libtsan2:arm64 (14-20240303-1ubuntu1) ... 1729s Setting up libjs-jquery (3.6.1+dfsg+~3.5.14-1) ... 1729s Setting up libisl23:arm64 (0.26-3) ... 1729s Setting up libc-dev-bin (2.39-0ubuntu2) ... 1729s Setting up node-normalize.css (8.0.1-5) ... 1729s Setting up xdg-utils (1.1.3-4.1ubuntu3) ... 1729s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 1729s Setting up libcc1-0:arm64 (14-20240303-1ubuntu1) ... 1729s Setting up liblsan0:arm64 (14-20240303-1ubuntu1) ... 1729s Setting up libblas-dev:arm64 (3.12.0-3) ... 1729s update-alternatives: using /usr/lib/aarch64-linux-gnu/blas/libblas.so to provide /usr/lib/aarch64-linux-gnu/libblas.so (libblas.so-aarch64-linux-gnu) in auto mode 1729s Setting up dctrl-tools (2.24-3build2) ... 1729s Setting up libjs-bootstrap (3.4.1+dfsg-3) ... 1729s Setting up libitm1:arm64 (14-20240303-1ubuntu1) ... 1729s Setting up libjpeg8:arm64 (8c-2ubuntu11) ... 1729s Setting up libice6:arm64 (2:1.0.10-1build2) ... 1729s Setting up liblapack3:arm64 (3.12.0-3) ... 1730s update-alternatives: using /usr/lib/aarch64-linux-gnu/lapack/liblapack.so.3 to provide /usr/lib/aarch64-linux-gnu/liblapack.so.3 (liblapack.so.3-aarch64-linux-gnu) in auto mode 1730s Setting up cpp-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 1730s Setting up libcurl4t64:arm64 (8.5.0-2ubuntu7) ... 1730s Setting up fontconfig-config (2.15.0-1ubuntu1) ... 1735s Setting up libjs-jquery-datatables (1.11.5+dfsg-2) ... 1735s Setting up pkgconf:arm64 (1.8.1-2) ... 1735s Setting up libthai0:arm64 (0.1.29-2) ... 1735s Setting up cpp-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 1735s Setting up liblapack-dev:arm64 (3.12.0-3) ... 1735s update-alternatives: using /usr/lib/aarch64-linux-gnu/lapack/liblapack.so to provide /usr/lib/aarch64-linux-gnu/liblapack.so (liblapack.so-aarch64-linux-gnu) in auto mode 1736s Setting up pkg-config:arm64 (1.8.1-2) ... 1736s Setting up libgcc-13-dev:arm64 (13.2.0-17ubuntu2) ... 1736s Setting up libtiff6:arm64 (4.5.1+git230720-3ubuntu1) ... 1736s Setting up libc6-dev:arm64 (2.39-0ubuntu2) ... 1736s Setting up curl (8.5.0-2ubuntu7) ... 1736s Setting up libfontconfig1:arm64 (2.15.0-1ubuntu1) ... 1736s Setting up libgfortran-13-dev:arm64 (13.2.0-17ubuntu2) ... 1736s Setting up libsm6:arm64 (2:1.2.3-1build2) ... 1736s Setting up libicu-dev:arm64 (74.2-1ubuntu1) ... 1736s Setting up libstdc++-13-dev:arm64 (13.2.0-17ubuntu2) ... 1736s Setting up libbz2-dev:arm64 (1.0.8-5ubuntu1) ... 1736s Setting up fontconfig (2.15.0-1ubuntu1) ... 1739s Regenerating fonts cache... done. 1739s Setting up libjpeg-turbo8-dev:arm64 (2.1.5-2ubuntu1) ... 1739s Setting up libxft2:arm64 (2.3.6-1) ... 1739s Setting up libncurses-dev:arm64 (6.4+20240113-1ubuntu1) ... 1739s Setting up libpcre2-dev:arm64 (10.42-4ubuntu1) ... 1739s Setting up cpp-13 (13.2.0-17ubuntu2) ... 1739s Setting up libtk8.6:arm64 (8.6.13-2) ... 1739s Setting up libpango-1.0-0:arm64 (1.51.0+ds-4) ... 1739s Setting up gcc-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 1739s Setting up libreadline-dev:arm64 (8.2-3.1) ... 1739s Setting up libcairo2:arm64 (1.18.0-1) ... 1739s Setting up libxt6t64:arm64 (1:1.2.1-1.2) ... 1739s Setting up gcc-13 (13.2.0-17ubuntu2) ... 1739s Setting up zlib1g-dev:arm64 (1:1.3.dfsg-3ubuntu1) ... 1739s Setting up cpp (4:13.2.0-7ubuntu1) ... 1739s Setting up libpangoft2-1.0-0:arm64 (1.51.0+ds-4) ... 1739s Setting up libjpeg8-dev:arm64 (8c-2ubuntu11) ... 1739s Setting up libpangocairo-1.0-0:arm64 (1.51.0+ds-4) ... 1739s Setting up g++-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 1739s Setting up gcc-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 1739s Setting up g++-13 (13.2.0-17ubuntu2) ... 1739s Setting up libpng-dev:arm64 (1.6.43-3) ... 1739s Setting up libjpeg-dev:arm64 (8c-2ubuntu11) ... 1739s Setting up gfortran-13-aarch64-linux-gnu (13.2.0-17ubuntu2) ... 1739s Setting up gcc (4:13.2.0-7ubuntu1) ... 1739s Setting up gfortran-13 (13.2.0-17ubuntu2) ... 1739s Setting up r-base-core (4.3.3-2build1) ... 1743s 1743s Creating config file /etc/R/Renviron with new version 1745s Setting up r-cran-labeling (0.4.3-1) ... 1745s Setting up r-cran-lattice (0.22-5-1) ... 1745s Setting up r-cran-nlme (3.1.164-1) ... 1745s Setting up r-cran-farver (2.1.1-1) ... 1745s Setting up r-cran-viridislite (0.4.2-2) ... 1745s Setting up g++-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 1745s Setting up gfortran-aarch64-linux-gnu (4:13.2.0-7ubuntu1) ... 1745s Setting up r-cran-commonmark (1.9.1-1) ... 1745s Setting up r-cran-r6 (2.5.1-1) ... 1745s Setting up r-cran-magrittr (2.0.3-1) ... 1745s Setting up r-cran-rlang (1.1.3-1) ... 1745s Setting up r-cran-matrixstats (1.2.0-1) ... 1745s Setting up r-cran-xfun (0.41+dfsg-1) ... 1745s Setting up r-cran-withr (2.5.0-1) ... 1745s Setting up r-cran-base64enc (0.1-3-3) ... 1745s Setting up r-cran-yaml (2.3.8-1) ... 1745s Setting up r-cran-evaluate (0.23-1) ... 1745s Setting up r-cran-highr (0.10+dfsg-1) ... 1745s Setting up r-cran-fansi (1.0.5-1) ... 1745s Setting up r-cran-mass (7.3-60.0.1-1) ... 1745s Setting up r-cran-glue (1.7.0-1) ... 1745s Setting up r-cran-cli (3.6.2-1) ... 1745s Setting up gfortran (4:13.2.0-7ubuntu1) ... 1745s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode 1745s update-alternatives: warning: skip creation of /usr/share/man/man1/f95.1.gz because associated file /usr/share/man/man1/gfortran.1.gz (of link group f95) doesn't exist 1745s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode 1745s update-alternatives: warning: skip creation of /usr/share/man/man1/f77.1.gz because associated file /usr/share/man/man1/gfortran.1.gz (of link group f77) doesn't exist 1745s Setting up r-cran-lifecycle (1.0.4+dfsg-1) ... 1746s Setting up r-cran-pkgconfig (2.0.3-2build1) ... 1746s Setting up r-cran-utf8 (1.2.4-1) ... 1746s Setting up r-cran-colorspace (2.1-0+dfsg-1) ... 1746s Setting up r-cran-markdown (1.12+dfsg-1) ... 1746s Setting up r-cran-rcolorbrewer (1.1-3-1build1) ... 1746s Setting up r-cran-isoband (0.2.7-1) ... 1746s Setting up r-cran-gtable (0.3.4+dfsg-1) ... 1746s Setting up r-cran-matrix (1.6-5-1) ... 1746s Setting up r-cran-knitr (1.45+dfsg-1) ... 1746s Setting up r-cran-mgcv (1.9-1-1) ... 1746s Setting up g++ (4:13.2.0-7ubuntu1) ... 1746s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 1746s Setting up build-essential (12.10ubuntu1) ... 1746s Setting up r-cran-vctrs (0.6.5-1) ... 1746s Setting up r-cran-pillar (1.9.0+dfsg-1) ... 1746s Setting up r-base-dev (4.3.3-2build1) ... 1746s Setting up r-cran-munsell (0.5.0-2build1) ... 1746s Setting up r-cran-tibble (3.2.1+dfsg-2) ... 1746s Setting up r-cran-scales (1.3.0-1) ... 1746s Setting up pkg-r-autopkgtest (20231212ubuntu1) ... 1746s Setting up r-cran-ggplot2 (3.4.4+dfsg-1) ... 1746s Setting up autopkgtest-satdep (0) ... 1746s Processing triggers for man-db (2.12.0-3) ... 1751s Processing triggers for install-info (7.1-3) ... 1753s Processing triggers for libc-bin (2.39-0ubuntu2) ... 1801s (Reading database ... 89809 files and directories currently installed.) 1801s Removing autopkgtest-satdep (0) ... 1806s autopkgtest [19:40:44]: test pkg-r-autopkgtest: /usr/share/dh-r/pkg-r-autopkgtest 1806s autopkgtest [19:40:44]: test pkg-r-autopkgtest: [----------------------- 1807s Test: Try to load the R library matrixStats 1808s 1808s R version 4.3.3 (2024-02-29) -- "Angel Food Cake" 1808s Copyright (C) 2024 The R Foundation for Statistical Computing 1808s Platform: aarch64-unknown-linux-gnu (64-bit) 1808s 1808s R is free software and comes with ABSOLUTELY NO WARRANTY. 1808s You are welcome to redistribute it under certain conditions. 1808s Type 'license()' or 'licence()' for distribution details. 1808s 1808s R is a collaborative project with many contributors. 1808s Type 'contributors()' for more information and 1808s 'citation()' on how to cite R or R packages in publications. 1808s 1808s Type 'demo()' for some demos, 'help()' for on-line help, or 1808s 'help.start()' for an HTML browser interface to help. 1808s Type 'q()' to quit R. 1808s 1809s > library('matrixStats') 1809s > 1809s > 1809s Other tests are currently unsupported! 1809s They will be progressively added. 1810s autopkgtest [19:40:48]: test pkg-r-autopkgtest: -----------------------] 1811s autopkgtest [19:40:49]: test pkg-r-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 1811s pkg-r-autopkgtest PASS 1812s autopkgtest [19:40:50]: @@@@@@@@@@@@@@@@@@@@ summary 1812s run-unit-test PASS 1812s pkg-r-autopkgtest PASS 1824s Creating nova instance adt-noble-arm64-r-cran-matrixstats-20240316-191038-juju-7f2275-prod-proposed-migration-environment-2 from image adt/ubuntu-noble-arm64-server-20240316.img (UUID 9d2e92bf-2787-45c2-ae22-99fb4bcc175e)... 1824s Creating nova instance adt-noble-arm64-r-cran-matrixstats-20240316-191038-juju-7f2275-prod-proposed-migration-environment-2 from image adt/ubuntu-noble-arm64-server-20240316.img (UUID 9d2e92bf-2787-45c2-ae22-99fb4bcc175e)...