0s autopkgtest [23:53:25]: starting date and time: 2026-02-09 23:53:25+0000 0s autopkgtest [23:53:25]: git checkout: 4b346b80 nova: make wait_reboot return success even when a no-op 0s autopkgtest [23:53:25]: host juju-7f2275-prod-proposed-migration-environment-20; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.b1qah3c9/out --timeout-copy=6000 --needs-internet=try --setup-commands /home/ubuntu/autopkgtest-cloud/worker-config-production/setup-canonical.sh --apt-pocket=proposed=src:r-cran-ggplot2 --apt-upgrade r-cran-matrixstats --timeout-short=300 --timeout-copy=20000 --timeout-build=20000 --env=ADT_TEST_TRIGGERS=r-cran-ggplot2/4.0.2+dfsg-1 -- ssh -s /home/ubuntu/autopkgtest/ssh-setup/nova -- --flavor autopkgtest-cpu2-ram4-disk20-arm64 --security-groups autopkgtest-juju-7f2275-prod-proposed-migration-environment-20@sto01-arm64-12.secgroup --name adt-resolute-arm64-r-cran-matrixstats-20260209-235325-juju-7f2275-prod-proposed-migration-environment-20-41e3997e-2454-4969-95cf-1ab1be4b135f --image adt/ubuntu-resolute-arm64-server --keyname testbed-juju-7f2275-prod-proposed-migration-environment-20 --net-id=net_prod-autopkgtest-workers-arm64 -e TERM=linux --mirror=http://ftpmaster.internal/ubuntu/ 3s Creating nova instance adt-resolute-arm64-r-cran-matrixstats-20260209-235325-juju-7f2275-prod-proposed-migration-environment-20-41e3997e-2454-4969-95cf-1ab1be4b135f from image adt/ubuntu-resolute-arm64-server-20260209.img (UUID 793037ca-75af-461b-82de-f8081300b2e3)... 164s autopkgtest [23:56:09]: testbed dpkg architecture: arm64 164s autopkgtest [23:56:09]: testbed apt version: 3.1.15 164s autopkgtest [23:56:09]: @@@@@@@@@@@@@@@@@@@@ test bed setup 164s autopkgtest [23:56:09]: testbed release detected to be: None 165s autopkgtest [23:56:10]: updating testbed package index (apt update) 165s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [124 kB] 165s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 165s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 165s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 166s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [29.4 kB] 166s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [176 kB] 166s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [1645 kB] 171s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 Packages [246 kB] 171s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 c-n-f Metadata [6216 B] 171s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/restricted arm64 c-n-f Metadata [304 B] 171s Get:11 http://ftpmaster.internal/ubuntu resolute-proposed/universe arm64 Packages [1580 kB] 174s Get:12 http://ftpmaster.internal/ubuntu resolute-proposed/universe arm64 c-n-f Metadata [32.0 kB] 174s Get:13 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse arm64 Packages [21.7 kB] 174s Get:14 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse arm64 c-n-f Metadata [688 B] 176s Fetched 3862 kB in 9s (434 kB/s) 176s Reading package lists... 177s Hit:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease 177s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 177s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 177s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 178s Reading package lists... 178s Reading package lists... 178s Building dependency tree... 178s Reading state information... 179s Calculating upgrade... 179s The following packages will be upgraded: 179s cryptsetup-bin dracut-install iproute2 iptables libcryptsetup12 libip4tc2 179s libip6tc2 libxtables12 wget 179s 9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 179s Need to get 2534 kB of archives. 179s After this operation, 18.4 kB of additional disk space will be used. 179s Get:1 http://ftpmaster.internal/ubuntu resolute/main arm64 iptables arm64 1.8.11-2ubuntu3 [386 kB] 179s Get:2 http://ftpmaster.internal/ubuntu resolute/main arm64 libip4tc2 arm64 1.8.11-2ubuntu3 [24.3 kB] 179s Get:3 http://ftpmaster.internal/ubuntu resolute/main arm64 libip6tc2 arm64 1.8.11-2ubuntu3 [24.7 kB] 179s Get:4 http://ftpmaster.internal/ubuntu resolute/main arm64 libxtables12 arm64 1.8.11-2ubuntu3 [36.7 kB] 179s Get:5 http://ftpmaster.internal/ubuntu resolute/main arm64 iproute2 arm64 6.18.0-1ubuntu1 [1171 kB] 181s Get:6 http://ftpmaster.internal/ubuntu resolute/main arm64 libcryptsetup12 arm64 2:2.8.0-1ubuntu3 [274 kB] 181s Get:7 http://ftpmaster.internal/ubuntu resolute/main arm64 wget arm64 1.25.0-2ubuntu4 [344 kB] 181s Get:8 http://ftpmaster.internal/ubuntu resolute/main arm64 cryptsetup-bin arm64 2:2.8.0-1ubuntu3 [227 kB] 181s Get:9 http://ftpmaster.internal/ubuntu resolute/main arm64 dracut-install arm64 109-11ubuntu1 [45.3 kB] 182s dpkg-preconfigure: unable to re-open stdin: No such file or directory 182s Fetched 2534 kB in 2s (1138 kB/s) 182s (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 ... 136597 files and directories currently installed.) 182s Preparing to unpack .../0-iptables_1.8.11-2ubuntu3_arm64.deb ... 182s Unpacking iptables (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 182s Preparing to unpack .../1-libip4tc2_1.8.11-2ubuntu3_arm64.deb ... 182s Unpacking libip4tc2:arm64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 182s Preparing to unpack .../2-libip6tc2_1.8.11-2ubuntu3_arm64.deb ... 182s Unpacking libip6tc2:arm64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 183s Preparing to unpack .../3-libxtables12_1.8.11-2ubuntu3_arm64.deb ... 183s Unpacking libxtables12:arm64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 183s Preparing to unpack .../4-iproute2_6.18.0-1ubuntu1_arm64.deb ... 183s Unpacking iproute2 (6.18.0-1ubuntu1) over (6.16.0-1ubuntu3) ... 183s Preparing to unpack .../5-libcryptsetup12_2%3a2.8.0-1ubuntu3_arm64.deb ... 183s Unpacking libcryptsetup12:arm64 (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 183s Preparing to unpack .../6-wget_1.25.0-2ubuntu4_arm64.deb ... 183s Unpacking wget (1.25.0-2ubuntu4) over (1.25.0-2ubuntu3) ... 183s Preparing to unpack .../7-cryptsetup-bin_2%3a2.8.0-1ubuntu3_arm64.deb ... 183s Unpacking cryptsetup-bin (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 183s Preparing to unpack .../8-dracut-install_109-11ubuntu1_arm64.deb ... 183s Unpacking dracut-install (109-11ubuntu1) over (109-9ubuntu1) ... 183s Setting up libip4tc2:arm64 (1.8.11-2ubuntu3) ... 183s Setting up wget (1.25.0-2ubuntu4) ... 183s Setting up libip6tc2:arm64 (1.8.11-2ubuntu3) ... 184s Setting up libxtables12:arm64 (1.8.11-2ubuntu3) ... 184s Setting up dracut-install (109-11ubuntu1) ... 184s Setting up libcryptsetup12:arm64 (2:2.8.0-1ubuntu3) ... 184s Setting up cryptsetup-bin (2:2.8.0-1ubuntu3) ... 184s Setting up iptables (1.8.11-2ubuntu3) ... 184s Setting up iproute2 (6.18.0-1ubuntu1) ... 184s Processing triggers for man-db (2.13.1-1build1) ... 185s Processing triggers for install-info (7.2-5) ... 185s Processing triggers for libc-bin (2.42-2ubuntu4) ... 186s autopkgtest [23:56:30]: upgrading testbed (apt dist-upgrade and autopurge) 186s Reading package lists... 186s Building dependency tree... 186s Reading state information... 186s Calculating upgrade... 187s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 187s Reading package lists... 187s Building dependency tree... 187s Reading state information... 187s Solving dependencies... 188s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 190s autopkgtest [23:56:35]: testbed running kernel: Linux 6.19.0-3-generic #3-Ubuntu SMP PREEMPT_DYNAMIC Fri Jan 23 19:46:27 UTC 2026 190s autopkgtest [23:56:35]: @@@@@@@@@@@@@@@@@@@@ apt-source r-cran-matrixstats 192s Get:1 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (dsc) [2228 B] 192s Get:2 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (tar) [212 kB] 192s Get:3 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (diff) [4864 B] 192s gpgv: Signature made Sat Jan 18 11:46:01 2025 UTC 192s gpgv: using RSA key 724D609337113C710550D7473C26763F6C67E6E2 192s gpgv: Can't check signature: No public key 192s dpkg-source: warning: cannot verify inline signature for ./r-cran-matrixstats_1.5.0-1.dsc: no acceptable signature found 192s autopkgtest [23:56:37]: testing package r-cran-matrixstats version 1.5.0-1 193s autopkgtest [23:56:38]: build not needed 194s autopkgtest [23:56:39]: test run-unit-test: preparing testbed 194s Reading package lists... 194s Building dependency tree... 194s Reading state information... 195s Solving dependencies... 195s The following NEW packages will be installed: 195s fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono 195s fonts-glyphicons-halflings fonts-mathjax libblas3 libcairo2 libdatrie1 195s libdeflate0 libfontconfig1 libgfortran5 libgomp1 libgraphite2-3 195s libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 libjpeg8 libjs-bootstrap 195s libjs-highlight.js libjs-jquery libjs-jquery-datatables libjs-mathjax 195s liblapack3 liblerc4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 195s libpaper-utils libpaper2 libpixman-1-0 libsharpyuv0 libsm6 libtcl8.6 195s libthai-data libthai0 libtiff6 libtk8.6 libwebp7 libxcb-render0 libxcb-shm0 195s libxft2 libxrender1 libxss1 libxt6t64 node-normalize.css r-base-core 195s r-cran-base64enc r-cran-cli r-cran-commonmark r-cran-digest r-cran-evaluate 195s r-cran-farver r-cran-ggplot2 r-cran-glue r-cran-gtable r-cran-highr 195s r-cran-isoband r-cran-knitr r-cran-labeling r-cran-lifecycle r-cran-markdown 195s r-cran-matrixstats r-cran-microbenchmark r-cran-r.cache r-cran-r.devices 195s r-cran-r.methodss3 r-cran-r.oo r-cran-r.rsp r-cran-r.utils r-cran-r6 195s r-cran-rcolorbrewer r-cran-rlang r-cran-s7 r-cran-scales r-cran-vctrs 195s r-cran-viridislite r-cran-withr r-cran-xfun r-cran-yaml tcl tcl8.6 unzip 195s x11-common xdg-utils zip 196s 0 upgraded, 87 newly installed, 0 to remove and 0 not upgraded. 196s Need to get 70.3 MB of archives. 196s After this operation, 168 MB of additional disk space will be used. 196s Get:1 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-dejavu-mono all 2.37-8build1 [502 kB] 196s Get:2 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-dejavu-core all 2.37-8build1 [834 kB] 197s Get:3 http://ftpmaster.internal/ubuntu resolute/main arm64 fontconfig-config arm64 2.17.1-3ubuntu1 [38.5 kB] 197s Get:4 http://ftpmaster.internal/ubuntu resolute/main arm64 libfontconfig1 arm64 2.17.1-3ubuntu1 [144 kB] 197s Get:5 http://ftpmaster.internal/ubuntu resolute/main arm64 fontconfig arm64 2.17.1-3ubuntu1 [181 kB] 197s Get:6 http://ftpmaster.internal/ubuntu resolute/universe arm64 fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-6 [119 kB] 197s Get:7 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-mathjax all 2.7.9+dfsg-1build1 [2283 kB] 201s Get:8 http://ftpmaster.internal/ubuntu resolute/main arm64 libblas3 arm64 3.12.1-7ubuntu1 [181 kB] 201s Get:9 http://ftpmaster.internal/ubuntu resolute/main arm64 libpixman-1-0 arm64 0.46.4-1 [204 kB] 201s Get:10 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-render0 arm64 1.17.0-2ubuntu1 [16.4 kB] 201s Get:11 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-shm0 arm64 1.17.0-2ubuntu1 [5938 B] 201s Get:12 http://ftpmaster.internal/ubuntu resolute/main arm64 libxrender1 arm64 1:0.9.12-1 [19.5 kB] 201s Get:13 http://ftpmaster.internal/ubuntu resolute/main arm64 libcairo2 arm64 1.18.4-3 [556 kB] 202s Get:14 http://ftpmaster.internal/ubuntu resolute/main arm64 libdatrie1 arm64 0.2.14-1 [19.6 kB] 202s Get:15 http://ftpmaster.internal/ubuntu resolute/main arm64 libdeflate0 arm64 1.23-2build1 [46.8 kB] 202s Get:16 http://ftpmaster.internal/ubuntu resolute/main arm64 libgfortran5 arm64 15.2.0-12ubuntu1 [451 kB] 202s Get:17 http://ftpmaster.internal/ubuntu resolute/main arm64 libgomp1 arm64 15.2.0-12ubuntu1 [147 kB] 202s Get:18 http://ftpmaster.internal/ubuntu resolute/main arm64 libgraphite2-3 arm64 1.3.14-11ubuntu1 [72.1 kB] 202s Get:19 http://ftpmaster.internal/ubuntu resolute/main arm64 libharfbuzz0b arm64 12.3.2-1 [510 kB] 202s Get:20 http://ftpmaster.internal/ubuntu resolute/main arm64 x11-common all 1:7.7+24ubuntu1 [22.4 kB] 202s Get:21 http://ftpmaster.internal/ubuntu resolute/main arm64 libice6 arm64 2:1.1.1-1build1 [43.0 kB] 202s Get:22 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg-turbo8 arm64 2.1.5-4ubuntu3 [161 kB] 202s Get:23 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg8 arm64 8c-2ubuntu11 [2148 B] 202s Get:24 http://ftpmaster.internal/ubuntu resolute/universe arm64 libjs-bootstrap all 3.4.1+dfsg-6 [129 kB] 202s Get:25 http://ftpmaster.internal/ubuntu resolute/universe arm64 libjs-highlight.js all 10.7.3+dfsg-2 [144 kB] 202s Get:26 http://ftpmaster.internal/ubuntu resolute/main arm64 libjs-jquery all 3.7.1+dfsg+~3.5.33-1build1 [321 kB] 202s Get:27 http://ftpmaster.internal/ubuntu resolute/universe arm64 libjs-jquery-datatables all 1.11.5+dfsg-2build1 [145 kB] 202s Get:28 http://ftpmaster.internal/ubuntu resolute/main arm64 liblapack3 arm64 3.12.1-7ubuntu1 [2299 kB] 206s Get:29 http://ftpmaster.internal/ubuntu resolute/main arm64 liblerc4 arm64 4.0.0+ds-5ubuntu2 [174 kB] 206s Get:30 http://ftpmaster.internal/ubuntu resolute/main arm64 libthai-data all 0.1.30-1 [155 kB] 206s Get:31 http://ftpmaster.internal/ubuntu resolute/main arm64 libthai0 arm64 0.1.30-1 [18.3 kB] 206s Get:32 http://ftpmaster.internal/ubuntu resolute/main arm64 libpango-1.0-0 arm64 1.57.0-1 [238 kB] 206s Get:33 http://ftpmaster.internal/ubuntu resolute/main arm64 libpangoft2-1.0-0 arm64 1.57.0-1 [51.5 kB] 206s Get:34 http://ftpmaster.internal/ubuntu resolute/main arm64 libpangocairo-1.0-0 arm64 1.57.0-1 [27.9 kB] 206s Get:35 http://ftpmaster.internal/ubuntu resolute/main arm64 libpaper2 arm64 2.2.5-0.3build1 [17.3 kB] 206s Get:36 http://ftpmaster.internal/ubuntu resolute/main arm64 libpaper-utils arm64 2.2.5-0.3build1 [15.4 kB] 206s Get:37 http://ftpmaster.internal/ubuntu resolute/main arm64 libsharpyuv0 arm64 1.5.0-0.1build1 [16.7 kB] 206s Get:38 http://ftpmaster.internal/ubuntu resolute/main arm64 libsm6 arm64 2:1.2.6-1build1 [16.8 kB] 206s Get:39 http://ftpmaster.internal/ubuntu resolute/main arm64 libtcl8.6 arm64 8.6.17+dfsg-1build1 [983 kB] 208s Get:40 http://ftpmaster.internal/ubuntu resolute/main arm64 libjbig0 arm64 2.1-6.1ubuntu3 [29.2 kB] 208s Get:41 http://ftpmaster.internal/ubuntu resolute/main arm64 libwebp7 arm64 1.5.0-0.1build1 [205 kB] 208s Get:42 http://ftpmaster.internal/ubuntu resolute/main arm64 libtiff6 arm64 4.7.0-3ubuntu3 [196 kB] 208s Get:43 http://ftpmaster.internal/ubuntu resolute/main arm64 libxft2 arm64 2.3.6-1build2 [43.2 kB] 208s Get:44 http://ftpmaster.internal/ubuntu resolute/main arm64 libxss1 arm64 1:1.2.3-1build4 [7102 B] 208s Get:45 http://ftpmaster.internal/ubuntu resolute/main arm64 libtk8.6 arm64 8.6.17-1 [811 kB] 210s Get:46 http://ftpmaster.internal/ubuntu resolute/main arm64 libxt6t64 arm64 1:1.2.1-1.3 [168 kB] 210s Get:47 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-normalize.css all 8.0.1-5.1 [10.4 kB] 210s Get:48 http://ftpmaster.internal/ubuntu resolute/main arm64 zip arm64 3.0-15ubuntu3 [170 kB] 210s Get:49 http://ftpmaster.internal/ubuntu resolute/main arm64 unzip arm64 6.0-29ubuntu1 [176 kB] 210s Get:50 http://ftpmaster.internal/ubuntu resolute/main arm64 xdg-utils all 1.2.1-2ubuntu2 [66.1 kB] 210s Get:51 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-base-core arm64 4.5.2-1ubuntu2 [28.6 MB] 302s Get:52 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-base64enc arm64 0.1-3-3build1 [28.5 kB] 303s Get:53 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-cli arm64 3.6.4-1 [1374 kB] 306s Get:54 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-commonmark arm64 1.9.5-1 [130 kB] 306s Get:55 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-digest arm64 0.6.39-1 [196 kB] 306s Get:56 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-evaluate all 1.0.5-1 [117 kB] 306s Get:57 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-farver arm64 2.1.2-1 [1344 kB] 309s Get:58 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-glue arm64 1.8.0-1 [163 kB] 309s Get:59 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-rlang arm64 1.1.5-3 [1706 kB] 312s Get:60 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-lifecycle all 1.0.5+dfsg-1 [120 kB] 312s Get:61 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-gtable all 0.3.6+dfsg-1 [199 kB] 312s Get:62 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-isoband arm64 0.2.7-1 [1481 kB] 314s Get:63 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-s7 arm64 0.2.0-1 [329 kB] 314s Get:64 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-labeling all 0.4.3-1 [62.1 kB] 314s Get:65 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-r6 all 2.6.1-1 [101 kB] 314s Get:66 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-rcolorbrewer all 1.1-3-1build2 [54.0 kB] 314s Get:67 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-viridislite all 0.4.3-1 [1088 kB] 317s Get:68 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-scales all 1.4.0-1 [725 kB] 318s Get:69 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-vctrs arm64 0.6.5-1 [1327 kB] 321s Get:70 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-withr all 3.0.2+dfsg-1 [214 kB] 321s Get:71 http://ftpmaster.internal/ubuntu resolute-proposed/universe arm64 r-cran-ggplot2 all 4.0.2+dfsg-1 [4941 kB] 332s Get:72 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-xfun arm64 0.55+dfsg-1 [587 kB] 333s Get:73 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-highr all 0.11+dfsg-1 [38.5 kB] 333s Get:74 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-yaml arm64 2.3.10-1 [108 kB] 333s Get:75 http://ftpmaster.internal/ubuntu resolute/main arm64 libjs-mathjax all 2.7.9+dfsg-1build1 [6017 kB] 345s Get:76 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-knitr all 1.51+dfsg-1 [847 kB] 346s Get:77 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-markdown all 1.13-1 [162 kB] 346s Get:78 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-matrixstats arm64 1.5.0-1 [496 kB] 346s Get:79 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-microbenchmark arm64 1.5.0-1 [67.5 kB] 346s Get:80 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-r.methodss3 all 1.8.2-1 [84.0 kB] 346s Get:81 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-r.oo all 1.27.1-1 [978 kB] 348s Get:82 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-r.utils all 2.13.0-1 [1423 kB] 351s Get:83 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-r.cache all 0.17.0-1 [117 kB] 351s Get:84 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-r.devices all 2.17.3+ds-1 [400 kB] 352s Get:85 http://ftpmaster.internal/ubuntu resolute/main arm64 tcl8.6 arm64 8.6.17+dfsg-1build1 [14.8 kB] 352s Get:86 http://ftpmaster.internal/ubuntu resolute/main arm64 tcl arm64 8.6.16build1 [4200 B] 352s Get:87 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-r.rsp all 0.46.0+ds-1 [1412 kB] 354s Preconfiguring packages ... 355s Fetched 70.3 MB in 2min 39s (442 kB/s) 355s Selecting previously unselected package fonts-dejavu-mono. 355s (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 ... 136600 files and directories currently installed.) 355s Preparing to unpack .../00-fonts-dejavu-mono_2.37-8build1_all.deb ... 355s Unpacking fonts-dejavu-mono (2.37-8build1) ... 355s Selecting previously unselected package fonts-dejavu-core. 355s Preparing to unpack .../01-fonts-dejavu-core_2.37-8build1_all.deb ... 355s Unpacking fonts-dejavu-core (2.37-8build1) ... 355s Selecting previously unselected package fontconfig-config. 355s Preparing to unpack .../02-fontconfig-config_2.17.1-3ubuntu1_arm64.deb ... 355s Unpacking fontconfig-config (2.17.1-3ubuntu1) ... 355s Selecting previously unselected package libfontconfig1:arm64. 355s Preparing to unpack .../03-libfontconfig1_2.17.1-3ubuntu1_arm64.deb ... 355s Unpacking libfontconfig1:arm64 (2.17.1-3ubuntu1) ... 355s Selecting previously unselected package fontconfig. 355s Preparing to unpack .../04-fontconfig_2.17.1-3ubuntu1_arm64.deb ... 355s Unpacking fontconfig (2.17.1-3ubuntu1) ... 355s Selecting previously unselected package fonts-glyphicons-halflings. 355s Preparing to unpack .../05-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-6_all.deb ... 355s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 355s Selecting previously unselected package fonts-mathjax. 355s Preparing to unpack .../06-fonts-mathjax_2.7.9+dfsg-1build1_all.deb ... 355s Unpacking fonts-mathjax (2.7.9+dfsg-1build1) ... 355s Selecting previously unselected package libblas3:arm64. 355s Preparing to unpack .../07-libblas3_3.12.1-7ubuntu1_arm64.deb ... 355s Unpacking libblas3:arm64 (3.12.1-7ubuntu1) ... 355s Selecting previously unselected package libpixman-1-0:arm64. 355s Preparing to unpack .../08-libpixman-1-0_0.46.4-1_arm64.deb ... 355s Unpacking libpixman-1-0:arm64 (0.46.4-1) ... 355s Selecting previously unselected package libxcb-render0:arm64. 355s Preparing to unpack .../09-libxcb-render0_1.17.0-2ubuntu1_arm64.deb ... 355s Unpacking libxcb-render0:arm64 (1.17.0-2ubuntu1) ... 355s Selecting previously unselected package libxcb-shm0:arm64. 355s Preparing to unpack .../10-libxcb-shm0_1.17.0-2ubuntu1_arm64.deb ... 355s Unpacking libxcb-shm0:arm64 (1.17.0-2ubuntu1) ... 355s Selecting previously unselected package libxrender1:arm64. 355s Preparing to unpack .../11-libxrender1_1%3a0.9.12-1_arm64.deb ... 355s Unpacking libxrender1:arm64 (1:0.9.12-1) ... 355s Selecting previously unselected package libcairo2:arm64. 355s Preparing to unpack .../12-libcairo2_1.18.4-3_arm64.deb ... 355s Unpacking libcairo2:arm64 (1.18.4-3) ... 356s Selecting previously unselected package libdatrie1:arm64. 356s Preparing to unpack .../13-libdatrie1_0.2.14-1_arm64.deb ... 356s Unpacking libdatrie1:arm64 (0.2.14-1) ... 356s Selecting previously unselected package libdeflate0:arm64. 356s Preparing to unpack .../14-libdeflate0_1.23-2build1_arm64.deb ... 356s Unpacking libdeflate0:arm64 (1.23-2build1) ... 356s Selecting previously unselected package libgfortran5:arm64. 356s Preparing to unpack .../15-libgfortran5_15.2.0-12ubuntu1_arm64.deb ... 356s Unpacking libgfortran5:arm64 (15.2.0-12ubuntu1) ... 356s Selecting previously unselected package libgomp1:arm64. 356s Preparing to unpack .../16-libgomp1_15.2.0-12ubuntu1_arm64.deb ... 356s Unpacking libgomp1:arm64 (15.2.0-12ubuntu1) ... 356s Selecting previously unselected package libgraphite2-3:arm64. 356s Preparing to unpack .../17-libgraphite2-3_1.3.14-11ubuntu1_arm64.deb ... 356s Unpacking libgraphite2-3:arm64 (1.3.14-11ubuntu1) ... 356s Selecting previously unselected package libharfbuzz0b:arm64. 356s Preparing to unpack .../18-libharfbuzz0b_12.3.2-1_arm64.deb ... 356s Unpacking libharfbuzz0b:arm64 (12.3.2-1) ... 356s Selecting previously unselected package x11-common. 356s Preparing to unpack .../19-x11-common_1%3a7.7+24ubuntu1_all.deb ... 356s Unpacking x11-common (1:7.7+24ubuntu1) ... 356s Selecting previously unselected package libice6:arm64. 356s Preparing to unpack .../20-libice6_2%3a1.1.1-1build1_arm64.deb ... 356s Unpacking libice6:arm64 (2:1.1.1-1build1) ... 356s Selecting previously unselected package libjpeg-turbo8:arm64. 356s Preparing to unpack .../21-libjpeg-turbo8_2.1.5-4ubuntu3_arm64.deb ... 356s Unpacking libjpeg-turbo8:arm64 (2.1.5-4ubuntu3) ... 356s Selecting previously unselected package libjpeg8:arm64. 356s Preparing to unpack .../22-libjpeg8_8c-2ubuntu11_arm64.deb ... 356s Unpacking libjpeg8:arm64 (8c-2ubuntu11) ... 356s Selecting previously unselected package libjs-bootstrap. 356s Preparing to unpack .../23-libjs-bootstrap_3.4.1+dfsg-6_all.deb ... 356s Unpacking libjs-bootstrap (3.4.1+dfsg-6) ... 356s Selecting previously unselected package libjs-highlight.js. 356s Preparing to unpack .../24-libjs-highlight.js_10.7.3+dfsg-2_all.deb ... 356s Unpacking libjs-highlight.js (10.7.3+dfsg-2) ... 356s Selecting previously unselected package libjs-jquery. 356s Preparing to unpack .../25-libjs-jquery_3.7.1+dfsg+~3.5.33-1build1_all.deb ... 356s Unpacking libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 356s Selecting previously unselected package libjs-jquery-datatables. 356s Preparing to unpack .../26-libjs-jquery-datatables_1.11.5+dfsg-2build1_all.deb ... 356s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 356s Selecting previously unselected package liblapack3:arm64. 356s Preparing to unpack .../27-liblapack3_3.12.1-7ubuntu1_arm64.deb ... 356s Unpacking liblapack3:arm64 (3.12.1-7ubuntu1) ... 356s Selecting previously unselected package liblerc4:arm64. 356s Preparing to unpack .../28-liblerc4_4.0.0+ds-5ubuntu2_arm64.deb ... 356s Unpacking liblerc4:arm64 (4.0.0+ds-5ubuntu2) ... 356s Selecting previously unselected package libthai-data. 356s Preparing to unpack .../29-libthai-data_0.1.30-1_all.deb ... 356s Unpacking libthai-data (0.1.30-1) ... 356s Selecting previously unselected package libthai0:arm64. 356s Preparing to unpack .../30-libthai0_0.1.30-1_arm64.deb ... 356s Unpacking libthai0:arm64 (0.1.30-1) ... 356s Selecting previously unselected package libpango-1.0-0:arm64. 356s Preparing to unpack .../31-libpango-1.0-0_1.57.0-1_arm64.deb ... 356s Unpacking libpango-1.0-0:arm64 (1.57.0-1) ... 356s Selecting previously unselected package libpangoft2-1.0-0:arm64. 356s Preparing to unpack .../32-libpangoft2-1.0-0_1.57.0-1_arm64.deb ... 356s Unpacking libpangoft2-1.0-0:arm64 (1.57.0-1) ... 356s Selecting previously unselected package libpangocairo-1.0-0:arm64. 356s Preparing to unpack .../33-libpangocairo-1.0-0_1.57.0-1_arm64.deb ... 356s Unpacking libpangocairo-1.0-0:arm64 (1.57.0-1) ... 356s Selecting previously unselected package libpaper2:arm64. 356s Preparing to unpack .../34-libpaper2_2.2.5-0.3build1_arm64.deb ... 356s Unpacking libpaper2:arm64 (2.2.5-0.3build1) ... 357s Selecting previously unselected package libpaper-utils. 357s Preparing to unpack .../35-libpaper-utils_2.2.5-0.3build1_arm64.deb ... 357s Unpacking libpaper-utils (2.2.5-0.3build1) ... 357s Selecting previously unselected package libsharpyuv0:arm64. 357s Preparing to unpack .../36-libsharpyuv0_1.5.0-0.1build1_arm64.deb ... 357s Unpacking libsharpyuv0:arm64 (1.5.0-0.1build1) ... 357s Selecting previously unselected package libsm6:arm64. 357s Preparing to unpack .../37-libsm6_2%3a1.2.6-1build1_arm64.deb ... 357s Unpacking libsm6:arm64 (2:1.2.6-1build1) ... 357s Selecting previously unselected package libtcl8.6:arm64. 357s Preparing to unpack .../38-libtcl8.6_8.6.17+dfsg-1build1_arm64.deb ... 357s Unpacking libtcl8.6:arm64 (8.6.17+dfsg-1build1) ... 357s Selecting previously unselected package libjbig0:arm64. 357s Preparing to unpack .../39-libjbig0_2.1-6.1ubuntu3_arm64.deb ... 357s Unpacking libjbig0:arm64 (2.1-6.1ubuntu3) ... 357s Selecting previously unselected package libwebp7:arm64. 357s Preparing to unpack .../40-libwebp7_1.5.0-0.1build1_arm64.deb ... 357s Unpacking libwebp7:arm64 (1.5.0-0.1build1) ... 357s Selecting previously unselected package libtiff6:arm64. 357s Preparing to unpack .../41-libtiff6_4.7.0-3ubuntu3_arm64.deb ... 357s Unpacking libtiff6:arm64 (4.7.0-3ubuntu3) ... 357s Selecting previously unselected package libxft2:arm64. 357s Preparing to unpack .../42-libxft2_2.3.6-1build2_arm64.deb ... 357s Unpacking libxft2:arm64 (2.3.6-1build2) ... 357s Selecting previously unselected package libxss1:arm64. 357s Preparing to unpack .../43-libxss1_1%3a1.2.3-1build4_arm64.deb ... 357s Unpacking libxss1:arm64 (1:1.2.3-1build4) ... 357s Selecting previously unselected package libtk8.6:arm64. 357s Preparing to unpack .../44-libtk8.6_8.6.17-1_arm64.deb ... 357s Unpacking libtk8.6:arm64 (8.6.17-1) ... 357s Selecting previously unselected package libxt6t64:arm64. 357s Preparing to unpack .../45-libxt6t64_1%3a1.2.1-1.3_arm64.deb ... 357s Unpacking libxt6t64:arm64 (1:1.2.1-1.3) ... 357s Selecting previously unselected package node-normalize.css. 357s Preparing to unpack .../46-node-normalize.css_8.0.1-5.1_all.deb ... 357s Unpacking node-normalize.css (8.0.1-5.1) ... 357s Selecting previously unselected package zip. 357s Preparing to unpack .../47-zip_3.0-15ubuntu3_arm64.deb ... 357s Unpacking zip (3.0-15ubuntu3) ... 357s Selecting previously unselected package unzip. 357s Preparing to unpack .../48-unzip_6.0-29ubuntu1_arm64.deb ... 357s Unpacking unzip (6.0-29ubuntu1) ... 357s Selecting previously unselected package xdg-utils. 357s Preparing to unpack .../49-xdg-utils_1.2.1-2ubuntu2_all.deb ... 357s Unpacking xdg-utils (1.2.1-2ubuntu2) ... 357s Selecting previously unselected package r-base-core. 357s Preparing to unpack .../50-r-base-core_4.5.2-1ubuntu2_arm64.deb ... 357s Unpacking r-base-core (4.5.2-1ubuntu2) ... 357s Selecting previously unselected package r-cran-base64enc. 357s Preparing to unpack .../51-r-cran-base64enc_0.1-3-3build1_arm64.deb ... 357s Unpacking r-cran-base64enc (0.1-3-3build1) ... 358s Selecting previously unselected package r-cran-cli. 358s Preparing to unpack .../52-r-cran-cli_3.6.4-1_arm64.deb ... 358s Unpacking r-cran-cli (3.6.4-1) ... 358s Selecting previously unselected package r-cran-commonmark. 358s Preparing to unpack .../53-r-cran-commonmark_1.9.5-1_arm64.deb ... 358s Unpacking r-cran-commonmark (1.9.5-1) ... 358s Selecting previously unselected package r-cran-digest. 358s Preparing to unpack .../54-r-cran-digest_0.6.39-1_arm64.deb ... 358s Unpacking r-cran-digest (0.6.39-1) ... 358s Selecting previously unselected package r-cran-evaluate. 358s Preparing to unpack .../55-r-cran-evaluate_1.0.5-1_all.deb ... 358s Unpacking r-cran-evaluate (1.0.5-1) ... 358s Selecting previously unselected package r-cran-farver. 358s Preparing to unpack .../56-r-cran-farver_2.1.2-1_arm64.deb ... 358s Unpacking r-cran-farver (2.1.2-1) ... 358s Selecting previously unselected package r-cran-glue. 358s Preparing to unpack .../57-r-cran-glue_1.8.0-1_arm64.deb ... 358s Unpacking r-cran-glue (1.8.0-1) ... 358s Selecting previously unselected package r-cran-rlang. 358s Preparing to unpack .../58-r-cran-rlang_1.1.5-3_arm64.deb ... 358s Unpacking r-cran-rlang (1.1.5-3) ... 358s Selecting previously unselected package r-cran-lifecycle. 358s Preparing to unpack .../59-r-cran-lifecycle_1.0.5+dfsg-1_all.deb ... 358s Unpacking r-cran-lifecycle (1.0.5+dfsg-1) ... 358s Selecting previously unselected package r-cran-gtable. 358s Preparing to unpack .../60-r-cran-gtable_0.3.6+dfsg-1_all.deb ... 358s Unpacking r-cran-gtable (0.3.6+dfsg-1) ... 358s Selecting previously unselected package r-cran-isoband. 358s Preparing to unpack .../61-r-cran-isoband_0.2.7-1_arm64.deb ... 358s Unpacking r-cran-isoband (0.2.7-1) ... 358s Selecting previously unselected package r-cran-s7. 358s Preparing to unpack .../62-r-cran-s7_0.2.0-1_arm64.deb ... 358s Unpacking r-cran-s7 (0.2.0-1) ... 358s Selecting previously unselected package r-cran-labeling. 358s Preparing to unpack .../63-r-cran-labeling_0.4.3-1_all.deb ... 358s Unpacking r-cran-labeling (0.4.3-1) ... 358s Selecting previously unselected package r-cran-r6. 358s Preparing to unpack .../64-r-cran-r6_2.6.1-1_all.deb ... 358s Unpacking r-cran-r6 (2.6.1-1) ... 358s Selecting previously unselected package r-cran-rcolorbrewer. 358s Preparing to unpack .../65-r-cran-rcolorbrewer_1.1-3-1build2_all.deb ... 358s Unpacking r-cran-rcolorbrewer (1.1-3-1build2) ... 358s Selecting previously unselected package r-cran-viridislite. 358s Preparing to unpack .../66-r-cran-viridislite_0.4.3-1_all.deb ... 358s Unpacking r-cran-viridislite (0.4.3-1) ... 358s Selecting previously unselected package r-cran-scales. 358s Preparing to unpack .../67-r-cran-scales_1.4.0-1_all.deb ... 358s Unpacking r-cran-scales (1.4.0-1) ... 358s Selecting previously unselected package r-cran-vctrs. 358s Preparing to unpack .../68-r-cran-vctrs_0.6.5-1_arm64.deb ... 358s Unpacking r-cran-vctrs (0.6.5-1) ... 358s Selecting previously unselected package r-cran-withr. 358s Preparing to unpack .../69-r-cran-withr_3.0.2+dfsg-1_all.deb ... 358s Unpacking r-cran-withr (3.0.2+dfsg-1) ... 358s Selecting previously unselected package r-cran-ggplot2. 358s Preparing to unpack .../70-r-cran-ggplot2_4.0.2+dfsg-1_all.deb ... 358s Unpacking r-cran-ggplot2 (4.0.2+dfsg-1) ... 358s Selecting previously unselected package r-cran-xfun. 359s Preparing to unpack .../71-r-cran-xfun_0.55+dfsg-1_arm64.deb ... 359s Unpacking r-cran-xfun (0.55+dfsg-1) ... 359s Selecting previously unselected package r-cran-highr. 359s Preparing to unpack .../72-r-cran-highr_0.11+dfsg-1_all.deb ... 359s Unpacking r-cran-highr (0.11+dfsg-1) ... 359s Selecting previously unselected package r-cran-yaml. 359s Preparing to unpack .../73-r-cran-yaml_2.3.10-1_arm64.deb ... 359s Unpacking r-cran-yaml (2.3.10-1) ... 359s Selecting previously unselected package libjs-mathjax. 359s Preparing to unpack .../74-libjs-mathjax_2.7.9+dfsg-1build1_all.deb ... 359s Unpacking libjs-mathjax (2.7.9+dfsg-1build1) ... 359s Selecting previously unselected package r-cran-knitr. 359s Preparing to unpack .../75-r-cran-knitr_1.51+dfsg-1_all.deb ... 359s Unpacking r-cran-knitr (1.51+dfsg-1) ... 359s Selecting previously unselected package r-cran-markdown. 359s Preparing to unpack .../76-r-cran-markdown_1.13-1_all.deb ... 359s Unpacking r-cran-markdown (1.13-1) ... 359s Selecting previously unselected package r-cran-matrixstats. 359s Preparing to unpack .../77-r-cran-matrixstats_1.5.0-1_arm64.deb ... 359s Unpacking r-cran-matrixstats (1.5.0-1) ... 359s Selecting previously unselected package r-cran-microbenchmark. 359s Preparing to unpack .../78-r-cran-microbenchmark_1.5.0-1_arm64.deb ... 359s Unpacking r-cran-microbenchmark (1.5.0-1) ... 359s Selecting previously unselected package r-cran-r.methodss3. 359s Preparing to unpack .../79-r-cran-r.methodss3_1.8.2-1_all.deb ... 359s Unpacking r-cran-r.methodss3 (1.8.2-1) ... 359s Selecting previously unselected package r-cran-r.oo. 359s Preparing to unpack .../80-r-cran-r.oo_1.27.1-1_all.deb ... 359s Unpacking r-cran-r.oo (1.27.1-1) ... 359s Selecting previously unselected package r-cran-r.utils. 359s Preparing to unpack .../81-r-cran-r.utils_2.13.0-1_all.deb ... 359s Unpacking r-cran-r.utils (2.13.0-1) ... 359s Selecting previously unselected package r-cran-r.cache. 359s Preparing to unpack .../82-r-cran-r.cache_0.17.0-1_all.deb ... 359s Unpacking r-cran-r.cache (0.17.0-1) ... 359s Selecting previously unselected package r-cran-r.devices. 359s Preparing to unpack .../83-r-cran-r.devices_2.17.3+ds-1_all.deb ... 359s Unpacking r-cran-r.devices (2.17.3+ds-1) ... 359s Selecting previously unselected package tcl8.6. 359s Preparing to unpack .../84-tcl8.6_8.6.17+dfsg-1build1_arm64.deb ... 359s Unpacking tcl8.6 (8.6.17+dfsg-1build1) ... 360s Selecting previously unselected package tcl. 360s Preparing to unpack .../85-tcl_8.6.16build1_arm64.deb ... 360s Unpacking tcl (8.6.16build1) ... 360s Selecting previously unselected package r-cran-r.rsp. 360s Preparing to unpack .../86-r-cran-r.rsp_0.46.0+ds-1_all.deb ... 360s Unpacking r-cran-r.rsp (0.46.0+ds-1) ... 360s Setting up libgraphite2-3:arm64 (1.3.14-11ubuntu1) ... 360s Setting up libpixman-1-0:arm64 (0.46.4-1) ... 360s Setting up libsharpyuv0:arm64 (1.5.0-0.1build1) ... 360s Setting up fonts-mathjax (2.7.9+dfsg-1build1) ... 360s Setting up liblerc4:arm64 (4.0.0+ds-5ubuntu2) ... 360s Setting up libjs-mathjax (2.7.9+dfsg-1build1) ... 360s Setting up libxrender1:arm64 (1:0.9.12-1) ... 360s Setting up libdatrie1:arm64 (0.2.14-1) ... 360s Setting up libxcb-render0:arm64 (1.17.0-2ubuntu1) ... 360s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 360s Setting up unzip (6.0-29ubuntu1) ... 360s Setting up x11-common (1:7.7+24ubuntu1) ... 360s Setting up libdeflate0:arm64 (1.23-2build1) ... 360s Setting up libxcb-shm0:arm64 (1.17.0-2ubuntu1) ... 360s Setting up libgomp1:arm64 (15.2.0-12ubuntu1) ... 360s Setting up libjbig0:arm64 (2.1-6.1ubuntu3) ... 360s Setting up zip (3.0-15ubuntu3) ... 360s Setting up libblas3:arm64 (3.12.1-7ubuntu1) ... 360s 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 360s Setting up fonts-dejavu-mono (2.37-8build1) ... 360s Setting up libtcl8.6:arm64 (8.6.17+dfsg-1build1) ... 360s Setting up fonts-dejavu-core (2.37-8build1) ... 360s Setting up libjpeg-turbo8:arm64 (2.1.5-4ubuntu3) ... 360s Setting up libgfortran5:arm64 (15.2.0-12ubuntu1) ... 360s Setting up libwebp7:arm64 (1.5.0-0.1build1) ... 360s Setting up libjs-highlight.js (10.7.3+dfsg-2) ... 360s Setting up libharfbuzz0b:arm64 (12.3.2-1) ... 360s Setting up libthai-data (0.1.30-1) ... 360s Setting up libxss1:arm64 (1:1.2.3-1build4) ... 360s Setting up libpaper2:arm64 (2.2.5-0.3build1) ... 360s Setting up libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 360s Setting up node-normalize.css (8.0.1-5.1) ... 360s Setting up xdg-utils (1.2.1-2ubuntu2) ... 360s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 360s Setting up libjs-bootstrap (3.4.1+dfsg-6) ... 360s Setting up libjpeg8:arm64 (8c-2ubuntu11) ... 360s Setting up libice6:arm64 (2:1.1.1-1build1) ... 360s Setting up tcl8.6 (8.6.17+dfsg-1build1) ... 360s Setting up liblapack3:arm64 (3.12.1-7ubuntu1) ... 360s 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 360s Setting up fontconfig-config (2.17.1-3ubuntu1) ... 360s Setting up libpaper-utils (2.2.5-0.3build1) ... 360s Setting up libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 360s Setting up libthai0:arm64 (0.1.30-1) ... 360s Setting up libtiff6:arm64 (4.7.0-3ubuntu3) ... 360s Setting up tcl (8.6.16build1) ... 360s Setting up libfontconfig1:arm64 (2.17.1-3ubuntu1) ... 360s Setting up libsm6:arm64 (2:1.2.6-1build1) ... 360s Setting up fontconfig (2.17.1-3ubuntu1) ... 363s Regenerating fonts cache... done. 363s Setting up libxft2:arm64 (2.3.6-1build2) ... 363s Setting up libtk8.6:arm64 (8.6.17-1) ... 363s Setting up libpango-1.0-0:arm64 (1.57.0-1) ... 363s Setting up libcairo2:arm64 (1.18.4-3) ... 363s Setting up libxt6t64:arm64 (1:1.2.1-1.3) ... 363s Setting up libpangoft2-1.0-0:arm64 (1.57.0-1) ... 363s Setting up libpangocairo-1.0-0:arm64 (1.57.0-1) ... 363s Setting up r-base-core (4.5.2-1ubuntu2) ... 363s Creating config file /etc/R/Renviron with new version 363s Setting up r-cran-labeling (0.4.3-1) ... 363s Setting up r-cran-farver (2.1.2-1) ... 363s Setting up r-cran-viridislite (0.4.3-1) ... 363s Setting up r-cran-commonmark (1.9.5-1) ... 363s Setting up r-cran-r6 (2.6.1-1) ... 363s Setting up r-cran-microbenchmark (1.5.0-1) ... 363s Setting up r-cran-rlang (1.1.5-3) ... 363s Setting up r-cran-matrixstats (1.5.0-1) ... 363s Setting up r-cran-xfun (0.55+dfsg-1) ... 363s Setting up r-cran-withr (3.0.2+dfsg-1) ... 363s Setting up r-cran-base64enc (0.1-3-3build1) ... 363s Setting up r-cran-digest (0.6.39-1) ... 363s Setting up r-cran-yaml (2.3.10-1) ... 363s Setting up r-cran-evaluate (1.0.5-1) ... 363s Setting up r-cran-highr (0.11+dfsg-1) ... 363s Setting up r-cran-glue (1.8.0-1) ... 363s Setting up r-cran-cli (3.6.4-1) ... 363s Setting up r-cran-lifecycle (1.0.5+dfsg-1) ... 363s Setting up r-cran-r.methodss3 (1.8.2-1) ... 363s Setting up r-cran-markdown (1.13-1) ... 363s Setting up r-cran-s7 (0.2.0-1) ... 363s Setting up r-cran-rcolorbrewer (1.1-3-1build2) ... 363s Setting up r-cran-isoband (0.2.7-1) ... 363s Setting up r-cran-scales (1.4.0-1) ... 363s Setting up r-cran-gtable (0.3.6+dfsg-1) ... 363s Setting up r-cran-knitr (1.51+dfsg-1) ... 363s Setting up r-cran-vctrs (0.6.5-1) ... 363s Setting up r-cran-ggplot2 (4.0.2+dfsg-1) ... 363s Setting up r-cran-r.oo (1.27.1-1) ... 363s Setting up r-cran-r.utils (2.13.0-1) ... 363s Setting up r-cran-r.devices (2.17.3+ds-1) ... 363s Setting up r-cran-r.cache (0.17.0-1) ... 363s Setting up r-cran-r.rsp (0.46.0+ds-1) ... 363s Processing triggers for libc-bin (2.42-2ubuntu4) ... 363s Processing triggers for man-db (2.13.1-1build1) ... 363s Processing triggers for install-info (7.2-5) ... 364s autopkgtest [23:59:29]: test run-unit-test: [----------------------- 365s 365s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 365s Copyright (C) 2025 The R Foundation for Statistical Computing 365s Platform: aarch64-unknown-linux-gnu 365s 365s R is free software and comes with ABSOLUTELY NO WARRANTY. 365s You are welcome to redistribute it under certain conditions. 365s Type 'license()' or 'licence()' for distribution details. 365s 365s R is a collaborative project with many contributors. 365s Type 'contributors()' for more information and 365s 'citation()' on how to cite R or R packages in publications. 365s 365s Type 'demo()' for some demos, 'help()' for on-line help, or 365s 'help.start()' for an HTML browser interface to help. 365s Type 'q()' to quit R. 365s 365s > library("matrixStats") 365s > 365s > allocArray_R <- function(nrow, ncol, value = NA) { 365s + array(data = value, dim = dim) 365s + } 365s > 365s > values <- list( 365s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 365s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 365s + .Machine$double.xmin, .Machine$double.xmax, 365s + .Machine$double.eps, .Machine$double.neg.eps, 365s + FALSE, TRUE, NA 365s + ) 365s > 365s > dim <- c(2L, 4L, 3L) 365s > for (value in values) { 365s + x0 <- allocArray_R(dim, value = value) 365s + x <- allocArray(dim, value = value) 365s + if (!identical(x, x0)) { 365s + str(list(dim = dim, value = value, x = x, x0 = x0)) 365s + stopifnot(identical(x, x0)) 365s + } 365s + } 365s > 365s 365s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 365s Copyright (C) 2025 The R Foundation for Statistical Computing 365s Platform: aarch64-unknown-linux-gnu 365s 365s R is free software and comes with ABSOLUTELY NO WARRANTY. 365s You are welcome to redistribute it under certain conditions. 365s Type 'license()' or 'licence()' for distribution details. 365s 365s R is a collaborative project with many contributors. 365s Type 'contributors()' for more information and 365s 'citation()' on how to cite R or R packages in publications. 365s 365s Type 'demo()' for some demos, 'help()' for on-line help, or 365s 'help.start()' for an HTML browser interface to help. 365s Type 'q()' to quit R. 365s 365s > library("matrixStats") 365s > 365s > allocMatrix_R <- function(nrow, ncol, value = NA) { 365s + matrix(data = value, nrow = nrow, ncol = ncol) 365s + } 365s > 365s > values <- list( 365s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 365s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 365s + .Machine$double.xmin, .Machine$double.xmax, 365s + .Machine$double.eps, .Machine$double.neg.eps, 365s + FALSE, TRUE, NA 365s + ) 365s > 365s > nrow <- 2L 365s > ncol <- 3L 365s > for (value in values) { 365s + x0 <- allocMatrix_R(nrow, ncol, value = value) 365s + x <- allocMatrix(nrow, ncol, value = value) 365s + if (!identical(x, x0)) { 365s + str(list(nrow = nrow, ncol = ncol, value = value, x = x, x0 = x0)) 365s + stopifnot(identical(x, x0)) 365s + } 365s + } 365s > 365s 365s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 365s Copyright (C) 2025 The R Foundation for Statistical Computing 365s Platform: aarch64-unknown-linux-gnu 365s 365s R is free software and comes with ABSOLUTELY NO WARRANTY. 365s You are welcome to redistribute it under certain conditions. 365s Type 'license()' or 'licence()' for distribution details. 365s 365s R is a collaborative project with many contributors. 365s Type 'contributors()' for more information and 365s 'citation()' on how to cite R or R packages in publications. 365s 365s Type 'demo()' for some demos, 'help()' for on-line help, or 365s 'help.start()' for an HTML browser interface to help. 365s Type 'q()' to quit R. 365s 365s > library("matrixStats") 365s > 365s > allocVector_R <- function(length, value = NA) { 365s + x <- vector(mode = typeof(value), length = length) 365s + if (!is.finite(value) || value != 0) x[] <- value 365s + x 365s + } 365s > 365s > values <- list( 365s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 365s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 365s + .Machine$double.xmin, .Machine$double.xmax, 365s + .Machine$double.eps, .Machine$double.neg.eps, 365s + FALSE, TRUE, NA 365s + ) 365s > 365s > n <- 10L 365s > for (value in values) { 365s + x0 <- allocVector_R(n, value = value) 365s + x <- allocVector(n, value = value) 365s + if (!identical(x, x0)) { 365s + str(list(n = n, value = value, x = x, x0 = x0)) 365s + stopifnot(identical(x, x0)) 365s + } 365s + } 365s > 365s 365s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 365s Copyright (C) 2025 The R Foundation for Statistical Computing 365s Platform: aarch64-unknown-linux-gnu 365s 365s R is free software and comes with ABSOLUTELY NO WARRANTY. 365s You are welcome to redistribute it under certain conditions. 365s Type 'license()' or 'licence()' for distribution details. 365s 365s R is a collaborative project with many contributors. 365s Type 'contributors()' for more information and 365s 'citation()' on how to cite R or R packages in publications. 365s 365s Type 'demo()' for some demos, 'help()' for on-line help, or 365s 'help.start()' for an HTML browser interface to help. 365s Type 'q()' to quit R. 365s 365s > library("matrixStats") 365s > 365s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 365s > # Setup 365s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 365s > data <- data.frame( 365s + logical = c(TRUE, FALSE, TRUE), 365s + integer = 1:3, 365s + double = seq(from = 1.0, to = 3.0, by = 1.0), 365s + complex = seq(from = 1.0, to = 3.0, by = 1.0) + 1.0i, 365s + character = letters[1:3], 365s + stringsAsFactors = FALSE 365s + ) 365s > 365s > modes <- names(data) 365s > 365s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 365s > # Special cases 365s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 365s > cat("NULL...\n") 365s NULL... 365s > stopifnot(identical(anyMissing(NULL), FALSE)) 365s > cat("NULL...done\n") 365s NULL...done 365s > 365s > cat("raw...\n") 365s raw... 365s > stopifnot(identical(anyMissing(as.raw(0:2)), FALSE)) 365s > cat("raw...done\n") 365s raw...done 365s > 365s > cat("list(NULL)...\n") 365s list(NULL)... 365s > stopifnot(identical(anyMissing(list(NULL)), FALSE)) 365s > cat("list(NULL)...done\n") 365s list(NULL)...done 365s > 365s > 365s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 365s > # Scalars, vectors, and matrices of various modes 365s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 365s > for (mode in modes) { 365s + cat(sprintf("Mode: %s...\n", mode)) 365s + values <- data[[mode]] 365s + 365s + # Scalars 365s + cat(" scalar\n") 365s + x <- values[1L] 365s + print(x) 365s + stopifnot(identical(anyMissing(x), FALSE)) 365s + is.na(x) <- TRUE 365s + print(x) 365s + stopifnot(identical(anyMissing(x), TRUE)) 365s + 365s + # Vectors 365s + cat(" vector\n") 365s + x <- values 365s + print(x) 365s + stopifnot(identical(anyMissing(x), FALSE)) 365s + is.na(x)[2L] <- TRUE 365s + print(x) 365s + stopifnot(identical(anyMissing(x), TRUE)) 365s + 365s + # Matrices 365s + cat(" matrix\n") 365s + x <- matrix(c(values, values), ncol = 2L) 365s + print(x) 365s + stopifnot(identical(anyMissing(x), FALSE)) 365s + is.na(x)[2L] <- TRUE 365s + print(x) 365s + stopifnot(identical(anyMissing(x), TRUE)) 365s + 365s + cat(sprintf("Mode: %s...done\n", mode)) 365s + } # for (mode ...) 366s Mode: logical... 366s scalar 366s [1] TRUE 366s [1] NA 366s vector 366s [1] TRUE FALSE TRUE 366s [1] TRUE NA TRUE 366s matrix 366s [,1] [,2] 366s [1,] TRUE TRUE 366s [2,] FALSE FALSE 366s [3,] TRUE TRUE 366s [,1] [,2] 366s [1,] TRUE TRUE 366s [2,] NA FALSE 366s [3,] TRUE TRUE 366s Mode: logical...done 366s Mode: integer... 366s scalar 366s [1] 1 366s [1] NA 366s vector 366s [1] 1 2 3 366s [1] 1 NA 3 366s matrix 366s [,1] [,2] 366s [1,] 1 1 366s [2,] 2 2 366s [3,] 3 3 366s [,1] [,2] 366s [1,] 1 1 366s [2,] NA 2 366s [3,] 3 3 366s Mode: integer...done 366s Mode: double... 366s scalar 366s [1] 1 366s [1] NA 366s vector 366s [1] 1 2 3 366s [1] 1 NA 3 366s matrix 366s [,1] [,2] 366s [1,] 1 1 366s [2,] 2 2 366s [3,] 3 3 366s [,1] [,2] 366s [1,] 1 1 366s [2,] NA 2 366s [3,] 3 3 366s Mode: double...done 366s Mode: complex... 366s scalar 366s [1] 1+1i 366s [1] NA 366s vector 366s [1] 1+1i 2+1i 3+1i 366s [1] 1+1i NA 3+1i 366s matrix 366s [,1] [,2] 366s [1,] 1+1i 1+1i 366s [2,] 2+1i 2+1i 366s [3,] 3+1i 3+1i 366s [,1] [,2] 366s [1,] 1+1i 1+1i 366s [2,] NA 2+1i 366s [3,] 3+1i 3+1i 366s Mode: complex...done 366s Mode: character... 366s scalar 366s [1] "a" 366s [1] NA 366s vector 366s [1] "a" "b" "c" 366s [1] "a" NA "c" 366s matrix 366s [,1] [,2] 366s [1,] "a" "a" 366s [2,] "b" "b" 366s [3,] "c" "c" 366s [,1] [,2] 366s [1,] "a" "a" 366s [2,] NA "b" 366s [3,] "c" "c" 366s Mode: character...done 366s > 366s > 366s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 366s > # Data frames 366s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 366s > cat("data.frame...\n") 366s data.frame... 366s > x <- data 366s > stopifnot(identical(anyMissing(x), FALSE)) 366s > for (mode in modes) { 366s + x <- data 366s + is.na(x[[mode]])[2L] <- TRUE 366s + print(x) 366s + stopifnot(identical(anyMissing(x), TRUE)) 366s + } # for (mode ...) 366s logical integer double complex character 366s 1 TRUE 1 1 1+1i a 366s 2 NA 2 2 2+1i b 366s 3 TRUE 3 3 3+1i c 366s logical integer double complex character 366s 1 TRUE 1 1 1+1i a 366s 2 FALSE NA 2 2+1i b 366s 3 TRUE 3 3 3+1i c 366s logical integer double complex character 366s 1 TRUE 1 1 1+1i a 366s 2 FALSE 2 NA 2+1i b 366s 3 TRUE 3 3 3+1i c 366s logical integer double complex character 366s 1 TRUE 1 1 1+1i a 366s 2 FALSE 2 2 NA b 366s 3 TRUE 3 3 3+1i c 366s logical integer double complex character 366s 1 TRUE 1 1 1+1i a 366s 2 FALSE 2 2 2+1i 366s 3 TRUE 3 3 3+1i c 366s > cat("data.frame...done\n") 366s data.frame...done 366s > 366s > 366s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 366s > # Lists 366s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 366s > cat("list...\n") 366s list... 366s > x <- as.list(data) 366s > stopifnot(identical(anyMissing(x), FALSE)) 366s > for (mode in modes) { 366s + x <- as.list(data) 366s + is.na(x[[mode]])[2L] <- TRUE 366s + print(x) 366s + stopifnot(identical(anyMissing(x), TRUE)) 366s + } # for (mode ...) 366s $logical 366s [1] TRUE NA TRUE 366s 366s $integer 366s [1] 1 2 3 366s 366s $double 366s [1] 1 2 3 366s 366s $complex 366s [1] 1+1i 2+1i 3+1i 366s 366s $character 366s [1] "a" "b" "c" 366s 366s $logical 366s [1] TRUE FALSE TRUE 366s 366s $integer 366s [1] 1 NA 3 366s 366s $double 366s [1] 1 2 3 366s 366s $complex 366s [1] 1+1i 2+1i 3+1i 366s 366s $character 366s [1] "a" "b" "c" 366s 366s $logical 366s [1] TRUE FALSE TRUE 366s 366s $integer 366s [1] 1 2 3 366s 366s $double 366s [1] 1 NA 3 366s 366s $complex 366s [1] 1+1i 2+1i 3+1i 366s 366s $character 366s [1] "a" "b" "c" 366s 366s $logical 366s [1] TRUE FALSE TRUE 366s 366s $integer 366s [1] 1 2 3 366s 366s $double 366s [1] 1 2 3 366s 366s $complex 366s [1] 1+1i NA 3+1i 366s 366s $character 366s [1] "a" "b" "c" 366s 366s $logical 366s [1] TRUE FALSE TRUE 366s 366s $integer 366s [1] 1 2 3 366s 366s $double 366s [1] 1 2 3 366s 366s $complex 366s [1] 1+1i 2+1i 3+1i 366s 366s $character 366s [1] "a" NA "c" 366s 366s > cat("list...done\n") 366s list...done 366s > 366s 366s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 366s Copyright (C) 2025 The R Foundation for Statistical Computing 366s Platform: aarch64-unknown-linux-gnu 366s 366s R is free software and comes with ABSOLUTELY NO WARRANTY. 366s You are welcome to redistribute it under certain conditions. 366s Type 'license()' or 'licence()' for distribution details. 366s 366s R is a collaborative project with many contributors. 366s Type 'contributors()' for more information and 366s 'citation()' on how to cite R or R packages in publications. 366s 366s Type 'demo()' for some demos, 'help()' for on-line help, or 366s 'help.start()' for an HTML browser interface to help. 366s Type 'q()' to quit R. 366s 366s > library("matrixStats") 366s > 366s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 366s > # Subsetted tests 366s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 366s > source("utils/validateIndicesFramework.R") 366s > x <- runif(4, min = -3, max = 3) 366s > x[2] <- NA 366s > for (mode in c("integer", "numeric")) { 366s + storage.mode(x) <- mode 366s + for (idxs in index_cases) { 366s + validateIndicesTestVector(x, idxs, 366s + ftest = anyMissing, fsure = function(x, ...) { 366s + anyValue(x, value = NA) 366s + }) 366s + } 366s + } 366s > 366s 366s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 366s Copyright (C) 2025 The R Foundation for Statistical Computing 366s Platform: aarch64-unknown-linux-gnu 366s 366s R is free software and comes with ABSOLUTELY NO WARRANTY. 366s You are welcome to redistribute it under certain conditions. 366s Type 'license()' or 'licence()' for distribution details. 366s 366s R is a collaborative project with many contributors. 366s Type 'contributors()' for more information and 366s 'citation()' on how to cite R or R packages in publications. 366s 366s Type 'demo()' for some demos, 'help()' for on-line help, or 366s 'help.start()' for an HTML browser interface to help. 366s Type 'q()' to quit R. 366s 366s > ## Don't test with valgrind 366s > if (Sys.getenv("_R_CHECK_USE_VALGRIND_") == "") { 366s + 366s + ## 3. Make sure all suggested packages are installed / can be loaded 366s + pkgs <- c("base64enc", "ggplot2", "knitr", "markdown", "microbenchmark", 366s + "R.devices", "R.rsp") 366s + if (all(unlist(lapply(pkgs, FUN = requireNamespace)))) { 366s + html <- matrixStats:::benchmark("binCounts") 366s + print(html) 366s + } 366s + 366s + rm(list = "pkgs") 366s + 366s + } 366s Loading required namespace: base64enc 366s Loading required namespace: ggplot2 367s Loading required namespace: knitr 367s Loading required namespace: markdown 367s Loading required namespace: microbenchmark 367s Loading required namespace: R.devices 367s Loading required namespace: R.rsp 368s integer: unsorted 370s integer: sorted 372s double: unsorted 374s double: sorted 376s RspFileProduct: 376s Pathname: /tmp/autopkgtest.Tyjfz4/autopkgtest_tmp/reports/binCounts.html 376s File size: 72.62 kB (74358 bytes) 376s Content type: text/html 376s Metadata 'author': 'Henrik Bengtsson' 376s Metadata 'title': 'binCounts() benchmarks' 376s Metadata 'date': '2014-05-25' 376s Has processor: FALSE 376s Warning message: 376s In par(parT) : argument 1 does not name a graphical parameter 376s > 376s 376s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 376s Copyright (C) 2025 The R Foundation for Statistical Computing 376s Platform: aarch64-unknown-linux-gnu 376s 376s R is free software and comes with ABSOLUTELY NO WARRANTY. 376s You are welcome to redistribute it under certain conditions. 376s Type 'license()' or 'licence()' for distribution details. 376s 376s R is a collaborative project with many contributors. 376s Type 'contributors()' for more information and 376s 'citation()' on how to cite R or R packages in publications. 376s 376s Type 'demo()' for some demos, 'help()' for on-line help, or 376s 'help.start()' for an HTML browser interface to help. 376s Type 'q()' to quit R. 376s 376s > library("matrixStats") 376s > library("stats") 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Local functions 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 376s + n0 <- graphics::hist(x, breaks = bx, right = right, 376s + include.lowest = TRUE, plot = FALSE)$counts 376s + } 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Non-sorted and sorted positions 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > nx <- 1000L # Number of data points 376s > nb <- 200L # Number of bins 376s > 376s > # Uniformely distributed bins 376s > bx <- seq(from = 0, to = 1, length.out = nb + 1L) 376s > bx <- c(-1, bx, 2) 376s > 376s > # Sample data points 376s > set.seed(0xBEEF) 376s > x <- runif(nx, min = 0, max = 1) 376s > 376s > for (kk in 1:2) { 376s + n0 <- binCounts_hist(x, bx = bx) 376s + n1 <- binCounts(x, bx = bx) 376s + # Sanity check 376s + stopifnot(identical(n1, n0)) 376s + 376s + # Check reversed 376s + n1r <- rev(binCounts(-x, bx = rev(-bx), right = TRUE)) 376s + stopifnot(identical(n1r, n1)) 376s + 376s + # Retry with a sorted vector 376s + x <- sort(x) 376s + } # for (kk in 1:2) 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Missing values 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > x <- 1:40 376s > x[20] <- NA_integer_ 376s > nx <- length(x) 376s > 376s > # Bins 376s > bx <- c(0.5, 50.5, 100.5, 150.5, 200.5) 376s > 376s > y_smooth0 <- binCounts_hist(x, bx = bx) 376s > y_smooth <- binCounts(x, bx = bx) 376s > # Sanity check 376s > stopifnot(all.equal(y_smooth, y_smooth0)) 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Border cases 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > x <- 1:10 376s > bx <- min(x) - c(10, 1) 376s > y_smooth <- binCounts(x, bx = bx) 376s > stopifnot(all.equal(y_smooth, 0L)) 376s > bx <- range(x) 376s > y_smooth <- binCounts(x, bx = bx) 376s > stopifnot(all.equal(y_smooth, length(x) - 1L)) 376s > bx <- max(x) + c(1, 10) 376s > y_smooth <- binCounts(x, bx = bx) 376s > stopifnot(all.equal(y_smooth, 0L)) 376s > 376s > # Every second empty 376s > x <- 1:10 376s > bx <- rep(x, each = 2L) 376s > y_smooth <- binCounts(x, bx = bx) 376s > stopifnot(all.equal(y_smooth, rep(c(0L, 1L), length.out = length(bx) - 1L))) 376s > ## NOTE: binCounts_hist() does not give the same last bin count 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Exception handling 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Zero bin boundaries (invalid bin definition) 376s > bx <- double(0L) 376s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 376s > stopifnot(inherits(res, "try-error")) 376s > 376s > # One bin boundary (invalid bin definition) 376s > bx <- double(1L) 376s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 376s > stopifnot(inherits(res, "try-error")) 376s > 376s 376s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 376s Copyright (C) 2025 The R Foundation for Statistical Computing 376s Platform: aarch64-unknown-linux-gnu 376s 376s R is free software and comes with ABSOLUTELY NO WARRANTY. 376s You are welcome to redistribute it under certain conditions. 376s Type 'license()' or 'licence()' for distribution details. 376s 376s R is a collaborative project with many contributors. 376s Type 'contributors()' for more information and 376s 'citation()' on how to cite R or R packages in publications. 376s 376s Type 'demo()' for some demos, 'help()' for on-line help, or 376s 'help.start()' for an HTML browser interface to help. 376s Type 'q()' to quit R. 376s 376s > library("matrixStats") 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Local functions 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 376s + n0 <- graphics::hist(x, breaks = bx, right = right, 376s + include.lowest = TRUE, plot = FALSE)$counts 376s + } 376s > 376s > 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > # Subsetted tests 376s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 376s > source("utils/validateIndicesFramework.R") 376s > x <- runif(6, min = -6, max = 6) 376s > storage.mode(x) <- "integer" 376s > bx <- c(-6, 0, 3, 4, 10) 376s > for (idxs in index_cases) { 376s + validateIndicesTestVector(x, idxs, 376s + ftest = binCounts, fsure = binCounts_hist, 376s + bx = bx, right = FALSE) 376s + validateIndicesTestVector(x, idxs, 376s + ftest = binCounts, fsure = binCounts_hist, 376s + bx = bx, right = TRUE) 376s + } 376s > 376s 376s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 376s Copyright (C) 2025 The R Foundation for Statistical Computing 376s Platform: aarch64-unknown-linux-gnu 376s 376s R is free software and comes with ABSOLUTELY NO WARRANTY. 376s You are welcome to redistribute it under certain conditions. 376s Type 'license()' or 'licence()' for distribution details. 376s 376s R is a collaborative project with many contributors. 376s Type 'contributors()' for more information and 376s 'citation()' on how to cite R or R packages in publications. 376s 376s Type 'demo()' for some demos, 'help()' for on-line help, or 376s 'help.start()' for an HTML browser interface to help. 376s Type 'q()' to quit R. 376s 377s > library("matrixStats") 377s > library("stats") 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Naive R implementation of binMeans() 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 377s + n_smooth <- length(bx) - 1L 377s + res <- double(n_smooth) 377s + counts <- rep(NaN, times = n_smooth) 377s + 377s + if (na.rm) { 377s + keep <- !is.na(x) & !is.na(y) 377s + x <- x[keep] 377s + y <- y[keep] 377s + } 377s + 377s + # For each bin... 377s + for (kk in seq_len(n_smooth)) { 377s + if (right) { 377s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 377s + } else { 377s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 377s + } 377s + y_kk <- y[idxs] 377s + res[kk] <- mean(y_kk) 377s + counts[kk] <- length(idxs) 377s + } # for (kk ...) 377s + 377s + if (count) attr(res, "count") <- counts 377s + res 377s + } 377s > 377s > 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Case #1 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > x <- 1:100 377s > nx <- length(x) 377s > y <- double(nx) 377s > y[1:25] <- 5 377s > y[51:75] <- -5 377s > y <- y + rnorm(nx) 377s > 377s > # Bins 377s > bx <- c(0.5, 25.5, 50.5, 75.5, 100.5) 377s > 377s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 377s > y_smooth <- binMeans(y, x = x, bx = bx) 377s > n_smooth <- binCounts(x, bx = bx) 377s > # Sanity check 377s > stopifnot(all.equal(y_smooth, y_smooth0)) 377s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 377s > 377s > y_smooth0r <- rev(binMeans0(y, x = -x, bx = rev(-bx), 377s + count = FALSE, right = TRUE)) 377s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx), 377s + count = FALSE, right = TRUE)) 377s > # Sanity check 377s > stopifnot(all.equal(y_smooth0r, y_smooth0, check.attributes = FALSE)) 377s > stopifnot(all.equal(y_smoothr, y_smooth0r)) 377s > 377s > 377s > # Integer input 377s > y <- as.integer(y) 377s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 377s > y_smooth <- binMeans(y, x = x, bx = bx) 377s > n_smooth <- binCounts(x, bx = bx) 377s > # Sanity check 377s > stopifnot(is.integer(y), 377s + all.equal(y_smooth, y_smooth0), 377s + all.equal(attr(y_smooth, "count"), n_smooth)) 377s > 377s > # Logical input 377s > y <- as.logical(y) 377s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 377s > y_smooth <- binMeans(y, x = x, bx = bx) 377s > n_smooth <- binCounts(x, bx = bx) 377s > # Sanity check 377s > stopifnot(is.logical(y), 377s + all.equal(y_smooth, y_smooth0), 377s + all.equal(attr(y_smooth, "count"), n_smooth)) 377s > 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Case #2 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > nx <- 1e3 377s > x <- runif(nx) 377s > y <- runif(nx) 377s > 377s > nb <- 10 377s > bx <- do.call(seq, c(as.list(range(x)), length.out = nb)) 377s > bx1 <- c(bx[-1], bx[nb] + 1) 377s > 377s > y_smooth0 <- binMeans0(y, x = x, bx = bx1) 377s > y_smooth <- binMeans(y, x = x, bx = bx1) 377s > n_smooth <- binCounts(x, bx = bx1) 377s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx1), right = TRUE)) 377s > 377s > # Sanity check 377s > stopifnot(all.equal(y_smooth, y_smooth0)) 377s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 377s > stopifnot(all.equal(y_smoothr, y_smooth, check.attributes = FALSE)) 377s > 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Empty bins 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > x <- c(6:8, 16:19) 377s > nx <- length(x) 377s > y <- runif(nx) 377s > bx <- c(0, 5, 10, 15, 20, 25) 377s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 377s > y_smooth <- binMeans(y, x = x, bx = bx) 377s > n_smooth <- binCounts(x, bx = bx) 377s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 377s > stopifnot(all.equal(y_smooth, y_smooth0)) 377s > 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Missing values 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > x <- 1:100 377s > x[50] <- NA_integer_ 377s > nx <- length(x) 377s > y <- double(nx) 377s > y[1:25] <- 5 377s > y[51:75] <- -5 377s > y[82:92] <- NA_real_ 377s > y <- y + rnorm(nx) 377s > 377s > # Bins 377s > bx <- c(0.5, 25.5, 75.5, 82.5, 100.5) 377s > 377s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 377s > y_smooth <- binMeans(y, x = x, bx = bx) 377s > # Sanity check 377s > stopifnot(all.equal(y_smooth, y_smooth0)) 377s > 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Exception handling 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Zero bin boundaries (invalid bin definition) 377s > bx <- double(0L) 377s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 377s > stopifnot(inherits(res, "try-error")) 377s > 377s > # One bin boundary (invalid bin definition) 377s > bx <- double(1L) 377s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 377s > stopifnot(inherits(res, "try-error")) 377s > 377s 377s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 377s Copyright (C) 2025 The R Foundation for Statistical Computing 377s Platform: aarch64-unknown-linux-gnu 377s 377s R is free software and comes with ABSOLUTELY NO WARRANTY. 377s You are welcome to redistribute it under certain conditions. 377s Type 'license()' or 'licence()' for distribution details. 377s 377s R is a collaborative project with many contributors. 377s Type 'contributors()' for more information and 377s 'citation()' on how to cite R or R packages in publications. 377s 377s Type 'demo()' for some demos, 'help()' for on-line help, or 377s 'help.start()' for an HTML browser interface to help. 377s Type 'q()' to quit R. 377s 377s > library("matrixStats") 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Naive R implementation of binMeans() 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 377s + n_smooth <- length(bx) - 1L 377s + res <- double(n_smooth) 377s + counts <- rep(NaN, times = n_smooth) 377s + 377s + if (na.rm) { 377s + keep <- !is.na(x) & !is.na(y) 377s + x <- x[keep] 377s + y <- y[keep] 377s + } 377s + 377s + # For each bin... 377s + for (kk in seq_len(n_smooth)) { 377s + if (right) { 377s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 377s + } else { 377s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 377s + } 377s + y_kk <- y[idxs] 377s + res[kk] <- mean(y_kk) 377s + counts[kk] <- length(idxs) 377s + } # for (kk ...) 377s + 377s + if (count) attr(res, "count") <- counts 377s + res 377s + } 377s > 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Subsetted tests 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > source("utils/validateIndicesFramework.R") 377s > y <- runif(6, min = -6, max = 6) 377s > x <- runif(6, min = -6, max = 6) 377s > storage.mode(x) <- "integer" 377s > bx <- c(-6, 0, 3, 4, 10) 377s > for (idxs in index_cases) { 377s + for (na.rm in c(TRUE, FALSE)) { 377s + validateIndicesTestVector_w(y, x, idxs, 377s + ftest = binMeans, fsure = binMeans0, 377s + bx = bx, na.rm = na.rm, 377s + count = TRUE, right = FALSE) 377s + validateIndicesTestVector_w(y, x, idxs, 377s + ftest = binMeans, fsure = binMeans0, 377s + bx = bx, na.rm = na.rm, 377s + count = TRUE, right = TRUE) 377s + } 377s + } 377s > 377s 377s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 377s Copyright (C) 2025 The R Foundation for Statistical Computing 377s Platform: aarch64-unknown-linux-gnu 377s 377s R is free software and comes with ABSOLUTELY NO WARRANTY. 377s You are welcome to redistribute it under certain conditions. 377s Type 'license()' or 'licence()' for distribution details. 377s 377s R is a collaborative project with many contributors. 377s Type 'contributors()' for more information and 377s 'citation()' on how to cite R or R packages in publications. 377s 377s Type 'demo()' for some demos, 'help()' for on-line help, or 377s 'help.start()' for an HTML browser interface to help. 377s Type 'q()' to quit R. 377s 377s > library("matrixStats") 377s > 377s > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 377s + if (is.na(value)) { 377s + counts <- sum(is.na(x)) 377s + } else { 377s + counts <- sum(x == value, na.rm = na.rm) 377s + } 377s + as.integer(counts) 377s + } 377s > 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Data type: integer and numeric 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > for (mode in c("integer", "double")) { 377s + x <- runif(20 * 5, min = -3, max = 3) 377s + x[sample.int(length(x), size = 7)] <- 0 377s + storage.mode(x) <- mode 377s + 377s + for (na.rm in c(FALSE, TRUE)) { 377s + # Count zeros 377s + n0 <- count_R(x, value = 0, na.rm = na.rm) 377s + n1 <- count(x, value = 0, na.rm = na.rm) 377s + stopifnot(identical(n1, n0)) 377s + all <- allValue(x, value = 0, na.rm = na.rm) 377s + any <- anyValue(x, value = 0, na.rm = na.rm) 377s + 377s + # Count NAs 377s + n0 <- count_R(x, value = NA, na.rm = na.rm) 377s + n1 <- count(x, value = NA, na.rm = na.rm) 377s + stopifnot(identical(n1, n0)) 377s + all <- allValue(x, value = NA, na.rm = na.rm) 377s + any <- anyValue(x, value = NA, na.rm = na.rm) 377s + 377s + if (mode == "integer") { 377s + ux <- unique(as.vector(x)) 377s + n0 <- n1 <- integer(length(x)) 377s + for (value in ux) { 377s + n0 <- n0 + count_R(x, value = value, na.rm = na.rm) 377s + n1 <- n1 + count(x, value = value, na.rm = na.rm) 377s + stopifnot(identical(n1, n0)) 377s + } 377s + stopifnot(all(n0 == ncol(x))) 377s + } # if (mode == "integer") 377s + 377s + } # for (na.rm ...) 377s + } # for (mode ...) 377s > 377s > # All NAs 377s > na_list <- list(NA_integer_, NA_real_, NaN) 377s > for (na_value in na_list) { 377s + x <- rep(na_value, times = 10L) 377s + for (na.rm in c(FALSE, TRUE)) { 377s + n0 <- count_R(x, na.rm = na.rm) 377s + n1 <- count(x, na.rm = na.rm) 377s + stopifnot(identical(n1, n0)) 377s + 377s + # Count NAs 377s + n0 <- count_R(x, value = NA, na.rm = na.rm) 377s + n1 <- count(x, value = NA, na.rm = na.rm) 377s + stopifnot(identical(n1, n0)) 377s + any <- anyValue(x, value = NA, na.rm = na.rm) 377s + all <- allValue(x, value = NA, na.rm = na.rm) 377s + stopifnot(any) 377s + stopifnot(all) 377s + } 377s + } # for (na_value ...) 377s > 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Data type: logical 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > x <- logical(length = 10L) 377s > x[3:7] <- TRUE 377s > 377s > # Row/column counts 377s > for (na.rm in c(FALSE, TRUE)) { 377s + n0 <- count_R(x, na.rm = na.rm) 377s + n1 <- count(x, na.rm = na.rm) 377s + stopifnot(identical(n1, n0)) 377s + 377s + n_true <- count(x, value = TRUE, na.rm = na.rm) 377s + n_false <- count(x, value = FALSE, na.rm = na.rm) 377s + stopifnot(n_true + n_false == ncol(x)) 377s + 377s + # Count NAs 377s + n0 <- count_R(x, value = NA, na.rm = na.rm) 377s + n1 <- count(x, value = NA, na.rm = na.rm) 377s + stopifnot(identical(n1, n0)) 377s + } 377s > 377s 377s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 377s Copyright (C) 2025 The R Foundation for Statistical Computing 377s Platform: aarch64-unknown-linux-gnu 377s 377s R is free software and comes with ABSOLUTELY NO WARRANTY. 377s You are welcome to redistribute it under certain conditions. 377s Type 'license()' or 'licence()' for distribution details. 377s 377s R is a collaborative project with many contributors. 377s Type 'contributors()' for more information and 377s 'citation()' on how to cite R or R packages in publications. 377s 377s Type 'demo()' for some demos, 'help()' for on-line help, or 377s 'help.start()' for an HTML browser interface to help. 377s Type 'q()' to quit R. 377s 377s > library("matrixStats") 377s > 377s > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 377s + if (is.na(value)) { 377s + counts <- sum(is.na(x)) 377s + } else { 377s + counts <- sum(x == value, na.rm = na.rm) 377s + } 377s + as.integer(counts) 377s + } 377s > 377s > 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > # Subsetted tests 377s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 377s > source("utils/validateIndicesFramework.R") 377s > x <- runif(6, min = -3, max = 3) 377s > storage.mode(x) <- "integer" 377s > for (idxs in index_cases) { 377s + validateIndicesTestVector(x, idxs, 377s + ftest = count, fsure = count_R, 377s + value = 0, na.rm = TRUE) 377s + validateIndicesTestVector(x, idxs, 377s + ftest = count, fsure = count_R, 377s + value = 0, na.rm = FALSE) 377s + validateIndicesTestVector(x, idxs, 377s + ftest = count, fsure = count_R, 377s + value = NA_integer_) 377s + } 377s > 377s 377s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 377s Copyright (C) 2025 The R Foundation for Statistical Computing 377s Platform: aarch64-unknown-linux-gnu 377s 377s R is free software and comes with ABSOLUTELY NO WARRANTY. 377s You are welcome to redistribute it under certain conditions. 377s Type 'license()' or 'licence()' for distribution details. 377s 377s R is a collaborative project with many contributors. 377s Type 'contributors()' for more information and 377s 'citation()' on how to cite R or R packages in publications. 377s 377s Type 'demo()' for some demos, 'help()' for on-line help, or 377s 'help.start()' for an HTML browser interface to help. 377s Type 'q()' to quit R. 377s 378s > library("matrixStats") 378s > 378s > diff2_R <- function(..., useNames = TRUE){ 378s + res <- diff(...) 378s + if (!useNames) names(res) <- NULL 378s + res 378s + } 378s > 378s > set.seed(0x42) 378s > 378s > for (mode in c("integer", "double")) { 378s + x <- rnorm(10, sd = 5) 378s + storage.mode(x) <- mode 378s + str(x) 378s + 378s + for (has_na in c(FALSE, TRUE)) { 378s + for (setNames in c(TRUE, FALSE)) { 378s + for (useNames in c(TRUE, FALSE)) { 378s + if (has_na) { 378s + x[sample(1:10, size = 3)] <- NA 378s + } 378s + if (setNames) { 378s + names(x) <- LETTERS[1:10] 378s + } 378s + for (l in 1:3) { 378s + for (d in 1:4) { 378s + cat(sprintf("%s: NAs = %s, lag = %d, differences = %d, setNames = %d, useNames = %d\n", 378s + mode, has_na, l, d, setNames, useNames)) 378s + y0 <- diff2_R(x, lag = l, differences = d, useNames = useNames) 378s + str(y0) 378s + y1 <- diff2(x, lag = l, differences = d, useNames = useNames) 378s + str(y1) 378s + stopifnot(identical(y1, y0)) 378s + } 378s + } 378s + } 378s + } 378s + } # for (has_na ...) 378s + } 378s int [1:10] 11 1 2 0 -1 -3 -3 6 0 0 378s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 378s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 378s Named int [1:8] 11 -3 1 -1 2 9 -15 6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named int [1:8] 11 -3 1 -1 2 9 -15 6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 378s Named int [1:7] -14 4 -2 3 7 -24 21 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named int [1:7] -14 4 -2 3 7 -24 21 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 378s Named int [1:6] 18 -6 5 4 -31 45 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named int [1:6] 18 -6 5 4 -31 45 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 378s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 378s Named int [1:6] 6 -2 1 12 5 -15 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named int [1:6] 6 -2 1 12 5 -15 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 378s Named int [1:4] -5 14 4 -27 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named int [1:4] -5 14 4 -27 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 378s Named int [1:2] 9 -41 378s - attr(*, "names")= chr [1:2] "I" "J" 378s Named int [1:2] 9 -41 378s - attr(*, "names")= chr [1:2] "I" "J" 378s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 378s Named int [1:7] -11 -2 -5 -3 7 3 3 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named int [1:7] -11 -2 -5 -3 7 3 3 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 378s Named int [1:4] 8 9 8 6 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named int [1:4] 8 9 8 6 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 378s Named int -2 378s - attr(*, "names")= chr "J" 378s Named int -2 378s - attr(*, "names")= chr "J" 378s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 378s Named int(0) 378s - attr(*, "names")= chr(0) 378s Named int(0) 378s - attr(*, "names")= chr(0) 378s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 378s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 378s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 378s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 378s int [1:8] 11 -3 1 -1 2 9 -15 6 378s int [1:8] 11 -3 1 -1 2 9 -15 6 378s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 378s int [1:7] -14 4 -2 3 7 -24 21 378s int [1:7] -14 4 -2 3 7 -24 21 378s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 378s int [1:6] 18 -6 5 4 -31 45 378s int [1:6] 18 -6 5 4 -31 45 378s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 378s int [1:8] -9 -1 -3 -3 -2 9 3 -6 378s int [1:8] -9 -1 -3 -3 -2 9 3 -6 378s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 378s int [1:6] 6 -2 1 12 5 -15 378s int [1:6] 6 -2 1 12 5 -15 378s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 378s int [1:4] -5 14 4 -27 378s int [1:4] -5 14 4 -27 378s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 378s int [1:2] 9 -41 378s int [1:2] 9 -41 378s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 378s int [1:7] -11 -2 -5 -3 7 3 3 378s int [1:7] -11 -2 -5 -3 7 3 3 378s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 378s int [1:4] 8 9 8 6 378s int [1:4] 8 9 8 6 378s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 378s int -2 378s int -2 378s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 378s int(0) 378s int(0) 378s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 378s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 378s Named int [1:8] 11 -3 1 -1 2 9 -15 6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named int [1:8] 11 -3 1 -1 2 9 -15 6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 378s Named int [1:7] -14 4 -2 3 7 -24 21 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named int [1:7] -14 4 -2 3 7 -24 21 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 378s Named int [1:6] 18 -6 5 4 -31 45 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named int [1:6] 18 -6 5 4 -31 45 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 378s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 378s Named int [1:6] 6 -2 1 12 5 -15 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named int [1:6] 6 -2 1 12 5 -15 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 378s Named int [1:4] -5 14 4 -27 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named int [1:4] -5 14 4 -27 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 378s Named int [1:2] 9 -41 378s - attr(*, "names")= chr [1:2] "I" "J" 378s Named int [1:2] 9 -41 378s - attr(*, "names")= chr [1:2] "I" "J" 378s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 378s Named int [1:7] -11 -2 -5 -3 7 3 3 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named int [1:7] -11 -2 -5 -3 7 3 3 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 378s Named int [1:4] 8 9 8 6 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named int [1:4] 8 9 8 6 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 378s Named int -2 378s - attr(*, "names")= chr "J" 378s Named int -2 378s - attr(*, "names")= chr "J" 378s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 378s Named int(0) 378s - attr(*, "names")= chr(0) 378s Named int(0) 378s - attr(*, "names")= chr(0) 378s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 378s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 378s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 378s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 378s int [1:8] 11 -3 1 -1 2 9 -15 6 378s int [1:8] 11 -3 1 -1 2 9 -15 6 378s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 378s int [1:7] -14 4 -2 3 7 -24 21 378s int [1:7] -14 4 -2 3 7 -24 21 378s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 378s int [1:6] 18 -6 5 4 -31 45 378s int [1:6] 18 -6 5 4 -31 45 378s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 378s int [1:8] -9 -1 -3 -3 -2 9 3 -6 378s int [1:8] -9 -1 -3 -3 -2 9 3 -6 378s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 378s int [1:6] 6 -2 1 12 5 -15 378s int [1:6] 6 -2 1 12 5 -15 378s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 378s int [1:4] -5 14 4 -27 378s int [1:4] -5 14 4 -27 378s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 378s int [1:2] 9 -41 378s int [1:2] 9 -41 378s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 378s int [1:7] -11 -2 -5 -3 7 3 3 378s int [1:7] -11 -2 -5 -3 7 3 3 378s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 378s int [1:4] 8 9 8 6 378s int [1:4] 8 9 8 6 378s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 378s int -2 378s int -2 378s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 378s int(0) 378s int(0) 378s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 378s Named int [1:9] NA NA NA NA NA 0 9 -6 0 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s Named int [1:9] NA NA NA NA NA 0 9 -6 0 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 378s Named int [1:8] NA NA NA NA NA 9 -15 6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named int [1:8] NA NA NA NA NA 9 -15 6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 378s Named int [1:7] NA NA NA NA NA -24 21 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named int [1:7] NA NA NA NA NA -24 21 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 378s Named int [1:6] NA NA NA NA NA 45 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named int [1:6] NA NA NA NA NA 45 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 378s Named int [1:8] -9 NA NA NA NA 9 3 -6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named int [1:8] -9 NA NA NA NA 9 3 -6 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 378s Named int [1:6] NA NA NA NA NA -15 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named int [1:6] NA NA NA NA NA -15 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 378s Named int [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named int [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 378s Named int [1:2] NA NA 378s - attr(*, "names")= chr [1:2] "I" "J" 378s Named int [1:2] NA NA 378s - attr(*, "names")= chr [1:2] "I" "J" 378s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 378s Named int [1:7] NA NA -5 NA NA 3 3 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named int [1:7] NA NA -5 NA NA 3 3 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 378s Named int [1:4] NA NA 8 NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named int [1:4] NA NA 8 NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 378s Named int NA 378s - attr(*, "names")= chr "J" 378s Named int NA 378s - attr(*, "names")= chr "J" 378s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 378s Named int(0) 378s - attr(*, "names")= chr(0) 378s Named int(0) 378s - attr(*, "names")= chr(0) 378s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 378s int [1:9] NA NA NA NA NA 0 9 NA NA 378s int [1:9] NA NA NA NA NA 0 9 NA NA 378s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 378s int [1:8] NA NA NA NA NA 9 NA NA 378s int [1:8] NA NA NA NA NA 9 NA NA 378s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 378s int [1:7] NA NA NA NA NA NA NA 378s int [1:7] NA NA NA NA NA NA NA 378s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 378s int [1:6] NA NA NA NA NA NA 378s int [1:6] NA NA NA NA NA NA 378s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 378s int [1:8] NA NA NA NA NA 9 NA -6 378s int [1:8] NA NA NA NA NA 9 NA -6 378s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 378s int [1:6] NA NA NA NA NA -15 378s int [1:6] NA NA NA NA NA -15 378s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 378s int [1:4] NA NA NA NA 378s int [1:4] NA NA NA NA 378s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 378s int [1:2] NA NA 378s int [1:2] NA NA 378s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 378s int [1:7] NA NA NA NA NA NA 3 378s int [1:7] NA NA NA NA NA NA 3 378s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 378s int [1:4] NA NA NA NA 378s int [1:4] NA NA NA NA 378s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 378s int NA 378s int NA 378s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 378s int(0) 378s int(0) 378s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 378s Named int [1:9] NA NA NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s Named int [1:9] NA NA NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 378s Named int [1:8] NA NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named int [1:8] NA NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 378s Named int [1:7] NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named int [1:7] NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 378s Named int [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named int [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 378s Named int [1:8] NA NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named int [1:8] NA NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 378s Named int [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named int [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 378s Named int [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named int [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 378s Named int [1:2] NA NA 378s - attr(*, "names")= chr [1:2] "I" "J" 378s Named int [1:2] NA NA 378s - attr(*, "names")= chr [1:2] "I" "J" 378s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 378s Named int [1:7] NA NA NA NA NA NA 3 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named int [1:7] NA NA NA NA NA NA 3 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 378s Named int [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named int [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 378s Named int NA 378s - attr(*, "names")= chr "J" 378s Named int NA 378s - attr(*, "names")= chr "J" 378s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 378s Named int(0) 378s - attr(*, "names")= chr(0) 378s Named int(0) 378s - attr(*, "names")= chr(0) 378s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 378s int [1:9] NA NA NA NA NA NA NA NA NA 378s int [1:9] NA NA NA NA NA NA NA NA NA 378s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 378s int [1:8] NA NA NA NA NA NA NA NA 378s int [1:8] NA NA NA NA NA NA NA NA 378s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 378s int [1:7] NA NA NA NA NA NA NA 378s int [1:7] NA NA NA NA NA NA NA 378s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 378s int [1:6] NA NA NA NA NA NA 378s int [1:6] NA NA NA NA NA NA 378s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 378s int [1:8] NA NA NA NA NA NA NA NA 378s int [1:8] NA NA NA NA NA NA NA NA 378s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 378s int [1:6] NA NA NA NA NA NA 378s int [1:6] NA NA NA NA NA NA 378s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 378s int [1:4] NA NA NA NA 378s int [1:4] NA NA NA NA 378s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 378s int [1:2] NA NA 378s int [1:2] NA NA 378s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 378s int [1:7] NA NA NA NA NA NA 3 378s int [1:7] NA NA NA NA NA NA 3 378s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 378s int [1:4] NA NA NA NA 378s int [1:4] NA NA NA NA 378s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 378s int NA 378s int NA 378s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 378s int(0) 378s int(0) 378s num [1:10] 2.586 -0.344 0.33 9.155 -3.254 ... 378s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 378s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 378s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 378s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 378s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 378s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 378s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 378s Named num [1:4] 0.368 42.988 15.396 -29.313 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named num [1:4] 0.368 42.988 15.396 -29.313 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 378s Named num [1:2] 15 -72.3 378s - attr(*, "names")= chr [1:2] "I" "J" 378s Named num [1:2] 15 -72.3 378s - attr(*, "names")= chr [1:2] "I" "J" 378s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 378s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 378s Named num [1:4] -23.52 7.92 11.38 23.27 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named num [1:4] -23.52 7.92 11.38 23.27 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 378s Named num 46.8 378s - attr(*, "names")= chr "J" 378s Named num 46.8 378s - attr(*, "names")= chr "J" 378s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 378s Named num(0) 378s - attr(*, "names")= chr(0) 378s Named num(0) 378s - attr(*, "names")= chr(0) 378s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 378s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 378s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 378s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 378s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 378s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 378s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 378s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 378s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 378s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 378s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 378s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 378s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 378s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 378s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 378s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 378s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 378s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 378s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 378s num [1:4] 0.368 42.988 15.396 -29.313 378s num [1:4] 0.368 42.988 15.396 -29.313 378s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 378s num [1:2] 15 -72.3 378s num [1:2] 15 -72.3 378s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 378s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 378s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 378s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 378s num [1:4] -23.52 7.92 11.38 23.27 378s num [1:4] -23.52 7.92 11.38 23.27 378s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 378s num 46.8 378s num 46.8 378s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 378s num(0) 378s num(0) 378s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 378s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 378s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 378s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 378s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 378s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 378s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 378s Named num [1:4] 0.368 42.988 15.396 -29.313 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named num [1:4] 0.368 42.988 15.396 -29.313 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 378s Named num [1:2] 15 -72.3 378s - attr(*, "names")= chr [1:2] "I" "J" 378s Named num [1:2] 15 -72.3 378s - attr(*, "names")= chr [1:2] "I" "J" 378s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 378s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 378s Named num [1:4] -23.52 7.92 11.38 23.27 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named num [1:4] -23.52 7.92 11.38 23.27 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 378s Named num 46.8 378s - attr(*, "names")= chr "J" 378s Named num 46.8 378s - attr(*, "names")= chr "J" 378s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 378s Named num(0) 378s - attr(*, "names")= chr(0) 378s Named num(0) 378s - attr(*, "names")= chr(0) 378s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 378s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 378s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 378s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 378s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 378s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 378s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 378s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 378s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 378s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 378s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 378s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 378s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 378s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 378s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 378s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 378s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 378s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 378s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 378s num [1:4] 0.368 42.988 15.396 -29.313 378s num [1:4] 0.368 42.988 15.396 -29.313 378s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 378s num [1:2] 15 -72.3 378s num [1:2] 15 -72.3 378s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 378s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 378s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 378s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 378s num [1:4] -23.52 7.92 11.38 23.27 378s num [1:4] -23.52 7.92 11.38 23.27 378s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 378s num 46.8 378s num 46.8 378s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 378s num(0) 378s num(0) 378s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 378s Named num [1:9] -2.929 0.673 8.826 NA NA ... 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s Named num [1:9] -2.929 0.673 8.826 NA NA ... 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 378s Named num [1:8] 3.6 8.15 NA NA NA ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named num [1:8] 3.6 8.15 NA NA NA ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 378s Named num [1:7] 4.55 NA NA NA NA ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named num [1:7] 4.55 NA NA NA NA ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 378s Named num [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named num [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 378s Named num [1:8] -2.26 9.5 NA NA NA ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named num [1:8] -2.26 9.5 NA NA NA ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 378s Named num [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named num [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 378s Named num [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named num [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 378s Named num [1:2] NA NA 378s - attr(*, "names")= chr [1:2] "I" "J" 378s Named num [1:2] NA NA 378s - attr(*, "names")= chr [1:2] "I" "J" 378s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 378s Named num [1:7] 6.57 NA NA -16.95 NA ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named num [1:7] 6.57 NA NA -16.95 NA ... 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 378s Named num [1:4] -23.5 NA NA 23.3 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named num [1:4] -23.5 NA NA 23.3 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 378s Named num 46.8 378s - attr(*, "names")= chr "J" 378s Named num 46.8 378s - attr(*, "names")= chr "J" 378s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 378s Named num(0) 378s - attr(*, "names")= chr(0) 378s Named num(0) 378s - attr(*, "names")= chr(0) 378s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 378s num [1:9] NA 0.673 8.826 NA NA ... 378s num [1:9] NA 0.673 8.826 NA NA ... 378s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 378s num [1:8] NA 8.15 NA NA NA ... 378s num [1:8] NA 8.15 NA NA NA ... 378s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 378s num [1:7] NA NA NA NA NA NA NA 378s num [1:7] NA NA NA NA NA NA NA 378s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 378s num [1:6] NA NA NA NA NA NA 378s num [1:6] NA NA NA NA NA NA 378s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 378s num [1:8] NA 9.5 NA NA NA ... 378s num [1:8] NA 9.5 NA NA NA ... 378s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 378s num [1:6] NA NA NA NA NA NA 378s num [1:6] NA NA NA NA NA NA 378s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 378s num [1:4] NA NA NA NA 378s num [1:4] NA NA NA NA 378s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 378s num [1:2] NA NA 378s num [1:2] NA NA 378s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 378s num [1:7] NA NA NA NA NA NA NA 378s num [1:7] NA NA NA NA NA NA NA 378s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 378s num [1:4] NA NA NA NA 378s num [1:4] NA NA NA NA 378s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 378s num NA 378s num NA 378s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 378s num(0) 378s num(0) 378s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 378s Named num [1:9] NA 0.673 8.826 NA NA ... 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s Named num [1:9] NA 0.673 8.826 NA NA ... 378s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 378s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 378s Named num [1:8] NA 8.15 NA NA NA ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named num [1:8] NA 8.15 NA NA NA ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 378s Named num [1:7] NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named num [1:7] NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 378s Named num [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named num [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 378s Named num [1:8] NA 9.5 NA NA NA ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s Named num [1:8] NA 9.5 NA NA NA ... 378s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 378s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 378s Named num [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s Named num [1:6] NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 378s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 378s Named num [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named num [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 378s Named num [1:2] NA NA 378s - attr(*, "names")= chr [1:2] "I" "J" 378s Named num [1:2] NA NA 378s - attr(*, "names")= chr [1:2] "I" "J" 378s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 378s Named num [1:7] NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s Named num [1:7] NA NA NA NA NA NA NA 378s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 378s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 378s Named num [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s Named num [1:4] NA NA NA NA 378s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 378s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 378s Named num NA 378s - attr(*, "names")= chr "J" 378s Named num NA 378s - attr(*, "names")= chr "J" 378s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 378s Named num(0) 378s - attr(*, "names")= chr(0) 378s Named num(0) 378s - attr(*, "names")= chr(0) 378s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 378s num [1:9] NA 0.673 8.826 NA NA ... 378s num [1:9] NA 0.673 8.826 NA NA ... 378s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 378s num [1:8] NA 8.15 NA NA NA ... 378s num [1:8] NA 8.15 NA NA NA ... 378s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 378s num [1:7] NA NA NA NA NA NA NA 378s num [1:7] NA NA NA NA NA NA NA 378s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 378s num [1:6] NA NA NA NA NA NA 378s num [1:6] NA NA NA NA NA NA 378s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 378s num [1:8] NA 9.5 NA NA NA ... 378s num [1:8] NA 9.5 NA NA NA ... 378s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 378s num [1:6] NA NA NA NA NA NA 378s num [1:6] NA NA NA NA NA NA 378s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 378s num [1:4] NA NA NA NA 378s num [1:4] NA NA NA NA 378s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 378s num [1:2] NA NA 378s num [1:2] NA NA 378s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 378s num [1:7] NA NA NA NA NA NA NA 378s num [1:7] NA NA NA NA NA NA NA 378s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 378s num [1:4] NA NA NA NA 378s num [1:4] NA NA NA NA 378s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 378s num NA 378s num NA 378s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 378s num(0) 378s num(0) 378s > 378s 378s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 378s Copyright (C) 2025 The R Foundation for Statistical Computing 378s Platform: aarch64-unknown-linux-gnu 378s 378s R is free software and comes with ABSOLUTELY NO WARRANTY. 378s You are welcome to redistribute it under certain conditions. 378s Type 'license()' or 'licence()' for distribution details. 378s 378s R is a collaborative project with many contributors. 378s Type 'contributors()' for more information and 378s 'citation()' on how to cite R or R packages in publications. 378s 378s Type 'demo()' for some demos, 'help()' for on-line help, or 378s 'help.start()' for an HTML browser interface to help. 378s Type 'q()' to quit R. 378s 378s > library("matrixStats") 378s > 378s > diff2_R <- function(..., useNames=NA){ 378s + res <- diff(...) 378s + if (!useNames) names(res) <- NULL 378s + res 378s + } 378s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 378s > # Subsetted tests 378s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 378s > source("utils/validateIndicesFramework.R") 378s > x <- runif(6, min = -6, max = 6) 378s > for (setNames in c(TRUE, FALSE)) { 378s + if (setNames) names(x) <- LETTERS[1:6] 378s + else names(x) <- NULL 378s + for (l in 1:2) { 378s + for (d in 1:2) { 378s + for (idxs in index_cases) { 378s + for (useNames in c(TRUE, FALSE)) { 378s + validateIndicesTestVector(x, idxs, 378s + ftest = diff2, fsure = diff2_R, 378s + lag = l, differences = d, useNames = useNames) 378s + } 378s + } 378s + } 378s + } 378s + } 378s > 378s 378s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 378s Copyright (C) 2025 The R Foundation for Statistical Computing 378s Platform: aarch64-unknown-linux-gnu 378s 378s R is free software and comes with ABSOLUTELY NO WARRANTY. 378s You are welcome to redistribute it under certain conditions. 378s Type 'license()' or 'licence()' for distribution details. 378s 378s R is a collaborative project with many contributors. 378s Type 'contributors()' for more information and 378s 'citation()' on how to cite R or R packages in publications. 378s 378s Type 'demo()' for some demos, 'help()' for on-line help, or 378s 'help.start()' for an HTML browser interface to help. 378s Type 'q()' to quit R. 378s 378s > library("matrixStats") 378s > 378s > indexByRow_R1 <- function(dim, idxs = NULL, ...) { 378s + n <- prod(dim) 378s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 378s + if (!is.null(idxs)) 378s + x <- x[idxs] 378s + as.vector(x) 378s + } 378s > 378s > 378s > indexByRow_R2 <- function(dim, idxs = NULL, ...) { 378s + n <- prod(dim) 378s + if (is.null(idxs)) { 378s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 378s + as.vector(x) 378s + } else { 378s + idxs <- idxs - 1L 378s + cols <- idxs %/% dim[2L] 378s + rows <- idxs %% dim[2L] 378s + cols + dim[1L] * rows + 1L 378s + } 378s + } 378s > 378s > 378s > dim <- c(5L, 4L) 378s > x <- matrix(NA_integer_, nrow = dim[1L], ncol = dim[2L]) 378s > y <- t(x) 378s > idxs_by_cols <- seq_along(x) 378s > 378s > # Assign by columns 378s > x[idxs_by_cols] <- idxs_by_cols 378s > print(x) 378s [,1] [,2] [,3] [,4] 378s [1,] 1 6 11 16 378s [2,] 2 7 12 17 378s [3,] 3 8 13 18 378s [4,] 4 9 14 19 378s [5,] 5 10 15 20 378s > 378s > # Truth 378s > y0 <- t(x) 378s > idxs_by_rows <- as.vector(y0) 378s > 378s > # Assert 378s > idxs <- indexByRow(dim) 378s > stopifnot(all.equal(idxs, idxs_by_rows)) 378s > y <- x 378s > y[idxs_by_rows] <- idxs 378s > print(y) 378s [,1] [,2] [,3] [,4] 378s [1,] 1 6 11 16 378s [2,] 2 7 12 17 378s [3,] 3 8 13 18 378s [4,] 4 9 14 19 378s [5,] 5 10 15 20 378s > stopifnot(all(as.vector(y) == as.vector(x))) 378s > 378s > idxs_R1 <- indexByRow_R1(dim) 378s > stopifnot(all.equal(idxs_R1, idxs_by_rows)) 378s > 378s > idxs_R2 <- indexByRow_R2(dim) 378s > stopifnot(all.equal(idxs_R2, idxs_by_rows)) 378s > 378s > # Assert 378s > idxs_by_cols <- seq(from = 1, to = length(x), by = 3L) 378s > idxs_by_rows <- as.vector(t(x)[idxs_by_cols]) 378s > 378s > idxs <- indexByRow(dim, idxs = idxs_by_cols) 378s > stopifnot(all(idxs == idxs_by_rows)) 378s > 378s > idxs_R1 <- indexByRow_R1(dim, idxs = idxs_by_cols) 378s > stopifnot(all(idxs_R1 == idxs_by_rows)) 378s > 378s > idxs_R2 <- indexByRow_R2(dim, idxs = idxs_by_cols) 378s > stopifnot(all(idxs_R2 == idxs_by_rows)) 378s > 378s > 378s > ## DEFUNCT: Backward compatibility 378s > res <- tryCatch({ 378s + idxs1 <- indexByRow(x) 378s + }, error = identity) 378s > stopifnot(inherits(res, "error")) 378s > 378s > 378s > ## Exceptions: 378s > ## Too large matrices are not supported, which happens 378s > ## when prod(dim) > .Machine$integer.max 378s > dim_too_large <- c(.Machine$integer.max, 2L) 378s > res <- tryCatch({ 378s + idxs <- indexByRow(dim_too_large, idxs = 1L) 378s + }, error = identity) 378s > stopifnot(inherits(res, "error")) 378s > 378s > ## Non-positive indices are not supported 378s > res <- tryCatch({ 378s + idxs <- indexByRow(c(1,1), idxs = 0L) 378s + }, error = identity) 378s > stopifnot(inherits(res, "error")) 378s > 378s > res <- tryCatch({ 378s + idxs <- indexByRow(c(1,1), idxs = -1L) 378s + }, error = identity) 378s > stopifnot(inherits(res, "error")) 378s > 378s 378s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 378s Copyright (C) 2025 The R Foundation for Statistical Computing 378s Platform: aarch64-unknown-linux-gnu 378s 378s R is free software and comes with ABSOLUTELY NO WARRANTY. 378s You are welcome to redistribute it under certain conditions. 378s Type 'license()' or 'licence()' for distribution details. 378s 378s R is a collaborative project with many contributors. 378s Type 'contributors()' for more information and 378s 'citation()' on how to cite R or R packages in publications. 378s 378s Type 'demo()' for some demos, 'help()' for on-line help, or 378s 'help.start()' for an HTML browser interface to help. 378s Type 'q()' to quit R. 378s 378s > library("matrixStats") 379s > library("stats") 379s > 379s > logSumExp_R <- function(lx, na.rm = FALSE) { 379s + log(sum(exp(lx), na.rm = na.rm)) 379s + } 379s > 379s > ## R-help thread \emph{'[R] Beyond double-precision?'} on May 9, 2009. 379s > 379s > for (mode in c("integer", "double")) { 379s + cat("mode: ", mode, "\n", sep = "") 379s + 379s + set.seed(1) 379s + x <- runif(20, min = 1.0, max = 3.0) 379s + storage.mode(x) <- mode 379s + str(x) 379s + 379s + ## The logarithm of the harmonic mean 379s + y0 <- log(1 / mean(1 / x)) 379s + print(y0) ## -1.600885 379s + 379s + lx <- log(x) 379s + y1 <- log(length(x)) - logSumExp(-lx) 379s + print(y1) ## [1] -1.600885 379s + 379s + # Sanity check 379s + stopifnot(all.equal(y1, y0)) 379s + 379s + y2 <- log(length(x)) - logSumExp_R(-lx) 379s + # Sanity check 379s + stopifnot(all.equal(y2, y0)) 379s + } # for (mode ...) 379s mode: integer 379s int [1:20] 1 1 2 2 1 2 2 2 2 1 ... 379s [1] 0.3215836 379s [1] 0.3215836 379s mode: double 379s num [1:20] 1.53 1.74 2.15 2.82 1.4 ... 379s [1] 0.6673156 379s [1] 0.6673156 379s > 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Missing values 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > ## NA values 379s > lx <- c(1, 2, 3) 379s > lx[2] <- NA_real_ 379s > y0 <- logSumExp_R(lx, na.rm = FALSE) 379s > y <- logSumExp(lx, na.rm = FALSE) 379s > print(y) 379s [1] NA 379s > stopifnot(identical(y, NA_real_)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > y0 <- logSumExp_R(lx, na.rm = TRUE) 379s > y <- logSumExp(lx, na.rm = TRUE) 379s > print(y) 379s [1] 3.126928 379s > stopifnot(all.equal(y, y0)) 379s > 379s > ## NaN values 379s > lx <- c(1, 2, 3) 379s > lx[2] <- NaN 379s > y0 <- logSumExp_R(lx, na.rm = FALSE) 379s > y <- logSumExp(lx, na.rm = FALSE) 379s > print(y) 379s [1] NA 379s > stopifnot(identical(y, NA_real_)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > y0 <- logSumExp_R(lx, na.rm = TRUE) 379s > y <- logSumExp(lx, na.rm = TRUE) 379s > print(y) 379s [1] 3.126928 379s > stopifnot(all.equal(y, y0)) 379s > 379s > 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Corner cases 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > ## Zero-length vectors 379s > lx <- numeric(0L) 379s > y0 <- logSumExp_R(lx) 379s > y <- logSumExp(lx) 379s > print(y) 379s [1] -Inf 379s > stopifnot(identical(y, -Inf)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > ## Vectors of length one 379s > lx <- 1.0 379s > y0 <- logSumExp_R(lx) 379s > y <- logSumExp(lx) 379s > print(y) 379s [1] 1 379s > stopifnot(identical(y, lx)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > lx <- NA_real_ 379s > y0 <- logSumExp_R(lx, na.rm = TRUE) 379s > y <- logSumExp(lx, na.rm = TRUE) 379s > print(y) 379s [1] -Inf 379s > stopifnot(identical(y, -Inf)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > ## All missing values 379s > lx <- c(NA_real_, NA_real_) 379s > y0 <- logSumExp_R(lx, na.rm = TRUE) 379s > y <- logSumExp(lx, na.rm = TRUE) 379s > print(y) 379s [1] -Inf 379s > stopifnot(identical(y, -Inf)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > lx <- c(NA_real_, NA_real_) 379s > y0 <- logSumExp_R(lx, na.rm = FALSE) 379s > y <- logSumExp(lx, na.rm = FALSE) 379s > print(y) 379s [1] NA 379s > stopifnot(identical(y, NA_real_)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > 379s > ## +Inf values 379s > lx <- c(1, 2, +Inf) 379s > y0 <- logSumExp_R(lx) 379s > y <- logSumExp(lx) 379s > print(y) 379s [1] Inf 379s > stopifnot(identical(y, +Inf)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > ## First element is a missing value, cf. PR #33 379s > lx <- c(NA_real_, 1) 379s > y0 <- logSumExp_R(lx) 379s > print(y0) 379s [1] NA 379s > y <- logSumExp(lx, na.rm = FALSE) 379s > print(y) 379s [1] NA 379s > stopifnot(identical(y, NA_real_)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > y0 <- logSumExp_R(lx, na.rm = TRUE) 379s > print(y0) 379s [1] 1 379s > y <- logSumExp(lx, na.rm = TRUE) 379s > print(y) 379s [1] 1 379s > stopifnot(identical(y, 1)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > ## Multiple -Inf values, cf. issue #84 379s > lx <- c(-Inf, -Inf) 379s > y0 <- logSumExp_R(lx) 379s > y <- logSumExp(lx) 379s > print(y) 379s [1] -Inf 379s > stopifnot(identical(y, -Inf)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s > lx <- c(-Inf, 5, -Inf) 379s > y0 <- logSumExp_R(lx) 379s > y <- logSumExp(lx) 379s > print(y) 379s [1] 5 379s > stopifnot(identical(y, 5)) 379s > stopifnot(all.equal(y, y0)) 379s > 379s 379s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 379s Copyright (C) 2025 The R Foundation for Statistical Computing 379s Platform: aarch64-unknown-linux-gnu 379s 379s R is free software and comes with ABSOLUTELY NO WARRANTY. 379s You are welcome to redistribute it under certain conditions. 379s Type 'license()' or 'licence()' for distribution details. 379s 379s R is a collaborative project with many contributors. 379s Type 'contributors()' for more information and 379s 'citation()' on how to cite R or R packages in publications. 379s 379s Type 'demo()' for some demos, 'help()' for on-line help, or 379s 'help.start()' for an HTML browser interface to help. 379s Type 'q()' to quit R. 379s 379s > library("matrixStats") 379s > 379s > logSumExp_R <- function(lx, na.rm = FALSE) { 379s + log(sum(exp(lx), na.rm = na.rm)) 379s + } 379s > 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Subsetted tests 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > source("utils/validateIndicesFramework.R") 379s > x <- runif(6, min = -6, max = 6) 379s > for (idxs in index_cases) { 379s + validateIndicesTestVector(x, idxs, 379s + ftest = logSumExp, fsure = logSumExp_R, 379s + na.rm = FALSE) 379s + validateIndicesTestVector(x, idxs, 379s + ftest = logSumExp, fsure = logSumExp_R, 379s + na.rm = TRUE) 379s + } 379s > 379s 379s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 379s Copyright (C) 2025 The R Foundation for Statistical Computing 379s Platform: aarch64-unknown-linux-gnu 379s 379s R is free software and comes with ABSOLUTELY NO WARRANTY. 379s You are welcome to redistribute it under certain conditions. 379s Type 'license()' or 'licence()' for distribution details. 379s 379s R is a collaborative project with many contributors. 379s Type 'contributors()' for more information and 379s 'citation()' on how to cite R or R packages in publications. 379s 379s Type 'demo()' for some demos, 'help()' for on-line help, or 379s 'help.start()' for an HTML browser interface to help. 379s Type 'q()' to quit R. 379s 379s > library("matrixStats") 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Consistency checks 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > set.seed(1) 379s > 379s > mean2_R <- function(x, na.rm = FALSE, idxs = NULL) { 379s + if (is.null(idxs)) { 379s + mean(x, na.rm = na.rm) 379s + } else { 379s + mean(x[idxs], na.rm = na.rm) 379s + } 379s + } # mean2_R() 379s > 379s > 379s > cat("Consistency checks:\n") 379s Consistency checks: 379s > for (kk in 1:20) { 379s + cat("Random test #", kk, "\n", sep = "") 379s + 379s + # Simulate data in a matrix of any shape 379s + n <- sample(100L, size = 1L) 379s + x <- rnorm(n, sd = 100) 379s + 379s + # Add NAs? 379s + if ((kk %% 4) %in% c(3, 0)) { 379s + cat("Adding NAs\n") 379s + nna <- sample(n, size = 1L) 379s + na_values <- c(NA_real_, NaN) 379s + t <- sample(na_values, size = nna, replace = TRUE) 379s + x[sample(length(x), size = nna)] <- t 379s + } 379s + 379s + # Integer or double? 379s + if ((kk %% 4) %in% c(2, 0)) { 379s + cat("Coercing to integers\n") 379s + storage.mode(x) <- "integer" 379s + } 379s + 379s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 379s + 379s + # Sum over all 379s + y0 <- mean2_R(x, na.rm = na.rm) 379s + y1 <- mean2(x, na.rm = na.rm) 379s + stopifnot(all.equal(y1, y0)) 379s + 379s + # Sum over subset 379s + nidxs <- sample(n, size = 1L) 379s + idxs <- sample(n, size = nidxs) 379s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 379s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 379s + stopifnot(all.equal(y1, y0)) 379s + 379s + if (storage.mode(x) == "integer") { 379s + storage.mode(x) <- "logical" 379s + 379s + y0 <- mean2_R(x, na.rm = na.rm) 379s + y1 <- mean2(x, na.rm = na.rm) 379s + stopifnot(all.equal(y1, y0)) 379s + 379s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 379s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 379s + stopifnot(all.equal(y1, y0)) 379s + } 379s + } # for (kk ...) 379s Random test #1 379s Random test #2 379s Coercing to integers 379s Random test #3 379s Adding NAs 379s Random test #4 379s Adding NAs 379s Coercing to integers 379s Random test #5 379s Random test #6 379s Coercing to integers 379s Random test #7 379s Adding NAs 379s Random test #8 379s Adding NAs 379s Coercing to integers 379s Random test #9 379s Random test #10 379s Coercing to integers 379s Random test #11 379s Adding NAs 379s Random test #12 379s Adding NAs 379s Coercing to integers 379s Random test #13 379s Random test #14 379s Coercing to integers 379s Random test #15 379s Adding NAs 379s Random test #16 379s Adding NAs 379s Coercing to integers 379s Random test #17 379s Random test #18 379s Coercing to integers 379s Random test #19 379s Adding NAs 379s Random test #20 379s Adding NAs 379s Coercing to integers 379s > 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Special cases 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > for (na.rm in c(FALSE, TRUE)) { 379s + # Averaging over zero elements (integers) 379s + x <- integer(0) 379s + s1 <- mean(x, na.rm = na.rm) 379s + s2 <- mean2(x, na.rm = na.rm) 379s + stopifnot(identical(s1, s2)) 379s + 379s + x <- 1:5 379s + idxs <- integer(0) 379s + s1 <- mean(x[idxs], na.rm = na.rm) 379s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 379s + stopifnot(identical(s1, s2)) 379s + 379s + # Averaging over NA_integer_:s 379s + x <- rep(NA_integer_, times = 5L) 379s + s1 <- mean(x, na.rm = na.rm) 379s + s2 <- mean2(x, na.rm = na.rm) 379s + stopifnot(identical(s1, s2)) 379s + 379s + x <- rep(NA_integer_, times = 5L) 379s + idxs <- 1:3 379s + s1 <- mean(x[idxs], na.rm = na.rm) 379s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 379s + stopifnot(identical(s1, s2)) 379s + 379s + 379s + # Averaging over zero elements (doubles) 379s + x <- double(0) 379s + s1 <- mean(x) 379s + s2 <- mean2(x) 379s + stopifnot(identical(s1, s2)) 379s + 379s + x <- as.double(1:10) 379s + idxs <- integer(0) 379s + s1 <- mean(x[idxs]) 379s + s2 <- mean2(x, idxs = idxs) 379s + stopifnot(identical(s1, s2)) 379s + 379s + # Averaging over NA_real_:s 379s + x <- rep(NA_real_, times = 5L) 379s + s1 <- mean(x, na.rm = na.rm) 379s + s2 <- mean2(x, na.rm = na.rm) 379s + stopifnot(identical(s1, s2)) 379s + 379s + x <- rep(NA_real_, times = 5L) 379s + idxs <- 1:3 379s + s1 <- mean(x[idxs], na.rm = na.rm) 379s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 379s + stopifnot(identical(s1, s2)) 379s + 379s + # Averaging over -Inf:s 379s + x <- rep(-Inf, times = 3L) 379s + s1 <- mean(x, na.rm = na.rm) 379s + s2 <- mean2(x, na.rm = na.rm) 379s + stopifnot(identical(s1, s2)) 379s + 379s + # Averaging over +Inf:s 379s + x <- rep(+Inf, times = 3L) 379s + s1 <- mean(x, na.rm = na.rm) 379s + s2 <- mean2(x, na.rm = na.rm) 379s + stopifnot(identical(s1, s2)) 379s + 379s + # Averaging over mix of -Inf:s and +Inf:s 379s + x <- rep(c(-Inf, +Inf), times = 3L) 379s + s1 <- mean(x, na.rm = na.rm) 379s + s2 <- mean2(x, na.rm = na.rm) 379s + stopifnot(identical(s1, s2)) 379s + 379s + # Averaging over mix of -Inf:s and +Inf:s and numerics 379s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 379s + s1 <- mean(x, na.rm = na.rm) 379s + s2 <- mean2(x, na.rm = na.rm) 379s + stopifnot(identical(s1, s2)) 379s + 379s + # Averaging over mix of NaN, NA, +Inf, and numerics 379s + x <- c(NaN, NA, +Inf, 3.14) 379s + s1 <- mean(x, na.rm = na.rm) 379s + s2 <- mean2(x, na.rm = na.rm) 379s + if (na.rm) { 379s + stopifnot(identical(s2, s1)) 379s + } else { 379s + stopifnot(is.na(s1), is.na(s2)) 379s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 379s + ## returned here (as one would expect). NaN might very well be returned, 379s + ## when both NA and NaN are involved. This is an accepted feature in R, 379s + ## which is documented in help("is.nan"). See also 379s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 379s + ## Thus, we cannot guarantee that s1 is identical to s0. 379s + } 379s + 379s + # Averaging over mix of NaN, NA_real_, +Inf, and numerics 379s + x <- c(NA_real_, NaN, +Inf, 3.14) 379s + s1 <- mean(x, na.rm = na.rm) 379s + s2 <- mean2(x, na.rm = na.rm) 379s + if (na.rm) { 379s + stopifnot(identical(s2, s1)) 379s + } else { 379s + stopifnot(is.na(s1), is.na(s2)) 379s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 379s + ## returned here (as one would expect). NaN might very well be returned, 379s + ## when both NA and NaN are involved. This is an accepted feature in R, 379s + ## which is documented in help("is.nan"). See also 379s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 379s + ## Thus, we cannot guarantee that s1 is identical to s0. 379s + } 379s + } 379s > 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Argument 'idxs' 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > x <- 1:5 379s > idxs_list <- list( 379s + integer = 1:3, 379s + double = as.double(1:3), 379s + logical = (x <= 3) 379s + ) 379s > 379s > for (idxs in idxs_list) { 379s + cat("idxs:\n") 379s + str(idxs) 379s + s1 <- mean(x[idxs], na.rm = TRUE) 379s + s2 <- mean2(x, idxs = idxs, na.rm = TRUE) 379s + stopifnot(identical(s1, s2)) 379s + } 379s idxs: 379s int [1:3] 1 2 3 379s idxs: 379s num [1:3] 1 2 3 379s idxs: 379s logi [1:5] TRUE TRUE TRUE FALSE FALSE 379s > 379s 379s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 379s Copyright (C) 2025 The R Foundation for Statistical Computing 379s Platform: aarch64-unknown-linux-gnu 379s 379s R is free software and comes with ABSOLUTELY NO WARRANTY. 379s You are welcome to redistribute it under certain conditions. 379s Type 'license()' or 'licence()' for distribution details. 379s 379s R is a collaborative project with many contributors. 379s Type 'contributors()' for more information and 379s 'citation()' on how to cite R or R packages in publications. 379s 379s Type 'demo()' for some demos, 'help()' for on-line help, or 379s 'help.start()' for an HTML browser interface to help. 379s Type 'q()' to quit R. 379s 379s > library("matrixStats") 379s > 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > # Subsetted tests 379s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 379s > source("utils/validateIndicesFramework.R") 379s > x <- runif(6, min = -6, max = 6) 379s > storage.mode(x) <- "integer" 379s > for (idxs in index_cases) { 379s + validateIndicesTestVector(x, idxs, 379s + ftest = mean2, fsure = mean, 379s + na.rm = FALSE) 379s + validateIndicesTestVector(x, idxs, 379s + ftest = mean2, fsure = mean, 379s + na.rm = TRUE) 379s + } 379s > 379s 379s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 379s Copyright (C) 2025 The R Foundation for Statistical Computing 379s Platform: aarch64-unknown-linux-gnu 379s 379s R is free software and comes with ABSOLUTELY NO WARRANTY. 379s You are welcome to redistribute it under certain conditions. 379s Type 'license()' or 'licence()' for distribution details. 379s 379s R is a collaborative project with many contributors. 379s Type 'contributors()' for more information and 379s 'citation()' on how to cite R or R packages in publications. 379s 379s Type 'demo()' for some demos, 'help()' for on-line help, or 379s 'help.start()' for an HTML browser interface to help. 379s Type 'q()' to quit R. 379s 380s > library("matrixStats") 380s > 380s > for (mode in c("integer", "double")) { 380s + cat("mode: ", mode, "\n", sep = "") 380s + 380s + # Empty vector 380s + x <- 0 380s + storage.mode(x) <- mode 380s + y <- prod(x, na.rm = TRUE) 380s + print(y) 380s + z <- product(x, na.rm = TRUE) 380s + print(z) 380s + stopifnot(all.equal(z, y)) 380s + 380s + # Test negative values 380s + x <- c(1, -4, 2) 380s + storage.mode(x) <- mode 380s + y <- prod(x, na.rm = TRUE) 380s + print(y) 380s + z <- product(x, na.rm = TRUE) 380s + print(z) 380s + stopifnot(all.equal(z, y)) 380s + 380s + # Test missing values 380s + x <- c(1, NA, NaN, 2) 380s + storage.mode(x) <- mode 380s + y <- prod(x, na.rm = TRUE) 380s + print(y) 380s + z <- product(x, na.rm = TRUE) 380s + print(z) 380s + stopifnot(all.equal(z, y)) 380s + 380s + x <- c(1, NA, NaN, 2) 380s + storage.mode(x) <- mode 380s + y <- prod(x, na.rm = FALSE) 380s + print(y) 380s + z <- product(x, na.rm = FALSE) 380s + print(z) 380s + stopifnot(all(is.na(z), is.na(y))) 380s + 380s + x <- c(1, NaN, 2) 380s + storage.mode(x) <- mode 380s + y <- prod(x, na.rm = FALSE) 380s + print(y) 380s + stopifnot(is.na(y)) 380s + z <- product(x, na.rm = FALSE) 380s + print(z) 380s + stopifnot(is.na(z)) 380s + 380s + } # for (mode ...) 380s mode: integer 380s [1] 0 380s [1] 0 380s [1] -8 380s [1] -8 380s [1] 2 380s [1] 2 380s [1] NA 380s [1] NA 380s [1] NA 380s [1] NA 380s mode: double 380s [1] 0 380s [1] 0 380s [1] -8 380s [1] -8 380s [1] 2 380s [1] 2 380s [1] NA 380s [1] NA 380s [1] NaN 380s [1] NA 380s > 380s > 380s > # NAs following 0s 380s > x <- c(0L, NA_integer_) 380s > y <- prod(x, na.rm = FALSE) 380s > print(y) 380s [1] NA 380s > z <- product(x, na.rm = FALSE) 380s > print(z) 380s [1] NA 380s > stopifnot(identical(z, y)) 380s > 380s 380s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 380s Copyright (C) 2025 The R Foundation for Statistical Computing 380s Platform: aarch64-unknown-linux-gnu 380s 380s R is free software and comes with ABSOLUTELY NO WARRANTY. 380s You are welcome to redistribute it under certain conditions. 380s Type 'license()' or 'licence()' for distribution details. 380s 380s R is a collaborative project with many contributors. 380s Type 'contributors()' for more information and 380s 'citation()' on how to cite R or R packages in publications. 380s 380s Type 'demo()' for some demos, 'help()' for on-line help, or 380s 'help.start()' for an HTML browser interface to help. 380s Type 'q()' to quit R. 380s 380s > library("matrixStats") 380s > 380s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 380s > # Subsetted tests 380s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 380s > source("utils/validateIndicesFramework.R") 380s > x <- runif(6, min = -6, max = 6) 380s > storage.mode(x) <- "integer" 380s > for (idxs in index_cases) { 380s + validateIndicesTestVector(x, idxs, 380s + ftest = product, fsure = prod, 380s + na.rm = TRUE) 380s + validateIndicesTestVector(x, idxs, 380s + ftest = product, fsure = prod, 380s + na.rm = FALSE) 380s + } 380s > 380s 380s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 380s Copyright (C) 2025 The R Foundation for Statistical Computing 380s Platform: aarch64-unknown-linux-gnu 380s 380s R is free software and comes with ABSOLUTELY NO WARRANTY. 380s You are welcome to redistribute it under certain conditions. 380s Type 'license()' or 'licence()' for distribution details. 380s 380s R is a collaborative project with many contributors. 380s Type 'contributors()' for more information and 380s 'citation()' on how to cite R or R packages in publications. 380s 380s Type 'demo()' for some demos, 'help()' for on-line help, or 380s 'help.start()' for an HTML browser interface to help. 380s Type 'q()' to quit R. 380s 380s > library("matrixStats") 380s > library("utils") ## utils::str 380s > 380s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 380s > # Local functions 380s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 380s > psortKM_R <- function(x, k, m) { 380s + x <- sort(x) 380s + x[(k - m + 1):k] 380s + } 380s > 380s > psortKM_R2 <- function(x, k, m) { 380s + partial <- (k - m + 1):k 380s + x <- sort.int(x, partial = partial) 380s + x[partial] 380s + } 380s > 380s > 380s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 380s > # Consistency checks 380s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 380s > set.seed(1) 380s > 380s > cat("Consistency checks:\n") 380s Consistency checks: 380s > x <- 1:30 380s > x[18:20] <- 20 380s > y <- sample(x) 380s > cat("x:\n") 380s x: 380s > str(x) 380s num [1:30] 1 2 3 4 5 6 7 8 9 10 ... 380s > cat("sample(x):\n") 380s sample(x): 380s > str(y) 380s num [1:30] 25 4 7 1 2 23 11 14 20 20 ... 380s > 380s > for (k in c(1L, 2L, 20L, 21L, length(x))) { 380s + for (m in 1:min(5L, k)) { 380s + px0 <- psortKM_R(x, k = k, m = m) 380s + px0b <- psortKM_R2(x, k = k, m = m) 380s + stopifnot(identical(px0b, px0)) 380s + px1 <- matrixStats:::.psortKM(x, k = k, m = m) 380s + cat(sprintf(".psortKM(x, k = %d, m = %d):\n", k, m)) 380s + print(px1) 380s + stopifnot(identical(px1, px0)) 380s + 380s + py0 <- psortKM_R(y, k = k, m = m) 380s + py0b <- psortKM_R2(y, k = k, m = m) 380s + stopifnot(identical(py0b, py0)) 380s + py1 <- matrixStats:::.psortKM(y, k = k, m = m) 380s + cat(sprintf(".psortKM(y, k = %d, m = %d):\n", k, m)) 380s + print(py1) 380s + stopifnot(identical(py1, py0)) 380s + stopifnot(identical(py1, px1)) 380s + } # for (m ...) 380s + } # for (k ...) 380s .psortKM(x, k = 1, m = 1): 380s [1] 1 380s .psortKM(y, k = 1, m = 1): 380s [1] 1 380s .psortKM(x, k = 2, m = 1): 380s [1] 2 380s .psortKM(y, k = 2, m = 1): 380s [1] 2 380s .psortKM(x, k = 2, m = 2): 380s [1] 1 2 380s .psortKM(y, k = 2, m = 2): 380s [1] 1 2 380s .psortKM(x, k = 20, m = 1): 380s [1] 20 380s .psortKM(y, k = 20, m = 1): 380s [1] 20 380s .psortKM(x, k = 20, m = 2): 380s [1] 20 20 380s .psortKM(y, k = 20, m = 2): 380s [1] 20 20 380s .psortKM(x, k = 20, m = 3): 380s [1] 20 20 20 380s .psortKM(y, k = 20, m = 3): 380s [1] 20 20 20 380s .psortKM(x, k = 20, m = 4): 380s [1] 17 20 20 20 380s .psortKM(y, k = 20, m = 4): 380s [1] 17 20 20 20 380s .psortKM(x, k = 20, m = 5): 380s [1] 16 17 20 20 20 380s .psortKM(y, k = 20, m = 5): 380s [1] 16 17 20 20 20 380s .psortKM(x, k = 21, m = 1): 380s [1] 21 380s .psortKM(y, k = 21, m = 1): 380s [1] 21 380s .psortKM(x, k = 21, m = 2): 380s [1] 20 21 380s .psortKM(y, k = 21, m = 2): 380s [1] 20 21 380s .psortKM(x, k = 21, m = 3): 380s [1] 20 20 21 380s .psortKM(y, k = 21, m = 3): 380s [1] 20 20 21 380s .psortKM(x, k = 21, m = 4): 380s [1] 20 20 20 21 380s .psortKM(y, k = 21, m = 4): 380s [1] 20 20 20 21 380s .psortKM(x, k = 21, m = 5): 380s [1] 17 20 20 20 21 380s .psortKM(y, k = 21, m = 5): 380s [1] 17 20 20 20 21 380s .psortKM(x, k = 30, m = 1): 380s [1] 30 380s .psortKM(y, k = 30, m = 1): 380s [1] 30 380s .psortKM(x, k = 30, m = 2): 380s [1] 29 30 380s .psortKM(y, k = 30, m = 2): 380s [1] 29 30 380s .psortKM(x, k = 30, m = 3): 380s [1] 28 29 30 380s .psortKM(y, k = 30, m = 3): 380s [1] 28 29 30 380s .psortKM(x, k = 30, m = 4): 380s [1] 27 28 29 30 380s .psortKM(y, k = 30, m = 4): 380s [1] 27 28 29 30 380s .psortKM(x, k = 30, m = 5): 380s [1] 26 27 28 29 30 380s .psortKM(y, k = 30, m = 5): 380s [1] 26 27 28 29 30 380s > 380s 380s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 380s Copyright (C) 2025 The R Foundation for Statistical Computing 380s Platform: aarch64-unknown-linux-gnu 380s 380s R is free software and comes with ABSOLUTELY NO WARRANTY. 380s You are welcome to redistribute it under certain conditions. 380s Type 'license()' or 'licence()' for distribution details. 380s 380s R is a collaborative project with many contributors. 380s Type 'contributors()' for more information and 380s 'citation()' on how to cite R or R packages in publications. 380s 380s Type 'demo()' for some demos, 'help()' for on-line help, or 380s 'help.start()' for an HTML browser interface to help. 380s Type 'q()' to quit R. 380s 380s > library("matrixStats") 380s > 380s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 380s + if (is.na(value)) { 380s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 380s + } else { 380s + y <- x == value 380s + 380s + # Preserve dimnames attribute 380s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 380s + if (!isTRUE(all.equal(dim(y), dim))) { 380s + dim(y) <- dim 380s + dimnames(y) <- dimnames(x) 380s + } 380s + 380s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 380s + } 380s + if (!useNames) names(res) <- NULL 380s + res 380s + } 380s > 380s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 380s + if (is.na(value)) { 380s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 380s + } else { 380s + y <- x == value 380s + 380s + # Preserve dimnames attribute 380s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 380s + if (!isTRUE(all.equal(dim(y), dim))) { 380s + dim(y) <- dim 380s + dimnames(y) <- dimnames(x) 380s + } 380s + 380s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 380s + } 380s + if (!useNames) names(res) <- NULL 380s + res 380s + } 380s > 380s > rowAnyMissings_R <- function(x, ..., useNames = TRUE) { 380s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 380s + if (!useNames) names(res) <- NULL 380s + res 380s + } 380s > 380s > 380s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 380s > # Data type: logical 380s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 380s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 380s > x[7:8, 2:3] <- TRUE 380s > x[1:3, ] <- TRUE 380s > x[, 1] <- TRUE 380s > x[4, ] <- FALSE 380s > x[, 4] <- FALSE 380s > x[2, ] <- FALSE 380s > x[3, ] <- TRUE 380s > 380s > # To check names attribute 380s > dimnames <- list(letters[1:10], LETTERS[1:4]) 380s > 380s > for (kk in 1:3) { 380s + if (kk == 2) { 380s + x[2, 2] <- NA 380s + } else if (kk == 3) { 380s + x[, 2] <- NA 380s + x[2, ] <- NA 380s + } 380s + 380s + # Test with and without dimnames on x 380s + for (setDimnames in c(TRUE, FALSE)) { 380s + dimnames(x) <- if (setDimnames) dimnames else NULL 380s + 380s + for (na.rm in c(FALSE, TRUE)) { 380s + # Check names attribute 380s + for (useNames in c(TRUE, FALSE)) { 380s + m0 <- rowAlls_R(x, na.rm = na.rm, useNames = useNames) 380s + m1 <- rowAlls(x, na.rm = na.rm, useNames = useNames) 380s + m2 <- colAlls(t(x), na.rm = na.rm, useNames = useNames) 380s + str(list("all()", m0 = m0, m1 = m1, m2 = m2)) 380s + stopifnot(identical(m1, m0)) 380s + stopifnot(identical(m2, m0)) 380s + 380s + m0 <- rowAnys_R(x, na.rm = na.rm, useNames = useNames) 380s + m1 <- rowAnys(x, na.rm = na.rm, useNames = useNames) 380s + m2 <- colAnys(t(x), na.rm = na.rm, useNames = useNames) 380s + str(list("any()", m0 = m0, m1 = m1, m2 = m2)) 380s + stopifnot(identical(m1, m0)) 380s + stopifnot(identical(m2, m0)) 380s + 380s + m0 <- rowAnyMissings_R(x, useNames = useNames) 380s + m1 <- rowAnyMissings(x, useNames = useNames) 380s + m2 <- colAnyMissings(t(x), useNames = useNames) 380s + str(list("anyMissing()", m0 = m0, m1 = m1, m2 = m2)) 380s + stopifnot(identical(m1, m0)) 380s + stopifnot(identical(m2, m0)) 380s + } 380s + } 380s + } 380s + } # for (kk ...) 380s List of 4 380s $ : chr "all()" 380s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "any()" 380s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "any()" 380s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "all()" 380s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "any()" 380s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "any()" 380s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "any()" 380s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "any()" 380s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "any()" 380s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "any()" 380s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "all()" 380s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "any()" 380s $ m0: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "any()" 380s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "all()" 380s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "any()" 380s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "any()" 380s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "any()" 380s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "any()" 380s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 380s List of 4 380s $ : chr "anyMissing()" 380s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 380s List of 4 380s $ : chr "all()" 380s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 380s List of 4 381s $ : chr "any()" 381s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s List of 4 381s $ : chr "anyMissing()" 381s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 381s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 381s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 381s List of 4 381s $ : chr "all()" 381s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 381s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 381s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 381s List of 4 381s $ : chr "any()" 381s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s List of 4 381s $ : chr "anyMissing()" 381s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 381s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 381s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 381s List of 4 381s $ : chr "all()" 381s $ m0: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m1: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m2: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s List of 4 381s $ : chr "any()" 381s $ m0: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m1: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m2: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s List of 4 381s $ : chr "anyMissing()" 381s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s List of 4 381s $ : chr "all()" 381s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s List of 4 381s $ : chr "any()" 381s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s List of 4 381s $ : chr "anyMissing()" 381s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s List of 4 381s $ : chr "all()" 381s $ m0: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m1: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m2: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s List of 4 381s $ : chr "any()" 381s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s List of 4 381s $ : chr "anyMissing()" 381s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 381s List of 4 381s $ : chr "all()" 381s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s List of 4 381s $ : chr "any()" 381s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s List of 4 381s $ : chr "anyMissing()" 381s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s List of 4 381s $ : chr "all()" 381s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s List of 4 381s $ : chr "any()" 381s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s List of 4 381s $ : chr "anyMissing()" 381s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s List of 4 381s $ : chr "all()" 381s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 381s List of 4 381s $ : chr "any()" 381s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 381s List of 4 381s $ : chr "anyMissing()" 381s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s List of 4 381s $ : chr "all()" 381s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s List of 4 381s $ : chr "any()" 381s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s List of 4 381s $ : chr "anyMissing()" 381s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s List of 4 381s $ : chr "all()" 381s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 381s List of 4 381s $ : chr "any()" 381s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 381s List of 4 381s $ : chr "anyMissing()" 381s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 381s > 381s > 381s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 381s > # Data type: integer 381s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 381s > x <- matrix(rep(1:6, length.out = 4 * 5), nrow = 4L, ncol = 5L) 381s > x[2, ] <- 7L 381s > x[3, 1] <- 7L 381s > x[2:3, 3:4] <- NA_integer_ 381s > 381s > # To check names attribute 381s > dimnames <- list(letters[1:4], LETTERS[1:5]) 381s > 381s > # Row/column counts 381s > value <- 7L 381s > 381s > # Test with and without dimnames on x 381s > for (setDimnames in c(TRUE, FALSE)) { 381s + dimnames(x) <- if (setDimnames) dimnames else NULL 381s + for (na.rm in c(FALSE, TRUE)) { 381s + # Check names attribute 381s + for (useNames in c(TRUE, FALSE)) { 381s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 381s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 381s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 381s + stopifnot(identical(r1, r0)) 381s + stopifnot(identical(r2, r1)) 381s + if (!useNames && !setDimnames) { 381s + for (rr in seq_len(nrow(x))) { 381s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 381s + stopifnot(identical(c, r1[rr])) 381s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 381s + stopifnot(identical(c, r1[rr])) 381s + } 381s + } 381s + 381s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 381s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 381s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 381s + stopifnot(identical(r1, r0)) 381s + stopifnot(identical(r2, r1)) 381s + if (!useNames && !setDimnames) { 381s + for (rr in seq_len(nrow(x))) { 381s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 381s + stopifnot(identical(c, r1[rr])) 381s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 381s + stopifnot(identical(c, r1[rr])) 381s + } 381s + } 381s + } 381s + } 381s + } 381s > 381s > 381s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 381s > # rowAlls(x) et al. on numeric 'x' with logical 'value' 381s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 381s > x <- matrix(0, nrow = 4L, ncol = 5L) 381s > x[2:4, 2] <- (1:3) / 4 381s > x[2, 2:4] <- (1:3) / 4 381s > x[3:4, 3] <- (3:4) / 4 381s > x[3, 3:4] <- (3:4) / 4 381s > x[1:4, 5] <- (1:4) / 5 381s > x[4, 4] <- NA_real_ 381s > 381s > # To check names attribute 381s > dimnames <- list(letters[1:4], LETTERS[1:5]) 381s > 381s > for (value in c(TRUE, FALSE)) { 381s + for (na.rm in c(FALSE, TRUE)) { 381s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 381s + y <- rowAnys(x, na.rm = na.rm, value = value) 381s + stopifnot(identical(y, y0)) 381s + # Check names attribute 381s + dimnames(x) <- dimnames 381s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 381s + stopifnot(all.equal(y, y0)) 381s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 381s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 381s + stopifnot(all.equal(y, y0)) 381s + dimnames(x) <- NULL 381s + 381s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 381s + y <- colAnys(x, na.rm = na.rm, value = value) 381s + stopifnot(identical(y, y0)) 381s + # Check names attribute 381s + dimnames(x) <- dimnames 381s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 381s + stopifnot(all.equal(y, y0)) 381s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 381s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 381s + stopifnot(all.equal(y, y0)) 381s + dimnames(x) <- NULL 381s + 381s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 381s + y <- rowAlls(x, na.rm = na.rm, value = value) 381s + stopifnot(identical(y, y0)) 381s + # Check names attribute 381s + dimnames(x) <- dimnames 381s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 381s + stopifnot(all.equal(y, y0)) 381s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 381s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 381s + stopifnot(all.equal(y, y0)) 381s + dimnames(x) <- NULL 381s + 381s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 381s + y <- colAlls(x, na.rm = na.rm, value = value) 381s + stopifnot(identical(y, y0)) 381s + print(y0) 381s + # Check names attribute 381s + dimnames(x) <- dimnames 381s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 381s + stopifnot(all.equal(y, y0)) 381s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 381s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 381s + stopifnot(all.equal(y, y0)) 381s + dimnames(x) <- NULL 381s + } ## for (na.rm ...) 381s + } ## for(value ...) 381s [1] FALSE FALSE FALSE FALSE TRUE 381s [1] FALSE FALSE FALSE FALSE TRUE 381s [1] TRUE FALSE FALSE FALSE FALSE 381s [1] TRUE FALSE FALSE FALSE FALSE 381s > 381s > 381s > 381s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 381s > # Data type: character (not sure if this should be supported) 381s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 381s > all_R <- function(x, value = TRUE, ...) { 381s + if (is.na(value)) { 381s + all(is.na(x), ...) 381s + } else { 381s + all(x == value, ...) 381s + } 381s + } 381s > 381s > any_R <- function(x, value = TRUE, ...) { 381s + if (is.na(value)) { 381s + any(is.na(x), ...) 381s + } else { 381s + any(x == value, ...) 381s + } 381s + } 381s > 381s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 381s > x[2, ] <- "g" 381s > x[2:4, 3:4] <- NA_character_ 381s > 381s > # To check names attribute 381s > dimnames <- list(letters[1:10], LETTERS[1:5]) 381s > 381s > # Test with and without dimnames on x 381s > for (setDimnames in c(TRUE, FALSE)) { 381s + dimnames(x) <- if (setDimnames) dimnames else NULL 381s + 381s + # Row/column counts 381s + for (value in c("g", NA_character_)) { 381s + for (na.rm in c(FALSE, TRUE)) { 381s + # Check names attribute 381s + for (useNames in c(TRUE, FALSE)) { 381s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 381s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 381s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 381s + stopifnot(identical(r1, r0)) 381s + stopifnot(identical(r2, r1)) 381s + if (!useNames && !setDimnames) { 381s + for (rr in seq_len(nrow(x))) { 381s + c0 <- all_R(x[rr, ], value, na.rm = na.rm) 381s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 381s + stopifnot(identical(c, r1[rr])) 381s + stopifnot(identical(c, c0)) 381s + } 381s + } 381s + 381s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 381s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 381s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 381s + stopifnot(identical(r1, r0)) 381s + stopifnot(identical(r2, r1)) 381s + if (!useNames && !setDimnames) { 381s + for (rr in seq_len(nrow(x))) { 381s + c0 <- any_R(x[rr, ], value, na.rm = na.rm) 381s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 381s + stopifnot(identical(c, c0)) 381s + stopifnot(identical(c, r1[rr])) 381s + } 381s + } 381s + } 381s + } 381s + } 381s + } 381s > 381s > 381s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 381s > # NA 0 test 381s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 381s > x <- matrix(0, nrow = 3L, ncol = 3L) 381s > x[1, ] <- c(NA_real_, NA_real_, 0) 381s > x[3, ] <- c(1, 0, 1) 381s > 381s > dimnames <- list(letters[1:3], LETTERS[1:3]) 381s > 381s > # Test with and without dimnames on x 381s > for (setDimnames in c(TRUE, FALSE)) { 381s + dimnames(x) <- if (setDimnames) dimnames else NULL 381s + # Check names attribute 381s + for (useNames in c(TRUE, FALSE)) { 381s + r0 <- rowAnys_R(x, value = 0, useNames = useNames) 381s + r1 <- rowAnys(x, value = 0, useNames = useNames) 381s + stopifnot(identical(r0, r1)) 381s + } 381s + } 381s > 381s 381s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 381s Copyright (C) 2025 The R Foundation for Statistical Computing 381s Platform: aarch64-unknown-linux-gnu 381s 381s R is free software and comes with ABSOLUTELY NO WARRANTY. 381s You are welcome to redistribute it under certain conditions. 381s Type 'license()' or 'licence()' for distribution details. 381s 381s R is a collaborative project with many contributors. 381s Type 'contributors()' for more information and 381s 'citation()' on how to cite R or R packages in publications. 381s 381s Type 'demo()' for some demos, 'help()' for on-line help, or 381s 'help.start()' for an HTML browser interface to help. 381s Type 'q()' to quit R. 381s 381s > library("matrixStats") 381s > 381s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 381s + if (is.na(value)) { 381s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 381s + } else { 381s + y <- x == value 381s + 381s + # Preserve dimnames attribute 381s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 381s + if (!isTRUE(all.equal(dim(y), dim))) { 381s + dim(y) <- dim 381s + dimnames(y) <- dimnames(x) 381s + } 381s + 381s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 381s + } 381s + if (!useNames) names(res) <- NULL 381s + res 381s + } 381s > 381s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 381s + if (is.na(value)) { 381s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 381s + } else { 381s + y <- x == value 381s + 381s + # Preserve dimnames attribute 381s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 381s + if (!isTRUE(all.equal(dim(y), dim))) { 381s + dim(y) <- dim 381s + dimnames(y) <- dimnames(x) 381s + } 381s + 381s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 381s + } 381s + if (!useNames) names(res) <- NULL 381s + res 381s + } 381s > 381s > rowAnyMissings_R <- function(x, ..., useNames = TRUE) { 381s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 381s + if (!useNames) names(res) <- NULL 381s + res 381s + } 381s > 381s > 381s > all_R <- function(x, value = TRUE, ...) { 381s + if (is.na(value)) { 381s + all(is.na(x), ...) 381s + } else { 381s + all(x == value, ...) 381s + } 381s + } 381s > 381s > any_R <- function(x, value = TRUE, ...) { 381s + if (is.na(value)) { 381s + any(is.na(x), ...) 381s + } else { 381s + any(x == value, ...) 381s + } 381s + } 381s > 381s > 381s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 381s > # Subsetted tests 381s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 381s > source("utils/validateIndicesFramework.R") 381s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 381s > storage.mode(x) <- "integer" 381s > x[2:3, ] <- NA_integer_ 381s > x[2, 1] <- 0L 381s > x[4:5, ] <- 0L 381s > x[4, 6] <- NA_integer_ 381s > 381s > # To check names attribute 381s > dimnames <- list(letters[1:6], LETTERS[1:6]) 381s > 381s > # Test with and without dimnames on x 381s > for (setDimnames in c(TRUE, FALSE)) { 381s + if (setDimnames) dimnames(x) <- dimnames 381s + else dimnames(x) <- NULL 381s + 381s + count <- 0L 381s + for (rows in index_cases) { 381s + for (cols in index_cases) { 381s + count <- count + 1L 381s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 381s + useNames <- c(TRUE, FALSE) 381s + useNames <- useNames[count %% length(useNames) + 1] 381s + 381s + validateIndicesTestMatrix(x, rows, cols, 381s + ftest = rowAlls, fsure = rowAlls_R, 381s + value = 0, na.rm = TRUE, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + ftest = rowAlls, fsure = rowAlls_R, 381s + value = 0, na.rm = FALSE, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + ftest = rowAlls, fsure = rowAlls_R, 381s + value = NA_integer_, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + fcoltest = colAlls, fsure = rowAlls_R, 381s + value = 0, na.rm = TRUE, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + fcoltest = colAlls, fsure = rowAlls_R, 381s + value = 0, na.rm = FALSE, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + fcoltest = colAlls, fsure = rowAlls_R, 381s + value = NA_integer_, useNames = useNames) 381s + 381s + validateIndicesTestMatrix(x, rows, cols, 381s + ftest = rowAnys, fsure = rowAnys_R, 381s + value = 0, na.rm = TRUE, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + ftest = rowAnys, fsure = rowAnys_R, 381s + value = 0, na.rm = FALSE, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + ftest = rowAnys, fsure = rowAnys_R, 381s + value = NA_integer_, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + fcoltest = colAnys, fsure = rowAnys_R, 381s + value = 0, na.rm = TRUE, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + fcoltest = colAnys, fsure = rowAnys_R, 381s + value = 0, na.rm = FALSE, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + fcoltest = colAnys, fsure = rowAnys_R, 381s + value = NA_integer_, useNames = useNames) 381s + 381s + validateIndicesTestMatrix(x, rows, cols, 381s + ftest = rowAnyMissings, 381s + fsure = rowAnyMissings_R, useNames = useNames) 381s + validateIndicesTestMatrix(x, rows, cols, 381s + fcoltest = colAnyMissings, 381s + fsure = rowAnyMissings_R, useNames = useNames) 381s + } 381s + } 381s + } 383s > 383s > for (rr in seq_len(nrow(x))) { 383s + for (idxs in index_cases) { 383s + validateIndicesTestVector(x[rr, ], idxs, 383s + ftest = allValue, fsure = all_R, 383s + value = 0, na.rm = TRUE) 383s + validateIndicesTestVector(x[rr, ], idxs, 383s + ftest = allValue, fsure = all_R, 383s + value = 0, na.rm = FALSE) 383s + validateIndicesTestVector(x[rr, ], idxs, 383s + ftest = allValue, fsure = all_R, 383s + value = NA_integer_) 383s + 383s + validateIndicesTestVector(x[rr, ], idxs, 383s + ftest = anyValue, fsure = any_R, 383s + value = 0, na.rm = TRUE) 383s + validateIndicesTestVector(x[rr, ], idxs, 383s + ftest = anyValue, fsure = any_R, 383s + value = 0, na.rm = FALSE) 383s + validateIndicesTestVector(x[rr, ], idxs, 383s + ftest = anyValue, fsure = any_R, 383s + value = NA_integer_) 383s + } 383s + } 383s > 383s > 383s > storage.mode(x) <- "character" 383s > # Test with and without dimnames on x 383s > for (setDimnames in c(TRUE, FALSE)) { 383s + if (setDimnames) dimnames(x) <- dimnames 383s + else dimnames(x) <- NULL 383s + for (rows in index_cases) { 383s + for (cols in index_cases) { 383s + # Check names attribute 383s + for (useNames in c(TRUE, FALSE)) { 383s + validateIndicesTestMatrix(x, rows, cols, 383s + ftest = rowAlls, fsure = rowAlls_R, 383s + value = "0", na.rm = TRUE, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + ftest = rowAlls, fsure = rowAlls_R, 383s + value = "0", na.rm = FALSE, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + ftest = rowAlls, fsure = rowAlls_R, 383s + value = NA_character_, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + fcoltest = colAlls, fsure = rowAlls_R, 383s + value = "0", na.rm = TRUE, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + fcoltest = colAlls, fsure = rowAlls_R, 383s + value = "0", na.rm = FALSE, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + fcoltest = colAlls, fsure = rowAlls_R, 383s + value = NA_character_, useNames = useNames) 383s + 383s + validateIndicesTestMatrix(x, rows, cols, 383s + ftest = rowAnys, fsure = rowAnys_R, 383s + value = "0", na.rm = TRUE, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + ftest = rowAnys, fsure = rowAnys_R, 383s + value = "0", na.rm = FALSE, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + ftest = rowAnys, fsure = rowAnys_R, 383s + value = NA_character_, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + fcoltest = colAnys, fsure = rowAnys_R, 383s + value = "0", na.rm = TRUE, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + fcoltest = colAnys, fsure = rowAnys_R, 383s + value = "0", na.rm = FALSE, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + fcoltest = colAnys, fsure = rowAnys_R, 383s + value = NA_character_, useNames = useNames) 383s + 383s + validateIndicesTestMatrix(x, rows, cols, 383s + ftest = rowAnyMissings, 383s + fsure = rowAnyMissings_R, useNames = useNames) 383s + validateIndicesTestMatrix(x, rows, cols, 383s + fcoltest = colAnyMissings, 383s + fsure = rowAnyMissings_R, useNames = useNames) 383s + } 383s + } 383s + } 383s + } 386s > 386s > for (rr in seq_len(nrow(x))) { 386s + for (idxs in index_cases) { 386s + validateIndicesTestVector(x[rr, ], idxs, 386s + ftest = allValue, fsure = all_R, 386s + value = "0", na.rm = TRUE) 386s + validateIndicesTestVector(x[rr, ], idxs, 386s + ftest = allValue, fsure = all_R, 386s + value = "0", na.rm = FALSE) 386s + validateIndicesTestVector(x[rr, ], idxs, 386s + ftest = allValue, fsure = all_R, 386s + value = NA_integer_) 386s + 386s + validateIndicesTestVector(x[rr, ], idxs, 386s + ftest = anyValue, fsure = any_R, 386s + value = "0", na.rm = TRUE) 386s + validateIndicesTestVector(x[rr, ], idxs, 386s + ftest = anyValue, fsure = any_R, 386s + value = "0", na.rm = FALSE) 386s + validateIndicesTestVector(x[rr, ], idxs, 386s + ftest = anyValue, fsure = any_R, 386s + value = NA_integer_) 386s + } 386s + } 386s > 386s 386s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 386s Copyright (C) 2025 The R Foundation for Statistical Computing 386s Platform: aarch64-unknown-linux-gnu 386s 386s R is free software and comes with ABSOLUTELY NO WARRANTY. 386s You are welcome to redistribute it under certain conditions. 386s Type 'license()' or 'licence()' for distribution details. 386s 386s R is a collaborative project with many contributors. 386s Type 'contributors()' for more information and 386s 'citation()' on how to cite R or R packages in publications. 386s 386s Type 'demo()' for some demos, 'help()' for on-line help, or 386s 'help.start()' for an HTML browser interface to help. 386s Type 'q()' to quit R. 386s 386s > library("matrixStats") 386s > 386s > X <- matrix(rnorm(20 * 6), nrow = 20, ncol = 6) 386s > rownames(X) <- LETTERS[1:nrow(X)] 386s > colnames(X) <- letters[1:ncol(X)] 386s > print(X) 386s a b c d e f 386s A -0.24333193 -0.8900931 1.2726635 -1.29578291 -0.0576723 -0.50569523 386s B 0.16341821 -1.4497577 0.1277851 1.76393191 -1.3795084 0.37025014 386s C -0.94697140 -1.9268971 -1.0658575 -2.13616251 0.4198552 -0.44920203 386s D -0.50423481 0.3292938 0.7151182 2.08993573 -0.4076433 -0.90717359 386s E 0.26676697 -1.2570085 1.1683048 -0.47570508 0.4513946 0.32414356 386s F -0.11560603 -0.7351621 0.1652618 0.20466035 1.1292877 0.34841698 386s G 1.53425714 0.9298848 1.6927367 -0.34246171 -1.8461859 1.73329476 386s H -0.80976431 1.0093537 -1.1011519 -0.78963001 -0.2835351 0.05548269 386s I 0.10021654 -0.9048403 2.3709071 -0.25346369 -0.6403267 -0.66518682 386s J -0.26159898 -0.5093170 0.8246507 -0.82404264 -0.8807125 0.06541015 386s K 0.32260082 -0.6540961 0.3627653 -0.23955193 0.5245815 0.60641393 386s L 1.01681001 0.4113612 -0.0616647 0.56542696 0.0482074 1.36685061 386s M 0.02841377 0.1884626 1.5978641 -1.20875343 -0.5609451 2.86927513 386s N 0.84487982 -0.3300083 1.8841926 0.31287312 -0.7853327 2.26993526 386s O 1.69591988 -0.5480248 2.3831841 -0.03468609 0.8230426 -2.70692981 386s P -0.87066633 0.4782663 0.2755843 -1.23412769 2.1239741 0.47889269 386s Q -0.55100904 -1.3038565 -0.7255986 -0.89342773 0.6843780 0.62209191 386s R 0.11438543 -1.4404763 0.6046374 0.72940448 0.1733602 0.74882216 386s S 0.03547210 -0.8799219 -0.6209839 -1.04871488 1.0070230 0.55706193 386s T -0.52553632 0.3775482 0.3777625 0.71570621 -1.6589522 -1.12339567 386s > 386s > 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > # Apply rowMeans() for 3 sets of 2 columns 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > nbr_of_sets <- 3L 386s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 386s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 386s > print(S) 386s s1 s2 s3 386s [1,] 1 3 5 386s [2,] 2 4 6 386s > 386s > Z <- rowAvgsPerColSet(X, S = S) 386s > print(Z) 386s s1 s2 s3 386s A -0.56671250 -0.011559693 -0.28168376 386s B -0.64316975 0.945858530 -0.50462911 386s C -1.43693424 -1.601010002 -0.01467343 386s D -0.08747052 1.402526947 -0.65740844 386s E -0.49512076 0.346299839 0.38776909 386s F -0.42538405 0.184961092 0.73885233 386s G 1.23207097 0.675137471 -0.05644556 386s H 0.09979472 -0.945390975 -0.11402623 386s I -0.40231187 1.058721683 -0.65275674 386s J -0.38545797 0.000304049 -0.40765120 386s K -0.16574763 0.061606693 0.56549770 386s L 0.71408561 0.251881126 0.70752900 386s M 0.10843819 0.194555356 1.15416499 386s N 0.25743577 1.098532856 0.74230129 386s O 0.57394754 1.174248999 -0.94194363 386s P -0.19620003 -0.479271673 1.30143339 386s Q -0.92743276 -0.809513147 0.65323494 386s R -0.66304544 0.667020951 0.46109116 386s S -0.42222489 -0.834849377 0.78204245 386s T -0.07399407 0.546734356 -1.39117394 386s > 386s > # Validation 386s > Z0 <- cbind(s1 = rowMeans(X[, 1:2]), s2 = rowMeans(X[, 3:4]), 386s + s3 = rowMeans(X[, 5:6])) 386s > stopifnot(identical(drop(Z), Z0)) 386s > 386s > 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > # Apply colMeans() for 5 sets of 4 rows 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > nbr_of_sets <- 5L 386s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 386s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 386s > print(S) 386s s1 s2 s3 s4 s5 386s [1,] 1 5 9 13 17 386s [2,] 2 6 10 14 18 386s [3,] 3 7 11 15 19 386s [4,] 4 8 12 16 20 386s > 386s > Z <- colAvgsPerRowSet(X, S = S) 386s > print(Z) 386s a b c d e f 386s s1 -0.3827800 -0.98436352 0.26242733 0.1054806 -0.35624220 -0.3729552 386s s2 0.2189134 -0.01323300 0.48128783 -0.3507841 -0.13725968 0.6153345 386s s3 0.2945071 -0.41422303 0.87416460 -0.1879078 -0.23706258 0.3433720 386s s4 0.4246368 -0.05282605 1.53520629 -0.5411735 0.40018470 0.7277933 386s s5 -0.2316720 -0.81167662 -0.09104563 -0.1242580 0.05145221 0.2011451 386s > 386s > # Validation 386s > Z0 <- rbind(s1 = colMeans(X[1:4, ]), s2 = colMeans(X[5:8, ]), 386s + s3 = colMeans(X[9:12, ]), s4 = colMeans(X[13:16, ]), 386s + s5 = colMeans(X[17:20, ])) 386s > stopifnot(identical(drop(Z), Z0)) 386s > 386s > 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > # When there is only one "complete" set 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > nbr_of_sets <- 1L 386s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 386s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 386s > print(S) 386s s1 386s [1,] 1 386s [2,] 2 386s [3,] 3 386s [4,] 4 386s [5,] 5 386s [6,] 6 386s > 386s > Z <- rowAvgsPerColSet(X, S = S, FUN = rowMeans) 386s > print(Z) 386s s1 386s A -0.28665199 386s B -0.06731344 386s C -1.01753923 386s D 0.21921600 386s E 0.07964939 386s F 0.16614312 386s G 0.61692096 386s H -0.31987416 386s I 0.00121769 386s J -0.26426837 386s K 0.15378559 386s L 0.55783191 386s M 0.48571951 386s N 0.69942331 386s O 0.26875097 386s P 0.20865389 386s Q -0.36123699 386s R 0.15502222 386s S -0.15834394 386s T -0.30614455 386s > 386s > Z0 <- rowMeans(X) 386s > stopifnot(identical(drop(Z), Z0)) 386s > 386s > 386s > nbr_of_sets <- 1L 386s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 386s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 386s > print(S) 386s s1 386s [1,] 1 386s [2,] 2 386s [3,] 3 386s [4,] 4 386s [5,] 5 386s [6,] 6 386s [7,] 7 386s [8,] 8 386s [9,] 9 386s [10,] 10 386s [11,] 11 386s [12,] 12 386s [13,] 13 386s [14,] 14 386s [15,] 15 386s [16,] 16 386s [17,] 17 386s [18,] 18 386s [19,] 19 386s [20,] 20 386s > 386s > Z <- colAvgsPerRowSet(X, S = S, FUN = colMeans) 386s > print(Z) 386s a b c d e f 386s s1 0.06472108 -0.4552644 0.6124081 -0.2197286 -0.05578551 0.3029379 386s > 386s > Z0 <- colMeans(X) 386s > stopifnot(identical(drop(Z), Z0)) 386s > 386s > 386s > 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > # Use weights 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > nbr_of_sets <- 3L 386s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 386s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 386s > print(S) 386s s1 s2 s3 386s [1,] 1 3 5 386s [2,] 2 4 6 386s > 386s > W <- matrix(runif(length(X)), nrow = nrow(X), ncol = ncol(X)) 386s > Z1 <- rowAvgsPerColSet(X, W = W, S = S, FUN = rowWeightedMeans) 386s > print(Z1) 386s s1 s2 s3 386s A -0.56671250 -0.011559693 -0.28168376 386s B -0.64316975 0.945858530 -0.50462911 386s C -1.43693424 -1.601010002 -0.01467343 386s D -0.08747052 1.402526947 -0.65740844 386s E -0.49512076 0.346299839 0.38776909 386s F -0.42538405 0.184961092 0.73885233 386s G 1.23207097 0.675137471 -0.05644556 386s H 0.09979472 -0.945390975 -0.11402623 386s I -0.40231187 1.058721683 -0.65275674 386s J -0.38545797 0.000304049 -0.40765120 386s K -0.16574763 0.061606693 0.56549770 386s L 0.71408561 0.251881126 0.70752900 386s M 0.10843819 0.194555356 1.15416499 386s N 0.25743577 1.098532856 0.74230129 386s O 0.57394754 1.174248999 -0.94194363 386s P -0.19620003 -0.479271673 1.30143339 386s Q -0.92743276 -0.809513147 0.65323494 386s R -0.66304544 0.667020951 0.46109116 386s S -0.42222489 -0.834849377 0.78204245 386s T -0.07399407 0.546734356 -1.39117394 386s > Z2 <- colAvgsPerRowSet(X, W = W, S = S, FUN = colWeightedMeans) 386s > print(Z2) 386s a b c d e f 386s s1 -0.03995686 -1.1699254 0.7002243 0.23407450 -0.718590332 -0.06772254 386s s2 -0.72560310 -0.7988017 -0.1753697 -0.02311339 0.006105935 -0.67818781 386s s3 0.07558047 -0.9960853 0.6667833 -0.13552236 0.790341153 0.33628027 386s > 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > # Result should always be a matrix, including when nrow(X) <= 1 386s > # (https://github.com/HenrikBengtsson/matrixStats/issues/108) 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > X <- matrix(1:3, nrow = 1L, ncol = 3L) 386s > S <- matrix(1, nrow = 1L, ncol = 1L) 386s > Z1 <- rowAvgsPerColSet(X, S = S) 386s > stopifnot(is.matrix(Z1)) 386s > Z2 <- rowAvgsPerColSet(X, S = S, rows = 0) 386s > stopifnot(is.matrix(Z2)) 386s > 386s > 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > # Works with many, one or zero columns / rows 386s > # (https://github.com/HenrikBengtsson/matrixStats/issues/172) 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > S <- cbind(1:2, 3:4, 5:6) 386s > X <- matrix(rnorm(2 * 6), nrow = 6, ncol = 2) 386s > Z2 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 386s > Z2_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 386s + colSums2(X[S[,2], ,drop=FALSE]), 386s + colSums2(X[S[,3], ,drop=FALSE])) 386s > stopifnot(identical(Z2, Z2_ref)) 386s > X <- matrix(rnorm(6), nrow = 6, ncol = 1) 386s > Z1 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 386s > Z1_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 386s + colSums2(X[S[,2], ,drop=FALSE]), 386s + colSums2(X[S[,3], ,drop=FALSE])) 386s > stopifnot(identical(Z1, Z1_ref)) 386s > X <- matrix(numeric(0), nrow = 6, ncol = 0) 386s > Z0 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 386s > Z0_ref <- matrix(numeric(0), nrow = ncol(S), ncol = 0) 386s > stopifnot(identical(Z0, unname(Z0_ref))) 386s > 386s > 386s > S <- rbind(1:4, 5:8) 386s > X <- matrix(rnorm(n = 2 * 8), nrow = 2, ncol = 8) 386s > Z2 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 386s > Z2_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 386s + rowMeans2(X[,S[,2],drop=FALSE]), 386s + rowMeans2(X[,S[,3],drop=FALSE]), 386s + rowMeans2(X[,S[,4],drop=FALSE])) 386s > stopifnot(identical(Z2, Z2_ref)) 386s > X <- matrix(rnorm(n = 8), nrow = 1, ncol = 8) 386s > Z1 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 386s > Z1_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 386s + rowMeans2(X[,S[,2],drop=FALSE]), 386s + rowMeans2(X[,S[,3],drop=FALSE]), 386s + rowMeans2(X[,S[,4],drop=FALSE])) 386s > stopifnot(identical(Z1, Z1_ref)) 386s > X <- matrix(numeric(0), nrow = 0, ncol = 8) 386s > Z0 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 386s > Z0_ref <- matrix(numeric(0), nrow = 0, ncol = ncol(S)) 386s > stopifnot(identical(Z0, Z0_ref)) 386s > 386s 386s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 386s Copyright (C) 2025 The R Foundation for Statistical Computing 386s Platform: aarch64-unknown-linux-gnu 386s 386s R is free software and comes with ABSOLUTELY NO WARRANTY. 386s You are welcome to redistribute it under certain conditions. 386s Type 'license()' or 'licence()' for distribution details. 386s 386s R is a collaborative project with many contributors. 386s Type 'contributors()' for more information and 386s 'citation()' on how to cite R or R packages in publications. 386s 386s Type 'demo()' for some demos, 'help()' for on-line help, or 386s 'help.start()' for an HTML browser interface to help. 386s Type 'q()' to quit R. 386s 386s > library("matrixStats") 386s > 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > # Subsetted tests 386s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 386s > source("utils/validateIndicesFramework.R") 386s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 386s > #W <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 386s > for (rows in index_cases) { 386s + for (cols in index_cases) { 386s + if (is.null(rows)) { 386s + rows <- seq_len(nrow(x)) 386s + rows_finite <- rows 386s + } else { 386s + rows_finite <- rows[is.finite(rows)] 386s + } 386s + 386s + if (is.null(cols)) { 386s + cols <- seq_len(ncol(x)) 386s + cols_finite <- cols 386s + } else { 386s + cols_finite <- cols[is.finite(cols)] 386s + } 386s + 386s + suppressWarnings({ 386s + actual <- tryCatch({ 386s + rowAvgsPerColSet(x, rows = rows, S = matrix(cols, ncol = 1), 386s + FUN = rowMeans) 386s + }, error = function(c) "error") 386s + expect <- tryCatch({ 386s + rowMeans(x[rows, cols_finite, drop = FALSE], na.rm = TRUE) 386s + }, error = function(c) "error") 386s + }) 386s + stopifnot(all.equal(as.vector(actual), expect)) 386s + 386s + suppressWarnings({ 386s + actual <- tryCatch({ 386s + colAvgsPerRowSet(x, cols = cols, S = matrix(rows, ncol = 1), 386s + FUN = colMeans) 386s + }, error = function(c) "error") 386s + expect <- tryCatch({ 386s + colMeans(x[rows_finite, cols, drop = FALSE], na.rm = TRUE) 386s + }, error = function(c) "error") 386s + }) 386s + stopifnot(all.equal(as.vector(actual), expect)) 386s + } 386s + } 386s > 387s 387s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 387s Copyright (C) 2025 The R Foundation for Statistical Computing 387s Platform: aarch64-unknown-linux-gnu 387s 387s R is free software and comes with ABSOLUTELY NO WARRANTY. 387s You are welcome to redistribute it under certain conditions. 387s Type 'license()' or 'licence()' for distribution details. 387s 387s R is a collaborative project with many contributors. 387s Type 'contributors()' for more information and 387s 'citation()' on how to cite R or R packages in publications. 387s 387s Type 'demo()' for some demos, 'help()' for on-line help, or 387s 'help.start()' for an HTML browser interface to help. 387s Type 'q()' to quit R. 387s 387s > library("matrixStats") 387s > 387s > x <- matrix(1:27, ncol = 3) 387s > 387s > # To check names attribute 387s > dimnames <- list(letters[1:9], LETTERS[1:3]) 387s > 387s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 387s + res <- x[, idxs] 387s + # Preserve names attribute? 387s + if (!useNames) names(res) <- NULL 387s + res 387s + } 387s > 387s > idxs <- 1L 387s > # Test with and without dimnames on x 387s > for (setDimnames in c(TRUE, FALSE)) { 387s + if (setDimnames) dimnames(x) <- dimnames 387s + else dimnames(x) <- NULL 387s + # Check names attribute 387s + for (useNames in c(TRUE, FALSE)) { 387s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 387s + y <- rowCollapse(x, idxs, useNames = useNames) 387s + stopifnot(identical(y, y_truth)) 387s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 387s + stopifnot(identical(y2, y)) 387s + } 387s + } 387s > 387s > idxs <- 2L 387s > # Test with and without dimnames on x 387s > for (setDimnames in c(TRUE, FALSE)) { 387s + if (setDimnames) dimnames(x) <- dimnames 387s + else dimnames(x) <- NULL 387s + # Check names attribute 387s + for (useNames in c(TRUE, FALSE)) { 387s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 387s + y <- rowCollapse(x, idxs, useNames = useNames) 387s + stopifnot(identical(y, y_truth)) 387s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 387s + stopifnot(identical(y2, y)) 387s + } 387s + } 387s > 387s > 387s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 387s + res <- c(x[1:5, 1], x[6:9, 3]) 387s + # Preserve names attribute? 387s + if (!useNames) names(res) <- NULL 387s + res 387s + } 387s > 387s > idxs <- c(1, 1, 1, 1, 1, 3, 3, 3, 3) 387s > # Test with and without dimnames on x 387s > for (setDimnames in c(TRUE, FALSE)) { 387s + if (setDimnames) dimnames(x) <- dimnames 387s + else dimnames(x) <- NULL 387s + # Check names attribute 387s + for (useNames in c(TRUE, FALSE)) { 387s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 387s + y <- rowCollapse(x, idxs, useNames = useNames) 387s + stopifnot(identical(y, y_truth)) 387s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 387s + stopifnot(identical(y2, y)) 387s + } 387s + } 387s > 387s > 387s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 387s + res <- c(x[1, 1], x[2, 2], x[3, 3], x[4, 1], x[5, 2], 387s + x[6, 3], x[7, 1], x[8, 2], x[9, 3]) 387s + # Preserve names attribute? 387s + if (useNames) { 387s + names <- rownames(x) 387s + if (!is.null(names)) names(res) <- names 387s + } 387s + res 387s + } 387s > 387s > idxs <- 1:3 387s > # Test with and without dimnames on x 387s > for (setDimnames in c(TRUE, FALSE)) { 387s + if (setDimnames) dimnames(x) <- dimnames 387s + else dimnames(x) <- NULL 387s + # Check names attribute 387s + for (useNames in c(TRUE, FALSE)) { 387s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 387s + y <- rowCollapse(x, idxs, useNames = useNames) 387s + stopifnot(identical(y, y_truth)) 387s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 387s + stopifnot(identical(y2, y)) 387s + } 387s + } 387s > 387s 387s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 387s Copyright (C) 2025 The R Foundation for Statistical Computing 387s Platform: aarch64-unknown-linux-gnu 387s 387s R is free software and comes with ABSOLUTELY NO WARRANTY. 387s You are welcome to redistribute it under certain conditions. 387s Type 'license()' or 'licence()' for distribution details. 387s 387s R is a collaborative project with many contributors. 387s Type 'contributors()' for more information and 387s 'citation()' on how to cite R or R packages in publications. 387s 387s Type 'demo()' for some demos, 'help()' for on-line help, or 387s 'help.start()' for an HTML browser interface to help. 387s Type 'q()' to quit R. 387s 387s > library("matrixStats") 387s > 387s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 387s + ans <- c() 387s + storage.mode(ans) <- storage.mode(x) 387s + for (ii in seq_len(length(idxs))) { 387s + ans[ii] <- x[ii, idxs[ii]] 387s + } 387s + 387s + # Preserve names attribute 387s + if (useNames) { 387s + names <- rownames(x) 387s + if (!is.null(names)) names(ans) <- names 387s + } 387s + 387s + ans 387s + } 387s > 387s > 387s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 387s > # Subsetted tests 387s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 387s > source("utils/validateIndicesFramework.R") 387s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 387s > storage.mode(x) <- "integer" 387s > 387s > # To check names attribute 387s > dimnames <- list(letters[1:6], LETTERS[1:6]) 387s > 387s > for (rows in index_cases) { 387s + if (is.null(rows)) rows <- seq_len(nrow(x)) 387s + 387s + for (idxs in list(2L, seq_len(6L))) { 387s + for (useNames in c(TRUE, FALSE)) { 387s + suppressWarnings({ 387s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 387s + error = function(c) "error") 387s + expect <- tryCatch({ 387s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 387s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 387s + }, error = function(c) "error") 387s + }) 387s + stopifnot(all.equal(actual, expect)) 387s + 387s + suppressWarnings({ 387s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 387s + error = function(c) "error") 387s + }) 387s + stopifnot(all.equal(actual, expect)) 387s + 387s + # Check names attribute 387s + dimnames(x) <- dimnames 387s + suppressWarnings({ 387s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 387s + error = function(c) "error") 387s + expect <- tryCatch({ 387s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 387s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 387s + }, error = function(c) "error") 387s + }) 387s + stopifnot(all.equal(actual, expect)) 387s + 387s + suppressWarnings({ 387s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 387s + error = function(c) "error") 387s + }) 387s + stopifnot(all.equal(actual, expect)) 387s + 387s + dimnames(x) <- NULL 387s + } 387s + } 387s + } 387s > 387s 387s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 387s Copyright (C) 2025 The R Foundation for Statistical Computing 387s Platform: aarch64-unknown-linux-gnu 387s 387s R is free software and comes with ABSOLUTELY NO WARRANTY. 387s You are welcome to redistribute it under certain conditions. 387s Type 'license()' or 'licence()' for distribution details. 387s 387s R is a collaborative project with many contributors. 387s Type 'contributors()' for more information and 387s 'citation()' on how to cite R or R packages in publications. 387s 387s Type 'demo()' for some demos, 'help()' for on-line help, or 387s 'help.start()' for an HTML browser interface to help. 387s Type 'q()' to quit R. 387s 387s > library("matrixStats") 387s > 387s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 387s + if (is.na(value)) { 387s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 387s + sum(is.na(x)) 387s + ) 387s + } else { 387s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 387s + sum(x == value, na.rm = na.rm) 387s + ) 387s + } 387s + # Preserve names attribute 387s + names <- names(counts) 387s + counts <- as.integer(counts) 387s + if (useNames && !is.null(names)) names(counts) <- names 387s + counts 387s + } 387s > 387s > 387s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 387s > # Data type: integer and numeric 387s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 387s > for (mode in c("integer", "double")) { 387s + x <- matrix(runif(10 * 5, min = -3, max = 3), nrow = 10L, ncol = 5L) 387s + x[sample.int(length(x), size = 7L)] <- 0 387s + storage.mode(x) <- mode 387s + 387s + dimnames = list(letters[1:10], LETTERS[1:5]) 387s + 387s + # Test with and without dimnames on x 387s + for (setDimnames in c(TRUE, FALSE)) { 387s + if (setDimnames) dimnames(x) <- dimnames 387s + else dimnames(x) <- NULL 387s + for (na.rm in c(FALSE, TRUE)) { 387s + # Check names attribute 387s + for (useNames in c(TRUE, FALSE)) { 387s + # Count zeros 387s + r0 <- rowCounts_R(x, value = 0, na.rm = na.rm, useNames = useNames) 387s + r1 <- rowCounts(x, value = 0, na.rm = na.rm, useNames = useNames) 387s + r2 <- colCounts(t(x), value = 0, na.rm = na.rm, useNames = useNames) 387s + stopifnot(identical(r1, r0)) 387s + stopifnot(identical(r2, r0)) 387s + 387s + # Count NAs 387s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 387s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 387s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 387s + stopifnot(identical(r1, r0)) 387s + stopifnot(identical(r2, r0)) 387s + 387s + if (mode == "integer") { 387s + ux <- unique(as.vector(x)) 387s + r0 <- r1 <- r2 <- integer(nrow(x)) 387s + for (value in ux) { 387s + r0 <- r0 + rowCounts_R(x, value = value, na.rm = na.rm, useNames = useNames) 387s + r1 <- r1 + rowCounts(x, value = value, na.rm = na.rm, useNames = useNames) 387s + r2 <- r2 + colCounts(t(x), value = value, na.rm = na.rm, useNames = useNames) 387s + stopifnot(identical(r1, r0)) 387s + stopifnot(identical(r2, r0)) 387s + } 387s + stopifnot(all(r0 == ncol(x))) 387s + } # if (mode == "integer") 387s + } # for (useNames ...) 387s + } # for (na.rm ...) 387s + } # for (setDimnames ...) 387s + } # for (mode ...) 387s > 387s > 387s > # All NAs 387s > na_list <- list(NA_integer_, NA_real_, NaN) 387s > for (na_value in na_list) { 387s + x <- matrix(na_value, nrow = 10L, ncol = 5L) 387s + # Test with and without dimnames on x 387s + for (setDimnames in c(TRUE, FALSE)) { 387s + if (setDimnames) dimnames(x) <- dimnames 387s + else dimnames(x) <- NULL 387s + for (na.rm in c(FALSE, TRUE)) { 387s + # Check names attribute 387s + for (useNames in c(TRUE, FALSE)) { 387s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 387s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 387s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 387s + stopifnot(identical(r1, r0)) 387s + stopifnot(identical(r2, r0)) 387s + 387s + # Count NAs 387s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 387s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 387s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 387s + stopifnot(all(r0 == ncol(x))) 387s + stopifnot(identical(r1, r0)) 387s + stopifnot(identical(r2, r0)) 387s + } 387s + } 387s + } 387s + } # for (na_value ...) 387s > 387s > 387s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 387s > # Data type: logical 387s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 387s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 387s > x[7:8, 2:3] <- TRUE 387s > x[1:3, ] <- TRUE 387s > x[, 1] <- TRUE 387s > x[4, ] <- FALSE 387s > x[, 4] <- FALSE 387s > x[2, ] <- FALSE 387s > x[3, ] <- TRUE 387s > 387s > # To check names attribute 387s > dimnames <- list(letters[1:10], LETTERS[1:4]) 387s > 387s > # Test with and without dimnames on x 387s > for (setDimnames in c(TRUE, FALSE)) { 387s + if (setDimnames) dimnames(x) <- dimnames 387s + else dimnames(x) <- NULL 387s + # Row/column counts 387s + for (na.rm in c(FALSE, TRUE)) { 387s + # Check names attribute 387s + for (useNames in c(TRUE, FALSE)) { 387s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 387s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 387s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 387s + stopifnot(identical(r1, r0)) 387s + stopifnot(identical(r2, r0)) 387s + 387s + r_true <- rowCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 387s + r_false <- rowCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 387s + stopifnot(r_true + r_false == ncol(x)) 387s + 387s + c_true <- colCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 387s + c_false <- colCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 387s + stopifnot(c_true + c_false == nrow(x)) 387s + 387s + # Count NAs 387s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 387s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 387s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 387s + stopifnot(identical(r1, r0)) 387s + stopifnot(identical(r2, r0)) 387s + } 387s + } 387s + } 387s > 387s > 387s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 387s > # Data type: character (not sure if this should be supported) 387s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 387s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 387s > x[2:3, 3:4] <- NA_character_ 387s > 387s > # Row/column counts 387s > for (na.rm in c(FALSE, TRUE)) { 387s + for (value in c("g", NA_character_)) { 387s + r0 <- rowCounts_R(x, value = value, na.rm = na.rm) 387s + r1 <- rowCounts(x, value = value, na.rm = na.rm) 387s + r2 <- colCounts(t(x), value = value, na.rm = na.rm) 387s + stopifnot(identical(r1, r0)) 387s + stopifnot(identical(r2, r0)) 387s + 387s + c <- count(x[1, ], value = value, na.rm = na.rm) 387s + stopifnot(identical(c, r1[1])) 387s + 387s + c <- count(x[2, ], value = value, na.rm = na.rm) 387s + stopifnot(identical(c, r1[2])) 387s + } 387s + } 387s > 387s > # NA row 387s > x <- matrix(0, nrow = 2L, ncol = 2L) 387s > x[1, ] <- NA_integer_ 387s > 387s > dimnames <- list(letters[1:2], LETTERS[1:2]) 387s > 387s > # Test with and without dimnames on x 387s > for (setDimnames in c(TRUE, FALSE)) { 387s + if (setDimnames) dimnames(x) <- dimnames 387s + else dimnames(x) <- NULL 387s + # Check names attribute 387s + for (useNames in c(TRUE, FALSE)) { 387s + r0 <- rowCounts(x, value = 0, useNames = useNames) 387s + r1 <- rowCounts_R(x, value = 0, useNames = useNames) 387s + stopifnot(identical(r0, r1)) 387s + } 387s + } 387s > 387s 387s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 387s Copyright (C) 2025 The R Foundation for Statistical Computing 387s Platform: aarch64-unknown-linux-gnu 387s 387s R is free software and comes with ABSOLUTELY NO WARRANTY. 387s You are welcome to redistribute it under certain conditions. 387s Type 'license()' or 'licence()' for distribution details. 387s 387s R is a collaborative project with many contributors. 387s Type 'contributors()' for more information and 387s 'citation()' on how to cite R or R packages in publications. 387s 387s Type 'demo()' for some demos, 'help()' for on-line help, or 387s 'help.start()' for an HTML browser interface to help. 387s Type 'q()' to quit R. 387s 388s > library("matrixStats") 388s > 388s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 388s + if (is.na(value)) { 388s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 388s + sum(is.na(x)) 388s + ) 388s + } else { 388s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 388s + sum(x == value, na.rm = na.rm) 388s + ) 388s + } 388s + # Preserve names attribute 388s + names <- names(counts) 388s + counts <- as.integer(counts) 388s + if (useNames && !is.null(names)) names(counts) <- names 388s + counts 388s + } # rowCounts_R() 388s > 388s > 388s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 388s > # Subsetted tests 388s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 388s > source("utils/validateIndicesFramework.R") 388s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 388s > x[2:3, 3:4] <- NA_real_ 388s > storage.mode(x) <- "integer" 388s > 388s > # To check names attribute 388s > dimnames <- list(letters[1:6], LETTERS[1:6]) 388s > 388s > # Test with and without dimnames on x 388s > for (setDimnames in c(TRUE, FALSE)) { 388s + if (setDimnames) dimnames(x) <- dimnames 388s + else dimnames(x) <- NULL 388s + for (rows in index_cases) { 388s + for (cols in index_cases) { 388s + # Check names attribute 388s + for (useNames in c(TRUE, FALSE)) { 388s + validateIndicesTestMatrix(x, rows, cols, 388s + ftest = rowCounts, fsure = rowCounts_R, 388s + value = 0, na.rm = TRUE, useNames = useNames) 388s + validateIndicesTestMatrix(x, rows, cols, 388s + fcoltest = colCounts, fsure = rowCounts_R, 388s + value = 0, na.rm = TRUE, useNames = useNames) 388s + for (value in c(0, NA_integer_)) { 388s + validateIndicesTestMatrix(x, rows, cols, 388s + ftest = rowCounts, fsure = rowCounts_R, 388s + value = value, useNames = useNames) 388s + validateIndicesTestMatrix(x, rows, cols, 388s + fcoltest = colCounts, fsure = rowCounts_R, 388s + value = value, useNames = useNames) 388s + } 388s + } 388s + } 388s + } 388s + } 389s > 389s > x <- matrix(rep(letters, length.out = 6 * 6), nrow = 6, ncol = 6) 389s > x[2:3, 3:4] <- NA_character_ 389s > # Test with and without dimnames on x 389s > for (setDimnames in c(TRUE, FALSE)) { 389s + if (setDimnames) dimnames(x) <- dimnames 389s + else dimnames(x) <- NULL 389s + 389s + count <- 0L 389s + for (rows in index_cases) { 389s + for (cols in index_cases) { 389s + count <- count + 1L 389s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 389s + useNames <- c(TRUE, FALSE) 389s + useNames <- useNames[count %% length(useNames) + 1] 389s + 389s + validateIndicesTestMatrix(x, rows, cols, 389s + ftest = rowCounts, fsure = rowCounts_R, 389s + value = "g", na.rm = TRUE, useNames = useNames) 389s + validateIndicesTestMatrix(x, rows, cols, 389s + fcoltest = colCounts, fsure = rowCounts_R, 389s + value = "g", na.rm = TRUE, useNames = useNames) 389s + for (value in c("g", NA_character_)) { 389s + validateIndicesTestMatrix(x, rows, cols, 389s + ftest = rowCounts, fsure = rowCounts_R, 389s + value = value, useNames = useNames) 389s + validateIndicesTestMatrix(x, rows, cols, 389s + fcoltest = colCounts, fsure = rowCounts_R, 389s + value = value, useNames = useNames) 389s + } 389s + } 389s + } 389s + } 390s > 390s 390s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 390s Copyright (C) 2025 The R Foundation for Statistical Computing 390s Platform: aarch64-unknown-linux-gnu 390s 390s R is free software and comes with ABSOLUTELY NO WARRANTY. 390s You are welcome to redistribute it under certain conditions. 390s Type 'license()' or 'licence()' for distribution details. 390s 390s R is a collaborative project with many contributors. 390s Type 'contributors()' for more information and 390s 'citation()' on how to cite R or R packages in publications. 390s 390s Type 'demo()' for some demos, 'help()' for on-line help, or 390s 'help.start()' for an HTML browser interface to help. 390s Type 'q()' to quit R. 390s 390s > library("matrixStats") 390s > 390s > rowCummins_R <- function(x, ..., useNames = TRUE) { 390s + suppressWarnings({ 390s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 390s + }) 390s + 390s + # Preserve dimnames attribute? 390s + dim(y) <- dim(x) 390s + dimnames(y) <- if (useNames) dimnames(x) else NULL 390s + y 390s + } 390s > 390s > rowCummaxs_R <- function(x, ..., useNames = TRUE) { 390s + mode <- storage.mode(x) 390s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 390s + storage.mode(x) <- "numeric" 390s + suppressWarnings({ 390s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 390s + }) 390s + 390s + # Preserve dimnames attribute? 390s + dim(y) <- dim(x) 390s + dimnames(y) <- if (useNames) dimnames(x) else NULL 390s + 390s + y 390s + } 390s > 390s > 390s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 390s > # With and without some NAs 390s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 390s > for (mode in c("logical", "integer", "double")) { 390s + for (add_na in c(FALSE, TRUE)) { 390s + cat("add_na = ", add_na, "\n", sep = "") 390s + 390s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 390s + diag(x) <- 0 390s + if (add_na) { 390s + x[3:7, c(2, 4)] <- NA_real_ 390s + } 390s + cat("mode: ", mode, "\n", sep = "") 390s + storage.mode(x) <- mode 390s + str(x) 390s + 390s + # To check dimnames attribute 390s + dimnames <- list(letters[1:10], LETTERS[1:5]) 390s + 390s + # Test with and without dimnames on x 390s + for (setDimnames in c(TRUE, FALSE)) { 390s + if (setDimnames) dimnames(x) <- dimnames 390s + else dimnames(x) <- NULL 390s + # Check names attribute 390s + for (useNames in c(TRUE, FALSE)) { 390s + # Row/column ranges 390s + r0 <- rowCummins_R(x, useNames = useNames) 390s + r1 <- rowCummins(x, useNames = useNames) 390s + r2 <- t(colCummins(t(x), useNames = useNames)) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + 390s + r0 <- rowCummaxs_R(x, useNames = useNames) 390s + r1 <- rowCummaxs(x, useNames = useNames) 390s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + } # for (useNames ...) 390s + } # for (setDimnames ...) 390s + } # for (add_na ...) 390s + } # for (mode ...) 390s add_na = FALSE 390s mode: logical 390s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 390s add_na = TRUE 390s mode: logical 390s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 390s add_na = FALSE 390s mode: integer 390s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 390s add_na = TRUE 390s mode: integer 390s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 390s add_na = FALSE 390s mode: double 390s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 390s add_na = TRUE 390s mode: double 390s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 390s > 390s > 390s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 390s > # All NAs 390s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 390s > for (mode in c("logical", "integer", "double")) { 390s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 390s + cat("mode: ", mode, "\n", sep = "") 390s + storage.mode(x) <- mode 390s + str(x) 390s + 390s + # Test with and without dimnames on x 390s + for (setDimnames in c(TRUE, FALSE)) { 390s + if (setDimnames) dimnames(x) <- dimnames 390s + else dimnames(x) <- NULL 390s + # Check names attribute 390s + for (useNames in c(TRUE, FALSE)) { 390s + r0 <- rowCummins_R(x, useNames = useNames) 390s + r1 <- rowCummins(x, useNames = useNames) 390s + r2 <- t(colCummins(t(x), useNames = useNames)) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + 390s + r0 <- rowCummaxs_R(x, useNames = useNames) 390s + r1 <- rowCummaxs(x, useNames = useNames) 390s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + } # for (useNames ...) 390s + } # for (setDimnames ...) 390s + } # for (mode ...) 390s mode: logical 390s logi [1:10, 1:5] NA NA NA NA NA NA ... 390s mode: integer 390s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 390s mode: double 390s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 390s > 390s > 390s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 390s > # A 1x1 matrix 390s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 390s > for (mode in c("logical", "integer", "double")) { 390s + x <- matrix(0, nrow = 1L, ncol = 1L) 390s + cat("mode: ", mode, "\n", sep = "") 390s + storage.mode(x) <- mode 390s + str(x) 390s + 390s + # To check dimnames attribute 390s + dimnames <- list("a", "A") 390s + 390s + # Test with and without dimnames on x 390s + for (setDimnames in c(TRUE, FALSE)) { 390s + if (setDimnames) dimnames(x) <- dimnames 390s + else dimnames(x) <- NULL 390s + # Check names attribute 390s + for (useNames in c(TRUE, FALSE)) { 390s + r0 <- rowCummins_R(x, useNames = useNames) 390s + r1 <- rowCummins(x, useNames = useNames) 390s + r2 <- t(colCummins(t(x), useNames = useNames)) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + 390s + r0 <- rowCummaxs_R(x, useNames = useNames) 390s + r1 <- rowCummaxs(x, useNames = useNames) 390s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + } # for (useNames ...) 390s + } # for (setDimnames ...) 390s + } # for (mode ...) 390s mode: logical 390s logi [1, 1] FALSE 390s mode: integer 390s int [1, 1] 0 390s mode: double 390s num [1, 1] 0 390s > 390s > 390s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 390s > # Corner cases 390s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 390s > for (mode in c("logical", "integer", "double")) { 390s + cat("mode: ", mode, "\n", sep = "") 390s + value <- 0 390s + storage.mode(value) <- mode 390s + value0 <- if (mode == "logical") 0L else value 390s + 390s + # A 0x0 matrix 390s + x <- matrix(value, nrow = 0L, ncol = 0L) 390s + str(x) 390s + r0 <- matrix(value0, nrow = nrow(x), ncol = ncol(x)) 390s + r1 <- rowCummins(x) 390s + r2 <- t(colCummins(t(x))) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + 390s + # A 0xK matrix 390s + x <- matrix(value, nrow = 0L, ncol = 5L) 390s + str(x) 390s + colnames <- LETTERS[1:5] 390s + # Test with and without dimnames on x 390s + for (setDimnames in c(TRUE, FALSE)) { 390s + if (setDimnames) colnames(x) <- colnames 390s + else dimnames(x) <- NULL 390s + # Check names attribute 390s + for (useNames in c(TRUE, FALSE)) { 390s + r0 <- rowCummins_R(x, useNames = useNames) 390s + r1 <- rowCummins(x, useNames = useNames) 390s + r2 <- t(colCummins(t(x), useNames = useNames)) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + r0 <- rowCummaxs_R(x, useNames = useNames) 390s + r1 <- rowCummaxs(x, useNames = useNames) 390s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + } # for (useNames ...) 390s + } # for (setDimnames ...) 390s + 390s + # A Nx0 matrix 390s + x <- matrix(value, nrow = 5L, ncol = 0L) 390s + str(x) 390s + rownames <- LETTERS[1:5] 390s + # Test with and without dimnames on x 390s + for (setDimnames in c(TRUE, FALSE)) { 390s + if (setDimnames) rownames(x) <- rownames 390s + else dimnames(x) <- NULL 390s + # Check names attribute 390s + for (useNames in c(TRUE, FALSE)) { 390s + r0 <- rowCummins_R(x, useNames = useNames) 390s + r1 <- rowCummins(x, useNames = useNames) 390s + r2 <- t(colCummins(t(x), useNames = useNames)) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + 390s + r0 <- rowCummaxs_R(x, useNames = useNames) 390s + r1 <- rowCummaxs(x, useNames = useNames) 390s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 390s + stopifnot(all.equal(r1, r2)) 390s + stopifnot(all.equal(r1, r0)) 390s + stopifnot(all.equal(r2, r0)) 390s + } # for (useNames ...) 390s + } # for (setDimnames ...) 390s + } # for (mode ...) 390s mode: logical 390s logi[0 , 0 ] 390s logi[0 , 1:5] 390s logi[1:5, 0 ] 390s mode: integer 390s int[0 , 0 ] 390s int[0 , 1:5] 390s int[1:5, 0 ] 390s mode: double 390s num[0 , 0 ] 390s num[0 , 1:5] 390s num[1:5, 0 ] 390s > 390s 390s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 390s Copyright (C) 2025 The R Foundation for Statistical Computing 390s Platform: aarch64-unknown-linux-gnu 390s 390s R is free software and comes with ABSOLUTELY NO WARRANTY. 390s You are welcome to redistribute it under certain conditions. 390s Type 'license()' or 'licence()' for distribution details. 390s 390s R is a collaborative project with many contributors. 390s Type 'contributors()' for more information and 390s 'citation()' on how to cite R or R packages in publications. 390s 390s Type 'demo()' for some demos, 'help()' for on-line help, or 390s 'help.start()' for an HTML browser interface to help. 390s Type 'q()' to quit R. 390s 390s > library("matrixStats") 390s > 390s > rowCummins_R <- function(x, ..., useNames = TRUE) { 390s + suppressWarnings({ 390s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 390s + }) 390s + 390s + # Preserve dimnames attribute? 390s + dim(y) <- dim(x) 390s + dimnames(y) <- if (useNames) dimnames(x) else NULL 390s + 390s + y 390s + } 390s > 390s > rowCummaxs_R <- function(x, ..., useNames = TRUE) { 390s + mode <- storage.mode(x) 390s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 390s + storage.mode(x) <- "numeric" 390s + suppressWarnings({ 390s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 390s + }) 390s + 390s + # Preserve dimnames attribute? 390s + dim(y) <- dim(x) 390s + dimnames(y) <- if (useNames) dimnames(x) else NULL 390s + 390s + storage.mode(y) <- mode 390s + y 390s + } 390s > 390s > 390s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 390s > # Subsetted tests 390s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 390s > source("utils/validateIndicesFramework.R") 390s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 390s > storage.mode(x) <- "integer" 390s > 390s > # To check dimnames attribute 390s > dimnames <- list(letters[1:6], LETTERS[1:6]) 390s > 390s > # Test with and without dimnames on x 390s > for (setDimnames in c(TRUE, FALSE)) { 390s + if (setDimnames) dimnames(x) <- dimnames 390s + else dimnames(x) <- NULL 390s + for (rows in index_cases) { 390s + for (cols in index_cases) { 390s + # Check names attribute 390s + for (useNames in c(TRUE, FALSE)) { 390s + validateIndicesTestMatrix(x, rows, cols, 390s + ftest = rowCummins, fsure = rowCummins_R, useNames = useNames,verbose=TRUE) 390s + validateIndicesTestMatrix(x, rows, cols, 390s + ftest = function(x, rows, cols, ..., useNames) { 390s + t(colCummins(t(x), rows = cols, cols = rows, useNames = useNames)) 390s + }, fsure = rowCummins_R, useNames = useNames) 390s + 390s + validateIndicesTestMatrix(x, rows, cols, 390s + ftest = rowCummaxs, fsure = rowCummaxs_R, useNames = useNames) 390s + validateIndicesTestMatrix(x, rows, cols, 390s + ftest = function(x, rows, cols, ..., useNames) { 390s + t(colCummaxs(t(x), rows = cols, cols = rows, useNames = useNames)) 390s + }, fsure = rowCummaxs_R, useNames = useNames) 390s + } 390s + } 390s + } 390s + } 392s > 392s 392s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 392s Copyright (C) 2025 The R Foundation for Statistical Computing 392s Platform: aarch64-unknown-linux-gnu 392s 392s R is free software and comes with ABSOLUTELY NO WARRANTY. 392s You are welcome to redistribute it under certain conditions. 392s Type 'license()' or 'licence()' for distribution details. 392s 392s R is a collaborative project with many contributors. 392s Type 'contributors()' for more information and 392s 'citation()' on how to cite R or R packages in publications. 392s 392s Type 'demo()' for some demos, 'help()' for on-line help, or 392s 'help.start()' for an HTML browser interface to help. 392s Type 'q()' to quit R. 392s 392s > library("matrixStats") 392s > 392s > rowCumprods_R <- function(x, ..., useNames = TRUE) { 392s + suppressWarnings({ 392s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 392s + }) 392s + 392s + # Preserve dimnames attribute? 392s + dim(y) <- dim(x) 392s + dimnames(y) <- if (useNames) dimnames(x) else NULL 392s + 392s + y 392s + } 392s > 392s > 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # With and without some NAs 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > for (mode in c("logical", "integer", "double")) { 392s + for (add_na in c(FALSE, TRUE)) { 392s + cat("add_na = ", add_na, "\n", sep = "") 392s + 392s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 392s + if (add_na) { 392s + x[3:7, c(2, 4)] <- NA_real_ 392s + } 392s + cat("mode: ", mode, "\n", sep = "") 392s + storage.mode(x) <- mode 392s + str(x) 392s + 392s + # To check dimnames attribute 392s + dimnames <- list(letters[1:10], LETTERS[1:5]) 392s + 392s + # Test with and without dimnames on x 392s + for (setDimnames in c(TRUE, FALSE)) { 392s + if (setDimnames) dimnames(x) <- dimnames 392s + else dimnames(x) <- NULL 392s + # Check names attribute 392s + for (useNames in c(TRUE, FALSE)) { 392s + # Row/column ranges 392s + r0 <- rowCumprods_R(x, useNames = useNames) 392s + r1 <- rowCumprods(x, useNames = useNames) 392s + r2 <- t(colCumprods(t(x), useNames = useNames)) 392s + stopifnot(all.equal(r1, r2)) 392s + stopifnot(all.equal(r1, r0)) 392s + stopifnot(all.equal(r2, r0)) 392s + } # for (useNames ...) 392s + } # for (setDimnames ...) 392s + } # for (add_na ...) 392s + } # for (mode ...) 392s add_na = FALSE 392s mode: logical 392s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 392s add_na = TRUE 392s mode: logical 392s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 392s add_na = FALSE 392s mode: integer 392s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 392s add_na = TRUE 392s mode: integer 392s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 392s add_na = FALSE 392s mode: double 392s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 392s add_na = TRUE 392s mode: double 392s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 392s > 392s > 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # All NAs 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > for (mode in c("logical", "integer", "double")) { 392s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 392s + cat("mode: ", mode, "\n", sep = "") 392s + storage.mode(x) <- mode 392s + str(x) 392s + 392s + # Test with and without dimnames on x 392s + for (setDimnames in c(TRUE, FALSE)) { 392s + if (setDimnames) dimnames(x) <- dimnames 392s + else dimnames(x) <- NULL 392s + # Check names attribute 392s + for (useNames in c(TRUE, FALSE)) { 392s + # Row/column ranges 392s + r0 <- rowCumprods_R(x, useNames = useNames) 392s + r1 <- rowCumprods(x, useNames = useNames) 392s + r2 <- t(colCumprods(t(x), useNames = useNames)) 392s + stopifnot(all.equal(r1, r2)) 392s + stopifnot(all.equal(r1, r0)) 392s + stopifnot(all.equal(r2, r0)) 392s + } # for (useNames ...) 392s + } # for (setDimnames ...) 392s + } # for (mode ...) 392s mode: logical 392s logi [1:10, 1:5] NA NA NA NA NA NA ... 392s mode: integer 392s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 392s mode: double 392s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 392s > 392s > 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # A 1x1 matrix 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > for (mode in c("logical", "integer", "double")) { 392s + x <- matrix(0, nrow = 1L, ncol = 1L) 392s + cat("mode: ", mode, "\n", sep = "") 392s + storage.mode(x) <- mode 392s + str(x) 392s + 392s + dimnames <- list("a", "A") 392s + # Test with and without dimnames on x 392s + for (setDimnames in c(TRUE, FALSE)) { 392s + if (setDimnames) dimnames(x) <- dimnames 392s + else dimnames(x) <- NULL 392s + # Check names attribute 392s + for (useNames in c(TRUE, FALSE)) { 392s + # Row/column ranges 392s + r0 <- rowCumprods_R(x, useNames = useNames) 392s + r1 <- rowCumprods(x, useNames = useNames) 392s + r2 <- t(colCumprods(t(x), useNames = useNames)) 392s + stopifnot(all.equal(r1, r2)) 392s + stopifnot(all.equal(r1, r0)) 392s + stopifnot(all.equal(r2, r0)) 392s + } # for (useNames ...) 392s + } # for (setDimnames ...) 392s + } 392s mode: logical 392s logi [1, 1] FALSE 392s mode: integer 392s int [1, 1] 0 392s mode: double 392s num [1, 1] 0 392s > 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # BUG FIX TEST: Assert zeros don't trump NAs in integer matrices 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > for (mode in c("logical", "integer", "double")) { 392s + x <- matrix(NA_real_, nrow = 3L, ncol = 2L) 392s + x[1, 2] <- 0 392s + x[2, 2] <- 1 392s + x[3, 1] <- 0 392s + storage.mode(x) <- mode 392s + cat("mode: ", mode, "\n", sep = "") 392s + str(x) 392s + 392s + dimnames <- list(letters[1:3], LETTERS[1:2]) 392s + # Test with and without dimnames on x 392s + for (setDimnames in c(TRUE, FALSE)) { 392s + if (setDimnames) dimnames(x) <- dimnames 392s + else dimnames(x) <- NULL 392s + # Check names attribute 392s + for (useNames in c(TRUE, FALSE)) { 392s + # Row/column ranges 392s + r0 <- rowCumprods_R(x, useNames = useNames) 392s + r1 <- rowCumprods(x, useNames = useNames) 392s + r2 <- t(colCumprods(t(x), useNames = useNames)) 392s + stopifnot(all.equal(r1, r2)) 392s + stopifnot(all.equal(r1, r0)) 392s + stopifnot(all.equal(r2, r0)) 392s + } # for (useNames ...) 392s + } # for (setDimnames ...) 392s + } 392s mode: logical 392s logi [1:3, 1:2] NA NA FALSE FALSE TRUE NA 392s mode: integer 392s int [1:3, 1:2] NA NA 0 0 1 NA 392s mode: double 392s num [1:3, 1:2] NA NA 0 0 1 NA 392s > 392s > 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # Corner cases 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > for (mode in c("logical", "integer", "double")) { 392s + cat("mode: ", mode, "\n", sep = "") 392s + value <- 0 392s + storage.mode(value) <- mode 392s + if (mode == "logical") value2 <- 0L 392s + 392s + # A 0x0 matrix 392s + x <- matrix(value, nrow = 0L, ncol = 0L) 392s + str(x) 392s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 392s + r1 <- rowCumprods(x) 392s + r2 <- t(colCumprods(t(x))) 392s + stopifnot(all.equal(r1, r2)) 392s + stopifnot(all.equal(r1, r0)) 392s + stopifnot(all.equal(r2, r0)) 392s + 392s + # A 0xK matrix 392s + x <- matrix(value, nrow = 0L, ncol = 5L) 392s + str(x) 392s + colnames <- LETTERS[1:5] 392s + # Test with and without dimnames on x 392s + for (setDimnames in c(TRUE, FALSE)) { 392s + if (setDimnames) colnames(x) <- colnames 392s + else dimnames(x) <- NULL 392s + # Check names attribute 392s + for (useNames in c(TRUE, FALSE)) { 392s + r0 <- rowCumprods_R(x, useNames = useNames) 392s + r1 <- rowCumprods(x, useNames = useNames) 392s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 392s + stopifnot(all.equal(r1, r2)) 392s + stopifnot(all.equal(r1, r0)) 392s + stopifnot(all.equal(r2, r0)) 392s + } # for (useNames ...) 392s + } # for (setDimnames ...) 392s + 392s + # A Nx0 matrix 392s + x <- matrix(value, nrow = 5L, ncol = 0L) 392s + str(x) 392s + rownames <- LETTERS[1:5] 392s + # Test with and without dimnames on x 392s + for (setDimnames in c(TRUE, FALSE)) { 392s + if (setDimnames) rownames(x) <- rownames 392s + else dimnames(x) <- NULL 392s + # Check names attribute 392s + for (useNames in c(TRUE, FALSE)) { 392s + r0 <- rowCumprods_R(x, useNames = useNames) 392s + r1 <- rowCumprods(x, useNames = useNames) 392s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 392s + stopifnot(all.equal(r1, r2)) 392s + stopifnot(all.equal(r1, r0)) 392s + stopifnot(all.equal(r2, r0)) 392s + } # for (useNames ...) 392s + } # for (setDimnames ...) 392s + } # for (mode ...) 392s mode: logical 392s logi[0 , 0 ] 392s logi[0 , 1:5] 392s logi[1:5, 0 ] 392s mode: integer 392s int[0 , 0 ] 392s int[0 , 1:5] 392s int[1:5, 0 ] 392s mode: double 392s num[0 , 0 ] 392s num[0 , 1:5] 392s num[1:5, 0 ] 392s > 392s 392s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 392s Copyright (C) 2025 The R Foundation for Statistical Computing 392s Platform: aarch64-unknown-linux-gnu 392s 392s R is free software and comes with ABSOLUTELY NO WARRANTY. 392s You are welcome to redistribute it under certain conditions. 392s Type 'license()' or 'licence()' for distribution details. 392s 392s R is a collaborative project with many contributors. 392s Type 'contributors()' for more information and 392s 'citation()' on how to cite R or R packages in publications. 392s 392s Type 'demo()' for some demos, 'help()' for on-line help, or 392s 'help.start()' for an HTML browser interface to help. 392s Type 'q()' to quit R. 392s 392s > library("matrixStats") 392s > 392s > rowCumprods_R <- function(x, ..., useNames = TRUE) { 392s + suppressWarnings({ 392s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 392s + }) 392s + 392s + # Preserve dimnames attribute? 392s + dim(y) <- dim(x) 392s + dimnames(y) <- if (useNames) dimnames(x) else NULL 392s + 392s + y 392s + } 392s > 392s > 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # Subsetted tests 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > source("utils/validateIndicesFramework.R") 392s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 392s > storage.mode(x) <- "integer" 392s > 392s > # To check dimnames attribute 392s > dimnames <- list(letters[1:6], LETTERS[1:6]) 392s > 392s > # Test with and without dimnames on x 392s > for (setDimnames in c(TRUE, FALSE)) { 392s + if (setDimnames) dimnames(x) <- dimnames 392s + else dimnames(x) <- NULL 392s + for (rows in index_cases) { 392s + for (cols in index_cases) { 392s + # Check names attribute 392s + for (useNames in c(TRUE, FALSE)) { 392s + validateIndicesTestMatrix(x, rows, cols, 392s + ftest = rowCumprods, fsure = rowCumprods_R, useNames = useNames) 392s + validateIndicesTestMatrix(x, rows, cols, 392s + ftest = function(x, rows, cols, ..., useNames) { 392s + t(colCumprods(t(x), rows = cols, cols = rows, useNames = useNames)) 392s + }, fsure = rowCumprods_R, useNames = useNames) 392s + } 392s + } 392s + } 392s + } 393s > 393s 393s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 393s Copyright (C) 2025 The R Foundation for Statistical Computing 393s Platform: aarch64-unknown-linux-gnu 393s 393s R is free software and comes with ABSOLUTELY NO WARRANTY. 393s You are welcome to redistribute it under certain conditions. 393s Type 'license()' or 'licence()' for distribution details. 393s 393s R is a collaborative project with many contributors. 393s Type 'contributors()' for more information and 393s 'citation()' on how to cite R or R packages in publications. 393s 393s Type 'demo()' for some demos, 'help()' for on-line help, or 393s 'help.start()' for an HTML browser interface to help. 393s Type 'q()' to quit R. 393s 394s > library("matrixStats") 394s > 394s > rowCumsums_R <- function(x, ..., useNames = TRUE) { 394s + suppressWarnings({ 394s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 394s + }) 394s + 394s + # Preserve dimnames attribute? 394s + dim(y) <- dim(x) 394s + dimnames(y) <- if (useNames) dimnames(x) else NULL 394s + 394s + y 394s + } 394s > 394s > 394s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 394s > # With and without some NAs 394s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 394s > dimnames <- list(letters[1:10], LETTERS[1:5]) # to check dimnames attribute 394s > for (mode in c("logical", "integer", "double")) { 394s + for (add_na in c(FALSE, TRUE)) { 394s + cat("add_na = ", add_na, "\n", sep = "") 394s + 394s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 394s + if (add_na) { 394s + x[3:7, c(2, 4)] <- NA_real_ 394s + } 394s + cat("mode: ", mode, "\n", sep = "") 394s + storage.mode(x) <- mode 394s + str(x) 394s + 394s + # Test with and without dimnames on x 394s + for (setDimnames in c(TRUE, FALSE)) { 394s + if (setDimnames) dimnames(x) <- dimnames 394s + else dimnames(x) <- NULL 394s + # Check names attribute 394s + for (useNames in c(TRUE, FALSE)) { 394s + # Row/column ranges 394s + r0 <- rowCumsums_R(x, useNames = useNames) 394s + r1 <- rowCumsums(x, useNames = useNames) 394s + r2 <- t(colCumsums(t(x), useNames = useNames)) 394s + stopifnot(all.equal(r1, r2)) 394s + stopifnot(all.equal(r1, r0)) 394s + stopifnot(all.equal(r2, r0)) 394s + } # for (useNames ...) 394s + } # for (setDimnames ...) 394s + } # for (add_na ...) 394s + } 394s add_na = FALSE 394s mode: logical 394s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 394s add_na = TRUE 394s mode: logical 394s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 394s add_na = FALSE 394s mode: integer 394s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 394s add_na = TRUE 394s mode: integer 394s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 394s add_na = FALSE 394s mode: double 394s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 394s add_na = TRUE 394s mode: double 394s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 394s > 394s > 394s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 394s > # All NAs 394s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 394s > for (mode in c("logical", "integer", "double")) { 394s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 394s + cat("mode: ", mode, "\n", sep = "") 394s + storage.mode(x) <- mode 394s + str(x) 394s + 394s + # Test with and without dimnames on x 394s + for (setDimnames in c(TRUE, FALSE)) { 394s + if (setDimnames) dimnames(x) <- dimnames 394s + else dimnames(x) <- NULL 394s + # Check names attribute 394s + for (useNames in c(TRUE, FALSE)) { 394s + # Row/column ranges 394s + r0 <- rowCumsums_R(x, useNames = useNames) 394s + r1 <- rowCumsums(x, useNames = useNames) 394s + r2 <- t(colCumsums(t(x), useNames = useNames)) 394s + stopifnot(all.equal(r1, r2)) 394s + stopifnot(all.equal(r1, r0)) 394s + stopifnot(all.equal(r2, r0)) 394s + } # for (useNames ...) 394s + } # for (setDimnames ...) 394s + } # for (mode ...) 394s mode: logical 394s logi [1:10, 1:5] NA NA NA NA NA NA ... 394s mode: integer 394s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 394s mode: double 394s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 394s > 394s > 394s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 394s > # A 1x1 matrix 394s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 394s > dimnames <- list("a", "A") # to check dimnames attribute 394s > for (mode in c("logical", "integer", "double")) { 394s + x <- matrix(0, nrow = 1L, ncol = 1L) 394s + cat("mode: ", mode, "\n", sep = "") 394s + storage.mode(x) <- mode 394s + str(x) 394s + 394s + r0 <- rowCumsums_R(x) 394s + r1 <- rowCumsums(x) 394s + r2 <- t(colCumsums(t(x))) 394s + stopifnot(all.equal(r1, r2)) 394s + stopifnot(all.equal(r1, r0)) 394s + stopifnot(all.equal(r2, r0)) 394s + 394s + # Check dimnames attribute 394s + dimnames(x) <- dimnames 394s + # r0 <- rowCumsums_R(x) 394s + # > r0 394s + # a 394s + # [1,] 0 394s + r1 <- rowCumsums(x, useNames = TRUE) 394s + r2 <- t(colCumsums(t(x), useNames = TRUE)) 394s + stopifnot(identical(dimnames(r1), dimnames)) 394s + stopifnot(identical(dimnames(r2), dimnames)) 394s + dimnames(x) <- NULL 394s + } 394s mode: logical 394s logi [1, 1] FALSE 394s mode: integer 394s int [1, 1] 0 394s mode: double 394s num [1, 1] 0 394s > 394s > 394s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 394s > # Corner cases 394s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 394s > names <- LETTERS[1:5] # to check dimnames attribute 394s > for (mode in c("logical", "integer", "double")) { 394s + cat("mode: ", mode, "\n", sep = "") 394s + value <- 0 394s + storage.mode(value) <- mode 394s + value2 <- value 394s + if (mode == "logical") value2 <- 0L 394s + 394s + # A 0x0 matrix 394s + x <- matrix(value, nrow = 0L, ncol = 0L) 394s + str(x) 394s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 394s + r1 <- rowCumsums(x) 394s + r2 <- t(colCumsums(t(x))) 394s + stopifnot(all.equal(r1, r2)) 394s + stopifnot(all.equal(r1, r0)) 394s + stopifnot(all.equal(r2, r0)) 394s + 394s + # A 0xK matrix 394s + x <- matrix(value, nrow = 0L, ncol = 5L) 394s + str(x) 394s + colnames <- LETTERS[1:5] 394s + # Test with and without dimnames on x 394s + for (setDimnames in c(TRUE, FALSE)) { 394s + if (setDimnames) colnames(x) <- colnames 394s + else dimnames(x) <- NULL 394s + # Check names attribute 394s + for (useNames in c(TRUE, FALSE)) { 394s + r0 <- rowCumsums_R(x, useNames = useNames) 394s + r1 <- rowCumsums(x, useNames = useNames) 394s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 394s + stopifnot(all.equal(r1, r2)) 394s + stopifnot(all.equal(r1, r0)) 394s + stopifnot(all.equal(r2, r0)) 394s + } # for (useNames ...) 394s + } # for (setDimnames ...) 394s + 394s + # A Nx0 matrix 394s + x <- matrix(value, nrow = 5L, ncol = 0L) 394s + str(x) 394s + rownames <- LETTERS[1:5] 394s + # Test with and without dimnames on x 394s + for (setDimnames in c(TRUE, FALSE)) { 394s + if (setDimnames) rownames(x) <- rownames 394s + else dimnames(x) <- NULL 394s + # Check names attribute 394s + for (useNames in c(TRUE, FALSE)) { 394s + r0 <- rowCumsums_R(x, useNames = useNames) 394s + r1 <- rowCumsums(x, useNames = useNames) 394s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 394s + stopifnot(all.equal(r1, r2)) 394s + stopifnot(all.equal(r1, r0)) 394s + stopifnot(all.equal(r2, r0)) 394s + } # for (useNames ...) 394s + } # for (setDimnames ...) 394s + } # for (mode ...) 394s mode: logical 394s logi[0 , 0 ] 394s logi[0 , 1:5] 394s logi[1:5, 0 ] 394s mode: integer 394s int[0 , 0 ] 394s int[0 , 1:5] 394s int[1:5, 0 ] 394s mode: double 394s num[0 , 0 ] 394s num[0 , 1:5] 394s num[1:5, 0 ] 394s > 394s 394s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 394s Copyright (C) 2025 The R Foundation for Statistical Computing 394s Platform: aarch64-unknown-linux-gnu 394s 394s R is free software and comes with ABSOLUTELY NO WARRANTY. 394s You are welcome to redistribute it under certain conditions. 394s Type 'license()' or 'licence()' for distribution details. 394s 394s R is a collaborative project with many contributors. 394s Type 'contributors()' for more information and 394s 'citation()' on how to cite R or R packages in publications. 394s 394s Type 'demo()' for some demos, 'help()' for on-line help, or 394s 'help.start()' for an HTML browser interface to help. 394s Type 'q()' to quit R. 394s 394s > library("matrixStats") 394s > 394s > rowCumsums_R <- function(x, ..., useNames = TRUE) { 394s + suppressWarnings({ 394s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 394s + }) 394s + 394s + # Preserve dimnames attribute? 394s + dim(y) <- dim(x) 394s + dimnames(y) <- if (useNames) dimnames(x) else NULL 394s + 394s + y 394s + } 394s > 394s > 394s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 394s > # Subsetted tests 394s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 394s > source("utils/validateIndicesFramework.R") 394s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 394s > storage.mode(x) <- "integer" 394s > 394s > # To check dimnames attribute 394s > dimnames <- list(letters[1:6], LETTERS[1:6]) 394s > 394s > # Test with and without dimnames on x 394s > for (setDimnames in c(TRUE, FALSE)) { 394s + if (setDimnames) dimnames(x) <- dimnames 394s + else dimnames(x) <- NULL 394s + for (rows in index_cases) { 394s + for (cols in index_cases) { 394s + # Check names attribute 394s + for (useNames in c(TRUE, FALSE)) { 394s + validateIndicesTestMatrix(x, rows, cols, 394s + ftest = rowCumsums, fsure = rowCumsums_R, useNames = useNames) 394s + validateIndicesTestMatrix(x, rows, cols, 394s + ftest = function(x, rows, cols, ..., useNames) { 394s + t(colCumsums(t(x), rows = cols, cols = rows, useNames = useNames)) 394s + }, fsure = rowCumsums_R, useNames = useNames) 394s + } 394s + } 394s + } 394s + } 395s > 395s 395s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 395s Copyright (C) 2025 The R Foundation for Statistical Computing 395s Platform: aarch64-unknown-linux-gnu 395s 395s R is free software and comes with ABSOLUTELY NO WARRANTY. 395s You are welcome to redistribute it under certain conditions. 395s Type 'license()' or 'licence()' for distribution details. 395s 395s R is a collaborative project with many contributors. 395s Type 'contributors()' for more information and 395s 'citation()' on how to cite R or R packages in publications. 395s 395s Type 'demo()' for some demos, 'help()' for on-line help, or 395s 'help.start()' for an HTML browser interface to help. 395s Type 'q()' to quit R. 395s 395s > library("matrixStats") 395s > 395s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = TRUE) { 395s + ncol2 <- ncol(x) - lag * differences 395s + if (ncol2 <= 0) { 395s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 395s + # Preserve names attribute 395s + if (useNames && !is.null(rownames(x))) rownames(y) <- rownames(x) 395s + return(y) 395s + } 395s + suppressWarnings({ 395s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 395s + }) 395s + y <- t(y) 395s + 395s + # Preserve dimnames attribute 395s + dim(y) <- c(nrow(x), ncol2) 395s + if (useNames && !is.null(dimnames(x))) { 395s + colnames <- colnames(x) 395s + if (!is.null(colnames)) { 395s + len <- length(colnames) 395s + colnames <- colnames[(len - ncol2 + 1):len] 395s + } 395s + dimnames(y) <- list(rownames(x), colnames) 395s + } 395s + else dimnames(y) <- NULL 395s + 395s + y 395s + } 395s > 395s > 395s > set.seed(0x42) 395s > 395s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 395s > # With and without some NAs 395s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 395s > for (mode in c("integer", "double")) { 395s + cat("mode: ", mode, "\n", sep = "") 395s + 395s + for (add_na in c(FALSE, TRUE)) { 395s + cat("add_na = ", add_na, "\n", sep = "") 395s + 395s + x <- matrix(sample(10 * 8) + 0.1, nrow = 10L, ncol = 8L) 395s + if (add_na) { 395s + x[3:7, c(2, 4)] <- NA_real_ 395s + } 395s + storage.mode(x) <- mode 395s + str(x) 395s + 395s + dimnames <- list(letters[1:10], LETTERS[1:8]) 395s + 395s + # Test with and without dimnames on x 395s + for (setDimnames in c(TRUE, FALSE)) { 395s + if (setDimnames) dimnames(x) <- dimnames 395s + else dimnames(x) <- NULL 395s + # Check dimnames attribute 395s + for (useNames in c(TRUE, FALSE)) { 395s + for (lag in 1:4) { 395s + for (differences in 1:3) { 395s + cat(sprintf("mode: %s, lag = %d, differences = %d\n", 395s + mode, lag, differences)) 395s + # Row/column ranges 395s + r0 <- rowDiffs_R(x, lag = lag, differences = differences, useNames = useNames) 395s + r1 <- rowDiffs(x, lag = lag, differences = differences, useNames = useNames) 395s + r2 <- t(colDiffs(t(x), lag = lag, differences = differences, useNames = useNames)) 395s + stopifnot(all.equal(r1, r0)) 395s + stopifnot(all.equal(r2, r0)) 395s + stopifnot(all.equal(r1, r2)) 395s + } 395s + } 395s + } # for (useNames ...) 395s + } # for (setDimnames ...) 395s + } # for (add_na ...) 395s + } # for (mode ...) 395s mode: integer 395s add_na = FALSE 395s int [1:10, 1:8] 68 26 29 47 48 10 1 38 16 40 ... 395s mode: integer, lag = 1, differences = 1 395s mode: integer, lag = 1, differences = 2 395s mode: integer, lag = 1, differences = 3 395s mode: integer, lag = 2, differences = 1 395s mode: integer, lag = 2, differences = 2 395s mode: integer, lag = 2, differences = 3 395s mode: integer, lag = 3, differences = 1 395s mode: integer, lag = 3, differences = 2 395s mode: integer, lag = 3, differences = 3 395s mode: integer, lag = 4, differences = 1 395s mode: integer, lag = 4, differences = 2 395s mode: integer, lag = 4, differences = 3 395s mode: integer, lag = 1, differences = 1 395s mode: integer, lag = 1, differences = 2 395s mode: integer, lag = 1, differences = 3 395s mode: integer, lag = 2, differences = 1 395s mode: integer, lag = 2, differences = 2 395s mode: integer, lag = 2, differences = 3 395s mode: integer, lag = 3, differences = 1 395s mode: integer, lag = 3, differences = 2 395s mode: integer, lag = 3, differences = 3 395s mode: integer, lag = 4, differences = 1 395s mode: integer, lag = 4, differences = 2 395s mode: integer, lag = 4, differences = 3 395s mode: integer, lag = 1, differences = 1 395s mode: integer, lag = 1, differences = 2 395s mode: integer, lag = 1, differences = 3 395s mode: integer, lag = 2, differences = 1 395s mode: integer, lag = 2, differences = 2 395s mode: integer, lag = 2, differences = 3 395s mode: integer, lag = 3, differences = 1 395s mode: integer, lag = 3, differences = 2 395s mode: integer, lag = 3, differences = 3 395s mode: integer, lag = 4, differences = 1 395s mode: integer, lag = 4, differences = 2 395s mode: integer, lag = 4, differences = 3 395s mode: integer, lag = 1, differences = 1 395s mode: integer, lag = 1, differences = 2 395s mode: integer, lag = 1, differences = 3 395s mode: integer, lag = 2, differences = 1 395s mode: integer, lag = 2, differences = 2 395s mode: integer, lag = 2, differences = 3 395s mode: integer, lag = 3, differences = 1 395s mode: integer, lag = 3, differences = 2 395s mode: integer, lag = 3, differences = 3 395s mode: integer, lag = 4, differences = 1 395s mode: integer, lag = 4, differences = 2 395s mode: integer, lag = 4, differences = 3 395s add_na = TRUE 395s int [1:10, 1:8] 80 71 7 52 79 22 31 10 29 63 ... 395s mode: integer, lag = 1, differences = 1 395s mode: integer, lag = 1, differences = 2 395s mode: integer, lag = 1, differences = 3 395s mode: integer, lag = 2, differences = 1 395s mode: integer, lag = 2, differences = 2 395s mode: integer, lag = 2, differences = 3 395s mode: integer, lag = 3, differences = 1 395s mode: integer, lag = 3, differences = 2 395s mode: integer, lag = 3, differences = 3 395s mode: integer, lag = 4, differences = 1 395s mode: integer, lag = 4, differences = 2 395s mode: integer, lag = 4, differences = 3 395s mode: integer, lag = 1, differences = 1 395s mode: integer, lag = 1, differences = 2 395s mode: integer, lag = 1, differences = 3 395s mode: integer, lag = 2, differences = 1 395s mode: integer, lag = 2, differences = 2 395s mode: integer, lag = 2, differences = 3 395s mode: integer, lag = 3, differences = 1 395s mode: integer, lag = 3, differences = 2 395s mode: integer, lag = 3, differences = 3 395s mode: integer, lag = 4, differences = 1 395s mode: integer, lag = 4, differences = 2 395s mode: integer, lag = 4, differences = 3 395s mode: integer, lag = 1, differences = 1 395s mode: integer, lag = 1, differences = 2 395s mode: integer, lag = 1, differences = 3 395s mode: integer, lag = 2, differences = 1 395s mode: integer, lag = 2, differences = 2 395s mode: integer, lag = 2, differences = 3 395s mode: integer, lag = 3, differences = 1 395s mode: integer, lag = 3, differences = 2 395s mode: integer, lag = 3, differences = 3 395s mode: integer, lag = 4, differences = 1 395s mode: integer, lag = 4, differences = 2 395s mode: integer, lag = 4, differences = 3 395s mode: integer, lag = 1, differences = 1 395s mode: integer, lag = 1, differences = 2 395s mode: integer, lag = 1, differences = 3 395s mode: integer, lag = 2, differences = 1 395s mode: integer, lag = 2, differences = 2 395s mode: integer, lag = 2, differences = 3 395s mode: integer, lag = 3, differences = 1 395s mode: integer, lag = 3, differences = 2 395s mode: integer, lag = 3, differences = 3 395s mode: integer, lag = 4, differences = 1 395s mode: integer, lag = 4, differences = 2 395s mode: integer, lag = 4, differences = 3 395s mode: double 395s add_na = FALSE 395s 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 ... 395s mode: double, lag = 1, differences = 1 395s mode: double, lag = 1, differences = 2 395s mode: double, lag = 1, differences = 3 395s mode: double, lag = 2, differences = 1 395s mode: double, lag = 2, differences = 2 395s mode: double, lag = 2, differences = 3 395s mode: double, lag = 3, differences = 1 395s mode: double, lag = 3, differences = 2 395s mode: double, lag = 3, differences = 3 395s mode: double, lag = 4, differences = 1 395s mode: double, lag = 4, differences = 2 395s mode: double, lag = 4, differences = 3 395s mode: double, lag = 1, differences = 1 395s mode: double, lag = 1, differences = 2 395s mode: double, lag = 1, differences = 3 395s mode: double, lag = 2, differences = 1 395s mode: double, lag = 2, differences = 2 395s mode: double, lag = 2, differences = 3 395s mode: double, lag = 3, differences = 1 395s mode: double, lag = 3, differences = 2 395s mode: double, lag = 3, differences = 3 395s mode: double, lag = 4, differences = 1 395s mode: double, lag = 4, differences = 2 395s mode: double, lag = 4, differences = 3 395s mode: double, lag = 1, differences = 1 395s mode: double, lag = 1, differences = 2 395s mode: double, lag = 1, differences = 3 395s mode: double, lag = 2, differences = 1 395s mode: double, lag = 2, differences = 2 395s mode: double, lag = 2, differences = 3 395s mode: double, lag = 3, differences = 1 395s mode: double, lag = 3, differences = 2 395s mode: double, lag = 3, differences = 3 395s mode: double, lag = 4, differences = 1 395s mode: double, lag = 4, differences = 2 395s mode: double, lag = 4, differences = 3 395s mode: double, lag = 1, differences = 1 395s mode: double, lag = 1, differences = 2 395s mode: double, lag = 1, differences = 3 395s mode: double, lag = 2, differences = 1 395s mode: double, lag = 2, differences = 2 395s mode: double, lag = 2, differences = 3 395s mode: double, lag = 3, differences = 1 395s mode: double, lag = 3, differences = 2 395s mode: double, lag = 3, differences = 3 395s mode: double, lag = 4, differences = 1 395s mode: double, lag = 4, differences = 2 395s mode: double, lag = 4, differences = 3 395s add_na = TRUE 395s 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 ... 395s mode: double, lag = 1, differences = 1 395s mode: double, lag = 1, differences = 2 395s mode: double, lag = 1, differences = 3 395s mode: double, lag = 2, differences = 1 395s mode: double, lag = 2, differences = 2 395s mode: double, lag = 2, differences = 3 395s mode: double, lag = 3, differences = 1 395s mode: double, lag = 3, differences = 2 395s mode: double, lag = 3, differences = 3 395s mode: double, lag = 4, differences = 1 395s mode: double, lag = 4, differences = 2 395s mode: double, lag = 4, differences = 3 395s mode: double, lag = 1, differences = 1 395s mode: double, lag = 1, differences = 2 395s mode: double, lag = 1, differences = 3 395s mode: double, lag = 2, differences = 1 395s mode: double, lag = 2, differences = 2 395s mode: double, lag = 2, differences = 3 395s mode: double, lag = 3, differences = 1 395s mode: double, lag = 3, differences = 2 395s mode: double, lag = 3, differences = 3 395s mode: double, lag = 4, differences = 1 395s mode: double, lag = 4, differences = 2 395s mode: double, lag = 4, differences = 3 395s mode: double, lag = 1, differences = 1 395s mode: double, lag = 1, differences = 2 395s mode: double, lag = 1, differences = 3 395s mode: double, lag = 2, differences = 1 395s mode: double, lag = 2, differences = 2 395s mode: double, lag = 2, differences = 3 395s mode: double, lag = 3, differences = 1 395s mode: double, lag = 3, differences = 2 395s mode: double, lag = 3, differences = 3 395s mode: double, lag = 4, differences = 1 395s mode: double, lag = 4, differences = 2 395s mode: double, lag = 4, differences = 3 395s mode: double, lag = 1, differences = 1 395s mode: double, lag = 1, differences = 2 395s mode: double, lag = 1, differences = 3 395s mode: double, lag = 2, differences = 1 395s mode: double, lag = 2, differences = 2 395s mode: double, lag = 2, differences = 3 395s mode: double, lag = 3, differences = 1 395s mode: double, lag = 3, differences = 2 395s mode: double, lag = 3, differences = 3 395s mode: double, lag = 4, differences = 1 395s mode: double, lag = 4, differences = 2 395s mode: double, lag = 4, differences = 3 395s > 395s > 395s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 395s > # All NAs 395s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 395s > for (mode in c("integer", "double")) { 395s + cat("mode: ", mode, "\n", sep = "") 395s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 395s + storage.mode(x) <- mode 395s + str(x) 395s + 395s + dimnames <- list(letters[1:10], LETTERS[1:5]) 395s + 395s + # Test with and without dimnames on x 395s + for (setDimnames in c(TRUE, FALSE)) { 395s + if (setDimnames) dimnames(x) <- dimnames 395s + else dimnames(x) <- NULL 395s + # Check dimnames attribute 395s + for (useNames in c(TRUE, FALSE)) { 395s + r0 <- rowDiffs_R(x, useNames = useNames) 395s + r1 <- rowDiffs(x, useNames = useNames) 395s + r2 <- t(colDiffs(t(x), useNames = useNames)) 395s + stopifnot(all.equal(r1, r0)) 395s + stopifnot(all.equal(r2, r0)) 395s + stopifnot(all.equal(r1, r2)) 395s + } # for (useNames ...) 395s + } # for (setDimnames ...) 395s + } # for (mode ...) 395s mode: integer 395s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 395s mode: double 395s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 395s > 395s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 395s > # A 1x1 matrix 395s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 395s > x <- matrix(0, nrow = 1L, ncol = 1L) 395s > dimnames <- list("a", "A") 395s > # Test with and without dimnames on x 395s > for (setDimnames in c(TRUE, FALSE)) { 395s + if (setDimnames) dimnames(x) <- dimnames 395s + else dimnames(x) <- NULL 395s + # Check dimnames attribute 395s + for (useNames in c(TRUE, FALSE)) { 395s + r0 <- rowDiffs_R(x, useNames = useNames) 395s + r1 <- rowDiffs(x, useNames = useNames) 395s + r2 <- t(colDiffs(t(x), useNames = useNames)) 395s + stopifnot(all.equal(r1, r0)) 395s + stopifnot(all.equal(r2, r0)) 395s + stopifnot(all.equal(r1, r2)) 395s + } # for (useNames ...) 395s + } # for (setDimnames ...) 395s > 395s 395s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 395s Copyright (C) 2025 The R Foundation for Statistical Computing 395s Platform: aarch64-unknown-linux-gnu 395s 395s R is free software and comes with ABSOLUTELY NO WARRANTY. 395s You are welcome to redistribute it under certain conditions. 395s Type 'license()' or 'licence()' for distribution details. 395s 395s R is a collaborative project with many contributors. 395s Type 'contributors()' for more information and 395s 'citation()' on how to cite R or R packages in publications. 395s 395s Type 'demo()' for some demos, 'help()' for on-line help, or 395s 'help.start()' for an HTML browser interface to help. 395s Type 'q()' to quit R. 395s 395s > library("matrixStats") 395s > 395s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = TRUE) { 395s + ncol2 <- ncol(x) - lag * differences 395s + if (ncol2 <= 0) { 395s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 395s + # Preserve names attribute 395s + if (useNames && !is.null(rownames(x))) rownames(y) <- rownames(x) 395s + return(y) 395s + } 395s + suppressWarnings({ 395s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 395s + }) 395s + y <- t(y) 395s + 395s + # Preserve dimnames attribute 395s + dim(y) <- c(nrow(x), ncol2) 395s + if (useNames && !is.null(dimnames(x))) { 395s + colnames <- colnames(x) 395s + if (!is.null(colnames)) { 395s + len <- length(colnames) 395s + colnames <- colnames[(len - ncol2 + 1):len] 395s + } 395s + dimnames(y) <- list(rownames(x), colnames) 395s + } 395s + else dimnames(y) <- NULL 395s + 395s + y 395s + } 395s > 395s > 395s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 395s > # Subsetted tests 395s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 395s > source("utils/validateIndicesFramework.R") 395s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 395s > storage.mode(x) <- "integer" 395s > 395s > # To check dimnames attribute 395s > dimnames <- list(letters[1:6], LETTERS[1:6]) 395s > 395s > # Test with and without dimnames on x 395s > for (setDimnames in c(TRUE, FALSE)) { 395s + if (setDimnames) dimnames(x) <- dimnames 395s + else dimnames(x) <- NULL 395s + 395s + count <- 0L 395s + for (rows in index_cases) { 395s + for (cols in index_cases) { 395s + count <- count + 1L 395s + for (lag in 1:2) { 395s + for (differences in 1:3) { 395s + # Check dimnames attribute 395s + useNames <- c(TRUE, FALSE) 395s + useNames <- useNames[count %% length(useNames) + 1] 395s + validateIndicesTestMatrix(x, rows, cols, 395s + ftest = rowDiffs, fsure = rowDiffs_R, 395s + lag = lag, differences = differences, useNames = useNames) 395s + validateIndicesTestMatrix(x, rows, cols, 395s + ftest = function(x, rows, cols, ..., useNames) { 395s + t(colDiffs(t(x), rows = cols, cols = rows, ..., useNames = useNames)) 395s + }, fsure = rowDiffs_R, 395s + lag = lag, differences = differences, useNames = useNames) 395s + } 395s + } 395s + } 395s + } 395s + } 398s > 398s 398s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 398s Copyright (C) 2025 The R Foundation for Statistical Computing 398s Platform: aarch64-unknown-linux-gnu 398s 398s R is free software and comes with ABSOLUTELY NO WARRANTY. 398s You are welcome to redistribute it under certain conditions. 398s Type 'license()' or 'licence()' for distribution details. 398s 398s R is a collaborative project with many contributors. 398s Type 'contributors()' for more information and 398s 'citation()' on how to cite R or R packages in publications. 398s 398s Type 'demo()' for some demos, 'help()' for on-line help, or 398s 'help.start()' for an HTML browser interface to help. 398s Type 'q()' to quit R. 398s 398s > library("matrixStats") 398s > 398s > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 398s + quantile_na <- function(x, ..., na.rm = FALSE) { 398s + if (!na.rm && anyMissing(x)) 398s + return(c(NA_real_, NA_real_)) 398s + quantile(x, ..., na.rm = na.rm) 398s + } 398s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 398s + probs = c(0.25, 0.75), na.rm = na.rm) 398s + rownames(q) <- NULL # Not needed anymore 398s + 398s + # Preserve names attribute 398s + dim(q) <- c(2L, nrow(x)) 398s + colnames(q) <- if (useNames) rownames(x) else NULL 398s + 398s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 398s + } 398s > 398s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 398s > # Test with multiple quantiles 398s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 398s > for (mode in c("integer", "double")) { 398s + cat("mode: ", mode, "\n", sep = "") 398s + x <- matrix(1:100 + 0.1, nrow = 10, ncol = 10) 398s + storage.mode(x) <- mode 398s + str(x) 398s + 398s + # To check names attribute 398s + dimnames <- list(letters[1:10], LETTERS[1:10]) 398s + 398s + for (add_na in c(FALSE, TRUE)) { 398s + if (add_na) { 398s + x[3:5, 6:9] <- NA 398s + } 398s + # Test with and without dimnames on x 398s + for (setDimnames in c(TRUE, FALSE)) { 398s + if (setDimnames) dimnames(x) <- dimnames 398s + else dimnames(x) <- NULL 398s + for (na.rm in c(FALSE, TRUE)) { 398s + # Check names attribute 398s + for (useNames in c(TRUE, FALSE)) { 398s + probs <- c(0, 0.5, 1) 398s + q0 <- rowIQRs_R(x, na.rm = na.rm, useNames = useNames) 398s + print(q0) 398s + q1 <- rowIQRs(x, na.rm = na.rm, useNames = useNames) 398s + print(q1) 398s + stopifnot(all.equal(q1, q0)) 398s + q2 <- colIQRs(t(x), na.rm = na.rm, useNames = useNames) 398s + stopifnot(all.equal(q2, q0)) 398s + 398s + q <- iqr(x[3, ], na.rm = na.rm) 398s + print(q) 398s + } # for (useNames ...) 398s + } # for (na.rm ...) 398s + } # for (setDimnames ...) 398s + } # for (add_na ...) 398s + } # for (mode ...) 398s mode: integer 398s int [1:10, 1:10] 1 2 3 4 5 6 7 8 9 10 ... 398s a b c d e f g h i j 398s 45 45 45 45 45 45 45 45 45 45 398s a b c d e f g h i j 398s 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s a b c d e f g h i j 398s 45 45 45 45 45 45 45 45 45 45 398s a b c d e f g h i j 398s 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s a b c d e f g h i j 398s 45 45 NA NA NA 45 45 45 45 45 398s a b c d e f g h i j 398s 45 45 NA NA NA 45 45 45 45 45 398s [1] NA 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] NA 398s a b c d e f g h i j 398s 45 45 25 25 25 45 45 45 45 45 398s a b c d e f g h i j 398s 45 45 25 25 25 45 45 45 45 45 398s [1] 25 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 25 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] NA 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] NA 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 25 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 25 398s mode: double 398s 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 ... 398s a b c d e f g h i j 398s 45 45 45 45 45 45 45 45 45 45 398s a b c d e f g h i j 398s 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s a b c d e f g h i j 398s 45 45 45 45 45 45 45 45 45 45 398s a b c d e f g h i j 398s 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 45 45 45 45 45 45 45 45 45 398s [1] 45 398s a b c d e f g h i j 398s 45 45 NA NA NA 45 45 45 45 45 398s a b c d e f g h i j 398s 45 45 NA NA NA 45 45 45 45 45 398s [1] NA 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] NA 398s a b c d e f g h i j 398s 45 45 25 25 25 45 45 45 45 45 398s a b c d e f g h i j 398s 45 45 25 25 25 45 45 45 45 45 398s [1] 25 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 25 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] NA 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] 45 45 NA NA NA 45 45 45 45 45 398s [1] NA 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 25 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 45 45 25 25 25 45 45 45 45 45 398s [1] 25 398s > 398s > 398s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 398s > # Test corner cases 398s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 398s > for (mode in c("integer", "double")) { 398s + cat("mode: ", mode, "\n", sep = "") 398s + # Empty vectors 398s + x <- integer(0L) 398s + storage.mode(x) <- mode 398s + str(x) 398s + q <- iqr(x) 398s + print(q) 398s + stopifnot(identical(q, NA_real_)) 398s + 398s + # Scalar 398s + x <- 1L 398s + storage.mode(x) <- mode 398s + str(x) 398s + q <- iqr(x) 398s + str(q) 398s + stopifnot(identical(q, 0)) 398s + } 398s mode: integer 398s int(0) 398s [1] NA 398s int 1 398s num 0 398s mode: double 398s num(0) 398s [1] NA 398s num 1 398s num 0 398s > 398s > 398s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 398s > # Single row matrices 398s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 398s > x <- matrix(1, nrow = 1L, ncol = 2L) 398s > dimnames <- list("a", LETTERS[1:2]) 398s > # Test with and without dimnames on x 398s > for (setDimnames in c(TRUE, FALSE)) { 398s + if (setDimnames) dimnames(x) <- dimnames 398s + else dimnames(x) <- NULL 398s + # Check names attribute 398s + for (useNames in c(TRUE, FALSE)) { 398s + q0 <- rowIQRs_R(x, useNames = useNames) 398s + q1 <- rowIQRs(x, useNames = useNames) 398s + q2 <- colIQRs(t(x), useNames = useNames) 398s + stopifnot(all.equal(q0, q1)) 398s + stopifnot(all.equal(q0, q2)) 398s + } 398s + } 398s > 398s > x <- matrix(1, nrow = 2L, ncol = 1L) 398s > q <- colIQRs(x) 398s > stopifnot(identical(q, 0)) 398s > 398s 398s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 398s Copyright (C) 2025 The R Foundation for Statistical Computing 398s Platform: aarch64-unknown-linux-gnu 398s 398s R is free software and comes with ABSOLUTELY NO WARRANTY. 398s You are welcome to redistribute it under certain conditions. 398s Type 'license()' or 'licence()' for distribution details. 398s 398s R is a collaborative project with many contributors. 398s Type 'contributors()' for more information and 398s 'citation()' on how to cite R or R packages in publications. 398s 398s Type 'demo()' for some demos, 'help()' for on-line help, or 398s 'help.start()' for an HTML browser interface to help. 398s Type 'q()' to quit R. 398s 398s > library("matrixStats") 398s > 398s > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 398s + quantile_na <- function(x, ..., na.rm = FALSE) { 398s + if (!na.rm && anyMissing(x)) 398s + return(c(NA_real_, NA_real_)) 398s + quantile(x, ..., na.rm = na.rm) 398s + } 398s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 398s + probs = c(0.25, 0.75), na.rm = na.rm) 398s + rownames(q) <- NULL # Not needed anymore 398s + 398s + # Preserve names attribute 398s + dim(q) <- c(2L, nrow(x)) 398s + colnames(q) <- if (useNames) rownames(x) else NULL 398s + 398s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 398s + } 398s > 398s > 398s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 398s > # Subsetted tests 398s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 398s > source("utils/validateIndicesFramework.R") 398s > x <- runif(6, min = -6, max = 6) 398s > for (idxs in index_cases) { 398s + for (na.rm in c(TRUE, FALSE)) { 398s + validateIndicesTestVector(x, idxs, ftest = iqr, fsure = function(x, na.rm) { 398s + dim(x) <- c(1L, length(x)) 398s + rowIQRs_R(x, na.rm = na.rm) 398s + }, na.rm = na.rm) 398s + } 398s + } 398s > 398s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 398s > 398s > # To check names attribute 398s > dimnames <- list(letters[1:6], LETTERS[1:6]) 398s > 398s > # Test with and without dimnames on x 398s > for (setDimnames in c(TRUE, FALSE)) { 398s + if (setDimnames) dimnames(x) <- dimnames 398s + else dimnames(x) <- NULL 398s + 398s + count <- 0L 398s + for (rows in index_cases) { 398s + for (cols in index_cases) { 398s + count <- count + 1L 398s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 398s + useNames <- c(TRUE, FALSE) 398s + useNames <- useNames[count %% length(useNames) + 1] 398s + 398s + validateIndicesTestMatrix(x, rows, cols, 398s + ftest = rowIQRs, fsure = rowIQRs_R, 398s + na.rm = na.rm, useNames = useNames) 398s + validateIndicesTestMatrix(x, rows, cols, 398s + fcoltest = colIQRs, fsure = rowIQRs_R, 398s + na.rm = na.rm, useNames = useNames) 398s + } 398s + } 398s + } 400s > 400s 400s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 400s Copyright (C) 2025 The R Foundation for Statistical Computing 400s Platform: aarch64-unknown-linux-gnu 400s 400s R is free software and comes with ABSOLUTELY NO WARRANTY. 400s You are welcome to redistribute it under certain conditions. 400s Type 'license()' or 'licence()' for distribution details. 400s 400s R is a collaborative project with many contributors. 400s Type 'contributors()' for more information and 400s 'citation()' on how to cite R or R packages in publications. 400s 400s Type 'demo()' for some demos, 'help()' for on-line help, or 400s 'help.start()' for an HTML browser interface to help. 400s Type 'q()' to quit R. 400s 400s > # Test inspired by the harmonic mean example in R-help 400s > # thread '[R] Beyond double-precision?' on May 9, 2009. 400s > 400s > library("matrixStats") 400s > library("stats") 400s > 400s > logSumExp0 <- function(lx) { 400s + idx_max <- which.max(lx) 400s + log1p(sum(exp(lx[-idx_max] - lx[idx_max]))) + lx[idx_max] 400s + } 400s > 400s > n <- 200L 400s > set.seed(1) 400s > 400s > for (mode in c("integer", "double")) { 400s + cat("mode: ", mode, "\n", sep = "") 400s + x <- matrix(runif(n, min = 1.0, max = 3.0), nrow = 20L) 400s + storage.mode(x) <- mode 400s + str(x) 400s + 400s + # The logarithm of the harmonic mean by rows 400s + y_h <- log(1 / rowMeans(1 / x)) 400s + str(y_h) 400s + 400s + lx_neg <- -log(x) 400s + 400s + y0 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp0) 400s + stopifnot(all.equal(y0, y_h)) 400s + 400s + y1 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp) 400s + stopifnot(all.equal(y1, y0)) 400s + 400s + y2 <- log(ncol(x)) - rowLogSumExps(lx_neg) 400s + stopifnot(all.equal(y2, y0)) 400s + 400s + y3 <- log(ncol(x)) - colLogSumExps(t(lx_neg)) 400s + stopifnot(all.equal(y3, y0)) 400s + 400s + 400s + # The logarithm of the harmonic mean by columns 400s + y_h <- log(1 / colMeans(1 / x)) 400s + str(y_h) 400s + 400s + y0 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp0) 400s + stopifnot(all.equal(y0, y_h)) 400s + 400s + y1 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp) 400s + stopifnot(all.equal(y1, y0)) 400s + 400s + y2 <- log(nrow(x)) - colLogSumExps(lx_neg) 400s + stopifnot(all.equal(y2, y0)) 400s + 400s + y3 <- log(nrow(x)) - rowLogSumExps(t(lx_neg)) 400s + stopifnot(all.equal(y3, y0)) 400s + 400s + # Testing names 400s + rownames(lx_neg) <- seq_len(nrow(x)) 400s + colnames(lx_neg) <- seq_len(ncol(x)) 400s + y2 <- rowLogSumExps(lx_neg, useNames = TRUE) 400s + stopifnot(identical(names(y2), rownames(lx_neg))) 400s + y3 <- colLogSumExps(t(lx_neg), useNames = TRUE) 400s + stopifnot(identical(names(y3), rownames(lx_neg))) 400s + } # for (mode ...) 400s mode: integer 400s int [1:20, 1:10] 1 1 2 2 1 2 2 2 2 1 ... 400s num [1:20] 0.357 0.223 0.223 0.288 0.511 ... 400s num [1:10] 0.322 0.223 0.322 0.255 0.255 ... 400s mode: double 400s num [1:20, 1:10] 1.54 1.44 2.03 1.54 1.36 ... 400s num [1:20] 0.526 0.466 0.734 0.638 0.604 ... 400s num [1:10] 0.627 0.582 0.617 0.474 0.418 ... 400s > 400s > 400s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 400s > # Corner cases 400s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 400s > ## Zero-size matrices 400s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 0L) 400s > y <- rowLogSumExps(lx) 400s > print(y) 400s numeric(0) 400s > stopifnot(length(y) == nrow(lx)) 400s > 400s > y <- colLogSumExps(lx) 400s > print(y) 400s numeric(0) 400s > stopifnot(length(y) == ncol(lx)) 400s > 400s > ## Zero-height matrices 400s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 5L) 400s > y <- rowLogSumExps(lx) 400s > print(y) 400s numeric(0) 400s > stopifnot(length(y) == nrow(lx)) 400s > 400s > y <- colLogSumExps(lx) 400s > print(y) 400s [1] -Inf -Inf -Inf -Inf -Inf 400s > stopifnot(length(y) == ncol(lx)) 400s > stopifnot(all(y == -Inf)) 400s > 400s > ## Zero-width matrices 400s > lx <- matrix(numeric(0L), nrow = 5L, ncol = 0L) 400s > y <- colLogSumExps(lx) 400s > print(y) 400s numeric(0) 400s > stopifnot(length(y) == ncol(lx)) 400s > 400s > y <- rowLogSumExps(lx) 400s > print(y) 400s [1] -Inf -Inf -Inf -Inf -Inf 400s > stopifnot(length(y) == nrow(lx)) 400s > stopifnot(all(y == -Inf)) 400s > 400s > 400s > ## Matrices with one element 400s > lx <- matrix(1.0, nrow = 1L, ncol = 1L) 400s > y <- rowLogSumExps(lx) 400s > print(y) 400s [1] 1 400s > stopifnot(length(y) == nrow(lx)) 400s > stopifnot(all(y == lx)) 400s > 400s > y <- colLogSumExps(lx) 400s > print(y) 400s [1] 1 400s > stopifnot(length(y) == ncol(lx)) 400s > stopifnot(all(y == lx)) 400s > 400s > ## All missing values 400s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 400s > y <- rowLogSumExps(lx, na.rm = TRUE) 400s > print(y) 400s [1] -Inf 400s > stopifnot(length(y) == nrow(lx)) 400s > stopifnot(identical(y, -Inf)) 400s > 400s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 400s > y <- colLogSumExps(lx, na.rm = TRUE) 400s > print(y) 400s [1] -Inf 400s > stopifnot(length(y) == ncol(lx)) 400s > stopifnot(identical(y, -Inf)) 400s > 400s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 400s > y <- rowLogSumExps(lx, na.rm = TRUE) 400s > print(y) 400s [1] -Inf -Inf 400s > stopifnot(length(y) == nrow(lx)) 400s > stopifnot(all(y == -Inf)) 400s > 400s > y <- rowLogSumExps(lx, na.rm = FALSE) 400s > print(y) 400s [1] NA NA 400s > stopifnot(length(y) == nrow(lx)) 400s > stopifnot(all(is.na(y) & !is.nan(y))) 400s > 400s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 400s > y <- colLogSumExps(lx, na.rm = TRUE) 400s > print(y) 400s [1] -Inf -Inf 400s > stopifnot(length(y) == ncol(lx)) 400s > stopifnot(all(y == -Inf)) 400s > 400s > y <- colLogSumExps(lx, na.rm = FALSE) 400s > print(y) 400s [1] NA NA 400s > stopifnot(length(y) == ncol(lx)) 400s > stopifnot(all(is.na(y) & !is.nan(y))) 400s > 400s > ## +Inf values 400s > lx <- matrix(c(1, 2, +Inf), nrow = 3L, ncol = 2L) 400s > y <- colLogSumExps(lx, na.rm = TRUE) 400s > print(y) 400s [1] Inf Inf 400s > stopifnot(length(y) == ncol(lx)) 400s > stopifnot(all(y == +Inf)) 400s > 400s > ## multiple -Inf values 400s > lx <- matrix(c(-Inf, -Inf), nrow = 2L, ncol = 3L) 400s > y <- rowLogSumExps(lx) 400s > print(y) 400s [1] -Inf -Inf 400s > stopifnot(length(y) == nrow(lx)) 400s > stopifnot(all(y == -Inf)) 400s > 400s > lx <- matrix(c(-Inf, 5, -Inf), nrow = 2L, ncol = 3L, byrow = TRUE) 400s > y <- rowLogSumExps(lx) 400s > print(y) 400s [1] 5 5 400s > stopifnot(length(y) == nrow(lx)) 400s > stopifnot(all(y == 5)) 400s > 400s > ## Bug report #104 (https://github.com/HenrikBengtsson/matrixStats/issues/104) 400s > ## (This would core dump on Windows) 400s > x <- matrix(0.0, nrow = 2L, ncol = 32762L) 400s > y <- colLogSumExps(x) 400s > str(y) 400s num [1:32762] 0.693 0.693 0.693 0.693 0.693 ... 400s > 400s > ## Bug report #120 (https://github.com/HenrikBengtsson/matrixStats/issues/120) 400s > ## (This would error if x had rownames/colnames and non-NULL rows/cols were 400s > ## used) 400s > x <- matrix(runif(6), nrow = 2L, ncol = 3L, 400s + dimnames = list(c("A", "B"), c("a", "b", "c"))) 400s > y <- colLogSumExps(x, cols = 3:1, useNames = TRUE) 400s > stopifnot(names(y) == c("c", "b", "a")) 400s > y <- rowLogSumExps(x, rows = 2, useNames = TRUE) 400s > stopifnot(names(y) == "B") 400s > 400s > 400s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 400s > # Check names attributes 400s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 400s > 400s > ## Create isFALSE() if running on an old version of R 400s > if (!exists("isFALSE", mode="function")) { 400s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 400s + } 400s > 400s > rowLogSumExps_R <- function(x, ..., useNames = TRUE) { 400s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 400s + log(sum(exp(rx), ...)) 400s + }, ...) 400s + if (isFALSE(useNames)) names(res) <- NULL 400s + res 400s + } 400s > 400s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 400s > 400s > # To check names attribute 400s > dimnames <- list(letters[1:6], LETTERS[1:6]) 400s > 400s > # Test with and without dimnames on x 400s > for (setDimnames in c(TRUE, FALSE)) { 400s + if (setDimnames) dimnames(x) <- dimnames 400s + else dimnames(x) <- NULL 400s + for (useNames in c(TRUE, FALSE)) { 400s + y0 <- rowLogSumExps_R(x, useNames = useNames) 400s + y1 <- rowLogSumExps(x, useNames = useNames) 400s + y2 <- colLogSumExps(t(x), useNames = useNames) 400s + stopifnot(all.equal(y1, y0)) 400s + stopifnot(all.equal(y2, y0)) 400s + } 400s + } 400s > 400s 400s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 400s Copyright (C) 2025 The R Foundation for Statistical Computing 400s Platform: aarch64-unknown-linux-gnu 400s 400s R is free software and comes with ABSOLUTELY NO WARRANTY. 400s You are welcome to redistribute it under certain conditions. 400s Type 'license()' or 'licence()' for distribution details. 400s 400s R is a collaborative project with many contributors. 400s Type 'contributors()' for more information and 400s 'citation()' on how to cite R or R packages in publications. 400s 400s Type 'demo()' for some demos, 'help()' for on-line help, or 400s 'help.start()' for an HTML browser interface to help. 400s Type 'q()' to quit R. 400s 400s > library("matrixStats") 400s > 400s > ## Create isFALSE() if running on an old version of R 400s > if (!exists("isFALSE", mode="function")) { 400s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 400s + } 400s > 400s > rowLogSumExps_R <- function(x, ..., useNames = TRUE) { 400s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 400s + log(sum(exp(rx), ...)) 400s + }, ...) 400s + if (isFALSE(useNames)) names(res) <- NULL 400s + res 400s + } 400s > 400s > 400s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 400s > # Subsetted tests 400s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 400s > source("utils/validateIndicesFramework.R") 400s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 400s > 400s > # To check names attribute 400s > dimnames <- list(letters[1:6], LETTERS[1:6]) 400s > 400s > # Test with and without dimnames on x 400s > for (setDimnames in c(TRUE, FALSE)) { 400s + if (setDimnames) dimnames(x) <- dimnames 400s + else dimnames(x) <- NULL 400s + for (rows in index_cases) { 400s + for (cols in index_cases) { 400s + for (na.rm in c(TRUE, FALSE)) { 400s + for (useNames in c(TRUE, FALSE)) { 400s + validateIndicesTestMatrix(x, rows, cols, 400s + ftest = rowLogSumExps, 400s + fsure = rowLogSumExps_R, 400s + na.rm = na.rm, useNames = useNames) 400s + validateIndicesTestMatrix(x, rows, cols, 400s + fcoltest = colLogSumExps, 400s + fsure = rowLogSumExps_R, 400s + na.rm = na.rm, useNames = useNames) 400s + } 400s + } 400s + } 400s + } 400s + } 401s > 401s 401s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 401s Copyright (C) 2025 The R Foundation for Statistical Computing 401s Platform: aarch64-unknown-linux-gnu 401s 401s R is free software and comes with ABSOLUTELY NO WARRANTY. 401s You are welcome to redistribute it under certain conditions. 401s Type 'license()' or 'licence()' for distribution details. 401s 401s R is a collaborative project with many contributors. 401s Type 'contributors()' for more information and 401s 'citation()' on how to cite R or R packages in publications. 401s 401s Type 'demo()' for some demos, 'help()' for on-line help, or 401s 'help.start()' for an HTML browser interface to help. 401s Type 'q()' to quit R. 401s 401s > library("matrixStats") 401s > 401s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 401s > options(matrixStats.center.onUse = "ignore") 401s > 401s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 401s + suppressWarnings({ 401s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 401s + }) 401s + if (!useNames) names(res) <- NULL 401s + res 401s + } 401s > 401s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 401s + suppressWarnings({ 401s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 401s + }) 401s + if (!useNames) names(res) <- NULL 401s + res 401s + } 401s > 401s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 401s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 401s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 401s + } 401s > 401s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 401s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 401s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 401s + } 401s > 401s > 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > # A 3x3 matrix (no ties) 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > for (mode in c("integer", "double")) { 401s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 401s + cat("mode: ", mode, "\n", sep = "") 401s + storage.mode(x) <- mode 401s + str(x) 401s + 401s + # To check name attribute 401s + dimnames <- list(letters[1:3], LETTERS[1:3]) 401s + 401s + # Test with and without dimnames on x 401s + for (setDimnames in c(TRUE, FALSE)) { 401s + if (setDimnames) dimnames(x) <- dimnames 401s + else dimnames(x) <- NULL 401s + tx <- t(x) 401s + # Check names attribute 401s + for (useNames in c(TRUE, FALSE)) { 401s + cat("rowMads():\n") 401s + center <- rowMedians(x, na.rm = TRUE, useNames = useNames) 401s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 401s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 401s + r1b <- rowMads_center(x, na.rm = TRUE, useNames = useNames) 401s + r1c <- rowMads(x, center = center, na.rm = TRUE, useNames = useNames) 401s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 401s + r2b <- colMads_center(tx, na.rm = TRUE, useNames = useNames) 401s + stopifnot(all.equal(r1, r2)) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r1b, r1)) 401s + stopifnot(all.equal(r1c, r1)) 401s + stopifnot(all.equal(r2, r0)) 401s + stopifnot(all.equal(r2b, r2)) 401s + 401s + cat("colMads():\n") 401s + center <- colMedians(x, na.rm = TRUE, useNames = useNames) 401s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 401s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 401s + r1b <- colMads_center(x, na.rm = TRUE, useNames = useNames) 401s + r1c <- colMads(x, center = center, na.rm = TRUE, useNames = useNames) 401s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 401s + r2b <- rowMads_center(tx, na.rm = TRUE, useNames = useNames) 401s + stopifnot(all.equal(r1, r2)) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r1b, r1)) 401s + stopifnot(all.equal(r1c, r1)) 401s + stopifnot(all.equal(r2, r0)) 401s + stopifnot(all.equal(r2b, r2)) 401s + } 401s + } 401s + } 401s mode: integer 401s int [1:3, 1:3] 1 2 3 2 3 4 3 4 5 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s mode: double 401s num [1:3, 1:3] 1.1 2.1 3.1 2.1 3.1 4.1 3.1 4.1 5.1 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s > 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > # Ties: a 4x4 matrix 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > for (mode in c("integer", "double")) { 401s + x <- matrix(c(1:4, 2:5, 3:6, 4:7) + 0.1, nrow = 4, ncol = 4) 401s + cat("mode: ", mode, "\n", sep = "") 401s + storage.mode(x) <- mode 401s + str(x) 401s + tx <- t(x) 401s + 401s + # To check name attribute 401s + dimnames <- list(letters[1:4], LETTERS[1:4]) 401s + 401s + # Test with and without dimnames on x 401s + for (setDimnames in c(TRUE, FALSE)) { 401s + if (setDimnames) dimnames(x) <- dimnames 401s + else dimnames(x) <- NULL 401s + tx <- t(x) 401s + # Check names attribute 401s + for (useNames in c(TRUE, FALSE)) { 401s + cat("rowMads():\n") 401s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 401s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 401s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 401s + stopifnot(all.equal(r1, r2)) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r2, r0)) 401s + 401s + cat("colMads():\n") 401s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 401s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 401s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 401s + stopifnot(all.equal(r1, r2)) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r2, r0)) 401s + } 401s + } 401s + } 401s mode: integer 401s int [1:4, 1:4] 1 2 3 4 2 3 4 5 3 4 ... 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s mode: double 401s 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 ... 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s > tx <- NULL 401s > 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > # No ties: a 3x3 matrix with an NA value 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > for (mode in c("integer", "double")) { 401s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 401s + x[2, 2] <- NA_real_ 401s + 401s + cat("mode: ", mode, "\n", sep = "") 401s + storage.mode(x) <- mode 401s + str(x) 401s + tx <- t(x) 401s + 401s + # To check name attribute 401s + dimnames <- list(letters[1:3], LETTERS[1:3]) 401s + 401s + # Test with and without dimnames on x 401s + for (setDimnames in c(TRUE, FALSE)) { 401s + if (setDimnames) dimnames(x) <- dimnames 401s + else dimnames(x) <- NULL 401s + tx <- t(x) 401s + # Check names attribute 401s + for (useNames in c(TRUE, FALSE)) { 401s + cat("rowMads():\n") 401s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 401s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 401s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 401s + stopifnot(all.equal(r1, r2)) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r2, r0)) 401s + 401s + cat("colMads():\n") 401s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 401s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 401s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 401s + stopifnot(all.equal(r1, r2)) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r2, r0)) 401s + } 401s + } 401s + } 401s mode: integer 401s int [1:3, 1:3] 1 2 3 2 NA 4 3 4 5 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s mode: double 401s num [1:3, 1:3] 1.1 2.1 3.1 2.1 NA 4.1 3.1 4.1 5.1 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s rowMads(): 401s colMads(): 401s > tx <- NULL 401s > 401s > 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > # With and without some NAs 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > for (add_na in c(FALSE, TRUE)) { 401s + cat("add_na = ", add_na, "\n", sep = "") 401s + 401s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 401s + if (add_na) { 401s + x[3:7, c(2, 4)] <- NA_real_ 401s + } 401s + 401s + # To check name attribute 401s + dimnames <- list(letters[1:10], LETTERS[1:5]) 401s + 401s + # Test with and without dimnames on x 401s + for (setDimnames in c(TRUE, FALSE)) { 401s + if (setDimnames) dimnames(x) <- dimnames 401s + else dimnames(x) <- NULL 401s + tx <- t(x) 401s + # Row/column ranges 401s + for (na.rm in c(FALSE, TRUE)) { 401s + # Check names attribute 401s + for (useNames in c(TRUE, FALSE)) { 401s + cat("na.rm = ", na.rm, "\n", sep = "") 401s + cat("rowMads():\n") 401s + center <- rowMedians(x, na.rm = na.rm, useNames = useNames) 401s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 401s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 401s + r2 <- rowMads(x, center = center, na.rm = na.rm, useNames = useNames) 401s + r3 <- colMads(tx, na.rm = na.rm, useNames = useNames) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r2, r0)) 401s + stopifnot(all.equal(r2, r1)) 401s + stopifnot(all.equal(r3, r0)) 401s + stopifnot(all.equal(r3, r1)) 401s + stopifnot(all.equal(r3, r2)) 401s + 401s + cat("colMads():\n") 401s + center <- colMedians(x, na.rm = na.rm, useNames = useNames) 401s + r0 <- colMads_R(x, na.rm = na.rm, useNames = useNames) 401s + r1 <- colMads(x, na.rm = na.rm, useNames = useNames) 401s + r2 <- colMads(x, center = center, na.rm = na.rm, useNames = useNames) 401s + r3 <- rowMads(tx, na.rm = na.rm, useNames = useNames) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r2, r0)) 401s + stopifnot(all.equal(r2, r1)) 401s + stopifnot(all.equal(r3, r0)) 401s + stopifnot(all.equal(r3, r1)) 401s + stopifnot(all.equal(r3, r2)) 401s + } 401s + } 401s + } 401s + tx <- NULL 401s + } # for (add_na ...) 401s add_na = FALSE 401s na.rm = FALSE 401s rowMads(): 401s colMads(): 401s na.rm = FALSE 401s rowMads(): 401s colMads(): 401s na.rm = TRUE 401s rowMads(): 401s colMads(): 401s na.rm = TRUE 401s rowMads(): 401s colMads(): 401s na.rm = FALSE 401s rowMads(): 401s colMads(): 401s na.rm = FALSE 401s rowMads(): 401s colMads(): 401s na.rm = TRUE 401s rowMads(): 401s colMads(): 401s na.rm = TRUE 401s rowMads(): 401s colMads(): 401s add_na = TRUE 401s na.rm = FALSE 401s rowMads(): 401s colMads(): 401s na.rm = FALSE 401s rowMads(): 401s colMads(): 401s na.rm = TRUE 401s rowMads(): 401s colMads(): 401s na.rm = TRUE 401s rowMads(): 401s colMads(): 401s na.rm = FALSE 401s rowMads(): 401s colMads(): 401s na.rm = FALSE 401s rowMads(): 401s colMads(): 401s na.rm = TRUE 401s rowMads(): 401s colMads(): 401s na.rm = TRUE 401s rowMads(): 401s colMads(): 401s > 401s > 401s > 401s > 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > # All NAs 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 401s > # Test with and without dimnames on x 401s > for (setDimnames in c(TRUE, FALSE)) { 401s + if (setDimnames) dimnames(x) <- dimnames 401s + else dimnames(x) <- NULL 401s + tx <- t(x) 401s + # Row/column ranges 401s + for (na.rm in c(FALSE, TRUE)) { 401s + # Check names attribute 401s + for (useNames in c(TRUE, FALSE)) { 401s + cat("na.rm = ", na.rm, "\n", sep = "") 401s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 401s + if (na.rm) r0[is.na(r0)] <- NaN 401s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 401s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r2, r0)) 401s + stopifnot(all.equal(r1, r2)) 401s + } 401s + } 401s + } 401s na.rm = FALSE 401s na.rm = FALSE 401s na.rm = TRUE 401s na.rm = TRUE 401s na.rm = FALSE 401s na.rm = FALSE 401s na.rm = TRUE 401s na.rm = TRUE 401s > tx <- NULL 401s > 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > # A 1x1 matrix 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > x <- matrix(0, nrow = 1L, ncol = 1L) 401s > dimnames <- list("a", "A") 401s > # Test with and without dimnames on x 401s > for (setDimnames in c(TRUE, FALSE)) { 401s + if (setDimnames) dimnames(x) <- dimnames 401s + else dimnames(x) <- NULL 401s + tx <- t(x) 401s + # Row/column ranges 401s + for (na.rm in c(FALSE, TRUE)) { 401s + # Check names attribute 401s + for (useNames in c(TRUE, FALSE)) { 401s + cat("na.rm = ", na.rm, "\n", sep = "") 401s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 401s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 401s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r2, r0)) 401s + stopifnot(all.equal(r1, r2)) 401s + } 401s + } 401s + } 401s na.rm = FALSE 401s na.rm = FALSE 401s na.rm = TRUE 401s na.rm = TRUE 401s na.rm = FALSE 401s na.rm = FALSE 401s na.rm = TRUE 401s na.rm = TRUE 401s > 401s > 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > # A 0x0 matrix 401s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 401s > x <- matrix(double(0), nrow = 0, ncol = 0) 401s > tx <- t(x) 401s > for (na.rm in c(FALSE, TRUE)) { 401s + cat("na.rm = ", na.rm, "\n", sep = "") 401s + r0 <- rowMads_R(x, na.rm = na.rm) 401s + r1 <- rowMads(x, na.rm = na.rm) 401s + r2 <- colMads(tx, na.rm = na.rm) 401s + stopifnot(all.equal(r1, r2)) 401s + stopifnot(all.equal(r1, r0)) 401s + stopifnot(all.equal(r2, r0)) 401s + } 401s na.rm = FALSE 401s na.rm = TRUE 401s > 401s 401s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 401s Copyright (C) 2025 The R Foundation for Statistical Computing 401s Platform: aarch64-unknown-linux-gnu 401s 401s R is free software and comes with ABSOLUTELY NO WARRANTY. 401s You are welcome to redistribute it under certain conditions. 401s Type 'license()' or 'licence()' for distribution details. 401s 401s R is a collaborative project with many contributors. 401s Type 'contributors()' for more information and 401s 'citation()' on how to cite R or R packages in publications. 401s 401s Type 'demo()' for some demos, 'help()' for on-line help, or 401s 'help.start()' for an HTML browser interface to help. 401s Type 'q()' to quit R. 401s 402s > library("matrixStats") 402s > 402s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 402s > options(matrixStats.center.onUse = "ignore") 402s > 402s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 402s + suppressWarnings({ 402s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 402s + }) 402s + if (!useNames) names(res) <- NULL 402s + res 402s + } 402s > 402s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 402s + suppressWarnings({ 402s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 402s + }) 402s + if (!useNames) names(res) <- NULL 402s + res 402s + } 402s > 402s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 402s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 402s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 402s + } 402s > 402s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 402s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 402s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 402s + } 402s > 402s > 402s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 402s > # Subsetted tests 402s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 402s > source("utils/validateIndicesFramework.R") 402s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 402s > storage.mode(x) <- "integer" 402s > 402s > # To check names attribute 402s > dimnames <- list(letters[1:6], LETTERS[1:6]) 402s > 402s > # Test with and without dimnames on x 402s > for (setDimnames in c(TRUE, FALSE)) { 402s + if (setDimnames) dimnames(x) <- dimnames 402s + else dimnames(x) <- NULL 402s + 402s + count <- 0L 402s + for (rows in index_cases) { 402s + for (cols in index_cases) { 402s + count <- count + 1L 402s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 402s + useNames <- c(TRUE, FALSE) 402s + useNames <- useNames[count %% length(useNames) + 1] 402s + 402s + validateIndicesTestMatrix(x, rows, cols, 402s + ftest = rowMads, fsure = rowMads_R, 402s + na.rm = na.rm, useNames = useNames) 402s + validateIndicesTestMatrix(x, rows, cols, 402s + ftest = rowMads_center, fsure = rowMads_R, 402s + na.rm = na.rm, useNames = useNames) 402s + 402s + validateIndicesTestMatrix(x, rows, cols, 402s + fcoltest = colMads, fsure = rowMads_R, 402s + na.rm = na.rm, useNames = useNames) 402s + validateIndicesTestMatrix(x, rows, cols, 402s + fcoltest = colMads_center, fsure = rowMads_R, 402s + na.rm = na.rm, useNames = useNames) 402s + } 402s + } 402s + } 403s > 403s 403s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 403s Copyright (C) 2025 The R Foundation for Statistical Computing 403s Platform: aarch64-unknown-linux-gnu 403s 403s R is free software and comes with ABSOLUTELY NO WARRANTY. 403s You are welcome to redistribute it under certain conditions. 403s Type 'license()' or 'licence()' for distribution details. 403s 403s R is a collaborative project with many contributors. 403s Type 'contributors()' for more information and 403s 'citation()' on how to cite R or R packages in publications. 403s 403s Type 'demo()' for some demos, 'help()' for on-line help, or 403s 'help.start()' for an HTML browser interface to help. 403s Type 'q()' to quit R. 403s 403s > library("matrixStats") 403s > 403s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 403s + res <- rowMeans(x, na.rm = na.rm) 403s + if (!useNames) names(res) <- NULL 403s + res 403s + } 403s > 403s > colMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 403s + res <- colMeans(x, na.rm = na.rm) 403s + if (!useNames) names(res) <- NULL 403s + res 403s + } 403s > 403s > for (mode in c("integer", "logical", "double")) { 403s + x <- matrix(-4:4, nrow = 3, ncol = 3) 403s + storage.mode(x) <- mode 403s + if (mode == "double") x <- x + 0.1 403s + 403s + # To check names attribute 403s + dimnames <- list(letters[1:3], LETTERS[1:3]) 403s + 403s + # Test with and without dimnames on x 403s + for (setDimnames in c(TRUE, FALSE)) { 403s + if (setDimnames) dimnames(x) <- dimnames 403s + else dimnames(x) <- NULL 403s + # Check names attribute 403s + for (useNames in c(TRUE, FALSE)) { 403s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + 403s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + } 403s + } 403s + } 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Special case: Single-element matrix 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > cat("Special case: Single-element matrix:\n") 403s Special case: Single-element matrix: 403s > for (mode in c("integer", "logical", "double")) { 403s + x <- matrix(1, nrow = 1, ncol = 1) 403s + storage.mode(x) <- mode 403s + 403s + # To check names attribute 403s + dimnames <- list("a", "A") 403s + 403s + # Test with and without dimnames on x 403s + for (setDimnames in c(TRUE, FALSE)) { 403s + if (setDimnames) dimnames(x) <- dimnames 403s + else dimnames(x) <- NULL 403s + # Check names attribute 403s + for (useNames in c(TRUE, FALSE)) { 403s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + 403s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + } 403s + } 403s + } 403s > 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Special case: Empty matrix 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > cat("Special case: Empty matrix:\n") 403s Special case: Empty matrix: 403s > for (mode in c("integer", "logical", "double")) { 403s + x <- matrix(integer(0), nrow = 0, ncol = 0) 403s + storage.mode(x) <- mode 403s + 403s + y0 <- rowMeans(x, na.rm = FALSE) 403s + y1 <- rowMeans2(x, na.rm = FALSE) 403s + stopifnot(all.equal(y1, y0)) 403s + 403s + y0 <- colMeans(x, na.rm = FALSE) 403s + y1 <- colMeans2(x, na.rm = FALSE) 403s + stopifnot(all.equal(y1, y0)) 403s + } 403s > 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Special case: All NAs 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > cat("Special case: All NAs:\n") 403s Special case: All NAs: 403s > for (mode in c("integer", "logical", "double")) { 403s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 403s + storage.mode(x) <- mode 403s + 403s + # To check names attribute 403s + dimnames <- list(letters[1:3], LETTERS[1:3]) 403s + 403s + # Test with and without dimnames on x 403s + for (setDimnames in c(TRUE, FALSE)) { 403s + if (setDimnames) dimnames(x) <- dimnames 403s + else dimnames(x) <- NULL 403s + # Check names attribute 403s + for (useNames in c(TRUE, FALSE)) { 403s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 403s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + 403s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 403s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + } 403s + } 403s + } 403s > 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Special case: All NaNs 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > cat("Special case: All NaNs:\n") 403s Special case: All NaNs: 403s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 403s > 403s > # Test with and without dimnames on x 403s > for (setDimnames in c(TRUE, FALSE)) { 403s + if (setDimnames) dimnames(x) <- dimnames 403s + else dimnames(x) <- NULL 403s + # Check names attribute 403s + for (useNames in c(TRUE, FALSE)) { 403s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 403s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + 403s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 403s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + } 403s + } 403s > 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Special case: All Infs 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > cat("Special case: All Infs:\n") 403s Special case: All Infs: 403s > x <- matrix(Inf, nrow = 3, ncol = 3) 403s > 403s > # Test with and without dimnames on x 403s > for (setDimnames in c(TRUE, FALSE)) { 403s + if (setDimnames) dimnames(x) <- dimnames 403s + else dimnames(x) <- NULL 403s + # Check names attribute 403s + for (useNames in c(TRUE, FALSE)) { 403s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + 403s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + } 403s + } 403s > 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Special case: All -Infs 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > cat("Special case: All -Infs:\n") 403s Special case: All -Infs: 403s > x <- matrix(-Inf, nrow = 3, ncol = 3) 403s > 403s > # Test with and without dimnames on x 403s > for (setDimnames in c(TRUE, FALSE)) { 403s + if (setDimnames) dimnames(x) <- dimnames 403s + else dimnames(x) <- NULL 403s + # Check names attribute 403s + for (useNames in c(TRUE, FALSE)) { 403s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + 403s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + } 403s + } 403s > 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Special case: Infs and -Infs 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > cat("Special case: Infs and -Infs:\n") 403s Special case: Infs and -Infs: 403s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 403s > 403s > # To check names attribute 403s > dimnames <- list(letters[1:4], LETTERS[1:4]) 403s > 403s > # Test with and without dimnames on x 403s > for (setDimnames in c(TRUE, FALSE)) { 403s + if (setDimnames) dimnames(x) <- dimnames 403s + else dimnames(x) <- NULL 403s + # Check names attribute 403s + for (useNames in c(TRUE, FALSE)) { 403s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + 403s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + } 403s + } 403s > 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Special case: NaNs and NAs 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > cat("Special case: NaNs and NAs:\n") 403s Special case: NaNs and NAs: 403s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 403s > 403s > # Test with and without dimnames on x 403s > for (setDimnames in c(TRUE, FALSE)) { 403s + if (setDimnames) dimnames(x) <- dimnames 403s + else dimnames(x) <- NULL 403s + # Check names attribute 403s + for (useNames in c(TRUE, FALSE)) { 403s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + str(y0) 403s + stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 403s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 403s + str(y1) 403s + stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 403s + stopifnot(all.equal(y1, y0)) 403s + 403s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 403s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 403s + stopifnot(all.equal(y1, y0)) 403s + } 403s + } 403s Named num [1:4] NaN NA NaN NA 403s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 403s Named num [1:4] NaN NA NaN NA 403s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 403s num [1:4] NaN NA NaN NA 403s num [1:4] NaN NA NaN NA 403s num [1:4] NaN NA NaN NA 403s num [1:4] NaN NA NaN NA 403s num [1:4] NaN NA NaN NA 403s num [1:4] NaN NA NaN NA 403s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 403s > ## returned here (as one would expect). NaN might very well be returned, 403s > ## when both NA and NaN are involved. This is an accepted feature in R, 403s > ## which is documented in help("is.nan"). See also 403s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 403s > ## Thus, we cannot guarantee that y1 is identical to y0. 403s > 403s > 403s > 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Special case: Integer overflow with ties 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > cat("Special case: Integer overflow with ties:\n") 403s Special case: Integer overflow with ties: 403s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 403s > 403s > # Test with and without dimnames on x 403s > for (setDimnames in c(TRUE, FALSE)) { 403s + if (setDimnames) dimnames(x) <- dimnames 403s + else dimnames(x) <- NULL 403s + # Check names attribute 403s + for (useNames in c(TRUE, FALSE)) { 403s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + 403s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 403s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 403s + stopifnot(all.equal(y1, y0)) 403s + } 403s + } 403s > 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Consistency checks 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > set.seed(1) 403s > 403s > cat("Consistency checks:\n") 403s Consistency checks: 403s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 403s > for (kk in seq_len(n_sims)) { 403s + cat("Random test #", kk, "\n", sep = "") 403s + 403s + # Simulate data in a matrix of any shape 403s + dim <- sample(50:200, size = 2) 403s + n <- prod(dim) 403s + x <- rnorm(n, sd = 100) 403s + dim(x) <- dim 403s + 403s + # Add NAs? 403s + if ((kk %% 4) %in% c(3, 0)) { 403s + cat("Adding NAs\n") 403s + nna <- sample(n, size = 1) 403s + na_values <- c(NA_real_, NaN) 403s + t <- sample(na_values, size = nna, replace = TRUE) 403s + x[sample(length(x), size = nna)] <- t 403s + } 403s + 403s + # Mode? 403s + modes <- "double" 403s + if ((kk %% 4) %in% c(2, 0)) { 403s + modes <- c("integer", "logical") 403s + } 403s + 403s + for (mode in modes) { 403s + if (mode != "double") { 403s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 403s + storage.mode(x) <- mode 403s + } 403s + 403s + na.rm <- sample(c(TRUE, FALSE), size = 1) 403s + 403s + # rowMeans2(): 403s + y0 <- rowMeans(x, na.rm = na.rm) 403s + y1 <- rowMeans2(x, na.rm = na.rm) 403s + stopifnot(all.equal(y1, y0)) 403s + y2 <- colMeans2(t(x), na.rm = na.rm) 403s + stopifnot(all.equal(y2, y0)) 403s + 403s + # colMeans2(): 403s + y0 <- colMeans(x, na.rm = na.rm) 403s + y1 <- colMeans2(x, na.rm = na.rm) 403s + stopifnot(all.equal(y1, y0)) 403s + y2 <- rowMeans2(t(x), na.rm = na.rm) 403s + stopifnot(all.equal(y2, y0)) 403s + } 403s + } # for (kk ...) 403s Random test #1 403s Random test #2 403s Coercing from double to integer 403s Coercing from integer to logical 403s Random test #3 403s Adding NAs 403s Random test #4 403s Adding NAs 403s Coercing from double to integer 403s Coercing from integer to logical 403s Random test #5 403s Random test #6 403s Coercing from double to integer 403s Coercing from integer to logical 403s Random test #7 403s Adding NAs 403s Random test #8 403s Adding NAs 403s Coercing from double to integer 403s Coercing from integer to logical 403s Random test #9 403s Random test #10 403s Coercing from double to integer 403s Coercing from integer to logical 403s Random test #11 403s Adding NAs 403s Random test #12 403s Adding NAs 403s Coercing from double to integer 403s Coercing from integer to logical 403s Random test #13 403s Random test #14 403s Coercing from double to integer 403s Coercing from integer to logical 403s Random test #15 403s Adding NAs 403s Random test #16 403s Adding NAs 403s Coercing from double to integer 403s Coercing from integer to logical 403s Random test #17 403s Random test #18 403s Coercing from double to integer 403s Coercing from integer to logical 403s Random test #19 403s Adding NAs 403s Random test #20 403s Adding NAs 403s Coercing from double to integer 403s Coercing from integer to logical 403s > 403s 403s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 403s Copyright (C) 2025 The R Foundation for Statistical Computing 403s Platform: aarch64-unknown-linux-gnu 403s 403s R is free software and comes with ABSOLUTELY NO WARRANTY. 403s You are welcome to redistribute it under certain conditions. 403s Type 'license()' or 'licence()' for distribution details. 403s 403s R is a collaborative project with many contributors. 403s Type 'contributors()' for more information and 403s 'citation()' on how to cite R or R packages in publications. 403s 403s Type 'demo()' for some demos, 'help()' for on-line help, or 403s 'help.start()' for an HTML browser interface to help. 403s Type 'q()' to quit R. 403s 403s > library("matrixStats") 403s > 403s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 403s + res <- rowMeans(x, na.rm = na.rm) 403s + if (!useNames) names(res) <- NULL 403s + res 403s + } 403s > 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > # Subsetted tests 403s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 403s > source("utils/validateIndicesFramework.R") 403s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 403s > storage.mode(x) <- "integer" 403s > 403s > # To check names attribute 403s > dimnames <- list(letters[1:6], LETTERS[1:6]) 403s > 403s > # Test with and without dimnames on x 403s > for (setDimnames in c(TRUE, FALSE)) { 403s + if (setDimnames) dimnames(x) <- dimnames 403s + else dimnames(x) <- NULL 403s + 403s + count <- 0L 403s + for (rows in index_cases) { 403s + for (cols in index_cases) { 403s + count <- count + 1L 403s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 403s + useNames <- c(TRUE, FALSE) 403s + useNames <- useNames[count %% length(useNames) + 1] 403s + 403s + validateIndicesTestMatrix(x, rows, cols, 403s + ftest = rowMeans2, fsure = rowMeans_R, 403s + na.rm = na.rm, useNames = useNames) 403s + validateIndicesTestMatrix(x, rows, cols, 403s + fcoltest = colMeans2, fsure = rowMeans_R, 403s + na.rm = na.rm, useNames = useNames) 403s + } 403s + } 403s + } 403s > 403s 403s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 403s Copyright (C) 2025 The R Foundation for Statistical Computing 403s Platform: aarch64-unknown-linux-gnu 403s 403s R is free software and comes with ABSOLUTELY NO WARRANTY. 403s You are welcome to redistribute it under certain conditions. 403s Type 'license()' or 'licence()' for distribution details. 403s 403s R is a collaborative project with many contributors. 403s Type 'contributors()' for more information and 403s 'citation()' on how to cite R or R packages in publications. 403s 403s Type 'demo()' for some demos, 'help()' for on-line help, or 403s 'help.start()' for an HTML browser interface to help. 403s Type 'q()' to quit R. 403s 404s > library("matrixStats") 404s > 404s > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 404s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 404s + if (!useNames) names(res) <- NULL 404s + res 404s + } 404s > 404s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 404s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 404s + if (!useNames) names(res) <- NULL 404s + res 404s + } 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Special case: Non-ties 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > cat("Special case: Non-ties:\n") 404s Special case: Non-ties: 404s > for (mode in c("integer", "double")) { 404s + x <- matrix(1:9 + 0.1, nrow = 3, ncol = 3) 404s + storage.mode(x) <- mode 404s + 404s + # To check names attribute 404s + dimnames <- list(letters[1:3], LETTERS[1:3]) 404s + 404s + # Test with and without dimnames on x 404s + for (setDimnames in c(TRUE, FALSE)) { 404s + if (setDimnames) dimnames(x) <- dimnames 404s + else dimnames(x) <- NULL 404s + # Check names attribute 404s + for (useNames in c(TRUE, FALSE)) { 404s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + 404s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + } 404s + } 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Special case: Ties 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > cat("Special case: Ties:\n") 404s Special case: Ties: 404s > for (mode in c("integer", "double")) { 404s + x <- matrix(1:16 + 0.1, nrow = 4, ncol = 4) 404s + storage.mode(x) <- mode 404s + 404s + # To check names attribute 404s + dimnames <- list(letters[1:4], LETTERS[1:4]) 404s + 404s + # Test with and without dimnames on x 404s + for (setDimnames in c(TRUE, FALSE)) { 404s + if (setDimnames) dimnames(x) <- dimnames 404s + else dimnames(x) <- NULL 404s + # Check names attribute 404s + for (useNames in c(TRUE, FALSE)) { 404s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + 404s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + } 404s + } 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Special case: Single-element matrix 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > cat("Special case: Single-element matrix:\n") 404s Special case: Single-element matrix: 404s > for (mode in c("integer", "double")) { 404s + x <- matrix(1, nrow = 1, ncol = 1) 404s + storage.mode(x) <- mode 404s + 404s + # To check names attribute 404s + dimnames <- list("a", "A") 404s + 404s + # Test with and without dimnames on x 404s + for (setDimnames in c(TRUE, FALSE)) { 404s + if (setDimnames) dimnames(x) <- dimnames 404s + else dimnames(x) <- NULL 404s + # Check names attribute 404s + for (useNames in c(TRUE, FALSE)) { 404s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + 404s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + } 404s + } 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Special case: Empty matrix 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > cat("Special case: Empty matrix:\n") 404s Special case: Empty matrix: 404s > for (mode in c("integer", "double")) { 404s + x <- matrix(integer(0), nrow = 0, ncol = 0) 404s + storage.mode(x) <- mode 404s + 404s + y0 <- rowMedians_R(x, na.rm = FALSE) 404s + y1 <- rowMedians(x, na.rm = FALSE) 404s + stopifnot(all.equal(y1, y0)) 404s + 404s + y0 <- colMedians_R(x, na.rm = FALSE) 404s + y1 <- colMedians(x, na.rm = FALSE) 404s + stopifnot(all.equal(y1, y0)) 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Special case: All NAs 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > cat("Special case: All NAs:\n") 404s Special case: All NAs: 404s > for (mode in c("integer", "double")) { 404s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 404s + storage.mode(x) <- mode 404s + 404s + # To check names attribute 404s + dimnames <- list(letters[1:3], LETTERS[1:3]) 404s + 404s + # Test with and without dimnames on x 404s + for (setDimnames in c(TRUE, FALSE)) { 404s + if (setDimnames) dimnames(x) <- dimnames 404s + else dimnames(x) <- NULL 404s + # Check names attribute 404s + for (useNames in c(TRUE, FALSE)) { 404s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 404s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + 404s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 404s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + } 404s + } 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Special case: All NaNs 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > cat("Special case: All NaNs:\n") 404s Special case: All NaNs: 404s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 404s > 404s > # Test with and without dimnames on x 404s > for (setDimnames in c(TRUE, FALSE)) { 404s + if (setDimnames) dimnames(x) <- dimnames 404s + else dimnames(x) <- NULL 404s + # Check names attribute 404s + for (useNames in c(TRUE, FALSE)) { 404s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 404s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + 404s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 404s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + } 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Special case: All Infs 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > cat("Special case: All Infs:\n") 404s Special case: All Infs: 404s > x <- matrix(Inf, nrow = 3, ncol = 3) 404s > 404s > # Test with and without dimnames on x 404s > for (setDimnames in c(TRUE, FALSE)) { 404s + if (setDimnames) dimnames(x) <- dimnames 404s + else dimnames(x) <- NULL 404s + # Check names attribute 404s + for (useNames in c(TRUE, FALSE)) { 404s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + 404s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + } 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Special case: All -Infs 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > cat("Special case: All -Infs:\n") 404s Special case: All -Infs: 404s > x <- matrix(-Inf, nrow = 3, ncol = 3) 404s > 404s > # Test with and without dimnames on x 404s > for (setDimnames in c(TRUE, FALSE)) { 404s + if (setDimnames) dimnames(x) <- dimnames 404s + else dimnames(x) <- NULL 404s + # Check names attribute 404s + for (useNames in c(TRUE, FALSE)) { 404s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + 404s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + } 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Special case: Infs and -Infs 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > cat("Special case: Infs and -Infs:\n") 404s Special case: Infs and -Infs: 404s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 404s > 404s > # To check names attribute 404s > dimnames <- list(letters[1:4], LETTERS[1:4]) 404s > 404s > # Test with and without dimnames on x 404s > for (setDimnames in c(TRUE, FALSE)) { 404s + if (setDimnames) dimnames(x) <- dimnames 404s + else dimnames(x) <- NULL 404s + # Check names attribute 404s + for (useNames in c(TRUE, FALSE)) { 404s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + 404s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + } 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Special case: Integer overflow with ties 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > cat("Special case: Integer overflow with ties:\n") 404s Special case: Integer overflow with ties: 404s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 404s > 404s > # Test with and without dimnames on x 404s > for (setDimnames in c(TRUE, FALSE)) { 404s + if (setDimnames) dimnames(x) <- dimnames 404s + else dimnames(x) <- NULL 404s + # Check names attribute 404s + for (useNames in c(TRUE, FALSE)) { 404s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + 404s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 404s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 404s + stopifnot(all.equal(y1, y0)) 404s + } 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Consistency checks 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > set.seed(1) 404s > 404s > cat("Consistency checks:\n") 404s Consistency checks: 404s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 404s > for (kk in seq_len(n_sims)) { 404s + cat("Random test #", kk, "\n", sep = "") 404s + 404s + # Simulate data in a matrix of any shape 404s + dim <- sample(50:200, size = 2) 404s + n <- prod(dim) 404s + x <- rnorm(n, sd = 100) 404s + dim(x) <- dim 404s + 404s + # Add NAs? 404s + if ((kk %% 4) %in% c(3, 0)) { 404s + cat("Adding NAs\n") 404s + nna <- sample(n, size = 1) 404s + na_values <- c(NA_real_, NaN) 404s + t <- sample(na_values, size = nna, replace = TRUE) 404s + x[sample(length(x), size = nna)] <- t 404s + } 404s + 404s + # Integer or double? 404s + if ((kk %% 4) %in% c(2, 0)) { 404s + cat("Coercing to integers\n") 404s + storage.mode(x) <- "integer" 404s + } 404s + 404s + na.rm <- sample(c(TRUE, FALSE), size = 1) 404s + 404s + # rowMedians(): 404s + y0 <- rowMedians_R(x, na.rm = na.rm) 404s + y1 <- rowMedians(x, na.rm = na.rm) 404s + stopifnot(all.equal(y1, y0)) 404s + y2 <- colMedians(t(x), na.rm = na.rm) 404s + stopifnot(all.equal(y2, y0)) 404s + 404s + # colMedians(): 404s + y0 <- colMedians_R(x, na.rm = na.rm) 404s + y1 <- colMedians(x, na.rm = na.rm) 404s + stopifnot(all.equal(y1, y0)) 404s + y2 <- rowMedians(t(x), na.rm = na.rm) 404s + stopifnot(all.equal(y2, y0)) 404s + } # for (kk ...) 404s Random test #1 404s Random test #2 404s Coercing to integers 404s Random test #3 404s Adding NAs 404s Random test #4 404s Adding NAs 404s Coercing to integers 404s Random test #5 404s Random test #6 404s Coercing to integers 404s Random test #7 404s Adding NAs 404s Random test #8 404s Adding NAs 404s Coercing to integers 404s Random test #9 404s Random test #10 404s Coercing to integers 404s Random test #11 404s Adding NAs 404s Random test #12 404s Adding NAs 404s Coercing to integers 404s Random test #13 404s Random test #14 404s Coercing to integers 404s Random test #15 404s Adding NAs 404s Random test #16 404s Adding NAs 404s Coercing to integers 404s Random test #17 404s Random test #18 404s Coercing to integers 404s Random test #19 404s Adding NAs 404s Random test #20 404s Adding NAs 404s Coercing to integers 404s > 404s 404s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 404s Copyright (C) 2025 The R Foundation for Statistical Computing 404s Platform: aarch64-unknown-linux-gnu 404s 404s R is free software and comes with ABSOLUTELY NO WARRANTY. 404s You are welcome to redistribute it under certain conditions. 404s Type 'license()' or 'licence()' for distribution details. 404s 404s R is a collaborative project with many contributors. 404s Type 'contributors()' for more information and 404s 'citation()' on how to cite R or R packages in publications. 404s 404s Type 'demo()' for some demos, 'help()' for on-line help, or 404s 'help.start()' for an HTML browser interface to help. 404s Type 'q()' to quit R. 404s 404s > library("matrixStats") 404s > 404s > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 404s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 404s + if (!useNames) names(res) <- NULL 404s + res 404s + } 404s > 404s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 404s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 404s + if (!useNames) names(res) <- NULL 404s + res 404s + } 404s > 404s > 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > # Subsetted tests 404s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 404s > source("utils/validateIndicesFramework.R") 404s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 404s > storage.mode(x) <- "integer" 404s > 404s > # To check names attribute 404s > dimnames <- list(letters[1:6], LETTERS[1:6]) 404s > 404s > # Test with and without dimnames on x 404s > for (setDimnames in c(TRUE, FALSE)) { 404s + if (setDimnames) dimnames(x) <- dimnames 404s + else dimnames(x) <- NULL 404s + 404s + count <- 0L 404s + for (rows in index_cases) { 404s + for (cols in index_cases) { 404s + count <- count + 1L 404s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 404s + useNames <- c(TRUE, FALSE) 404s + useNames <- useNames[count %% length(useNames) + 1] 404s + 404s + validateIndicesTestMatrix(x, rows, cols, 404s + ftest = rowMedians, fsure = rowMedians_R, 404s + na.rm = na.rm, useNames = useNames) 404s + validateIndicesTestMatrix(x, rows, cols, 404s + fcoltest = colMedians, fsure = rowMedians_R, 404s + na.rm = na.rm, useNames = useNames) 404s + } 404s + } 404s + } 405s > 405s 405s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 405s Copyright (C) 2025 The R Foundation for Statistical Computing 405s Platform: aarch64-unknown-linux-gnu 405s 405s R is free software and comes with ABSOLUTELY NO WARRANTY. 405s You are welcome to redistribute it under certain conditions. 405s Type 'license()' or 'licence()' for distribution details. 405s 405s R is a collaborative project with many contributors. 405s Type 'contributors()' for more information and 405s 'citation()' on how to cite R or R packages in publications. 405s 405s Type 'demo()' for some demos, 'help()' for on-line help, or 405s 'help.start()' for an HTML browser interface to help. 405s Type 'q()' to quit R. 405s 405s > library("matrixStats") 405s > library("stats") 405s > 405s > asWhich <- function(probs, max) { 405s + idx <- as.integer(round(probs * max)) 405s + if (idx < 1L) { 405s + idx <- 1L 405s + } else if (idx > max) { 405s + idx <- max 405s + } 405s + idx 405s + } # asWhich() 405s > 405s > rowOrderStats_R <- function(x, probs, ..., useNames = TRUE) { 405s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 405s + 405s + # Remove Attributes 405s + if (!useNames || length(ans) == 0L) attributes(ans) <- NULL 405s + ans 405s + } # rowOrderStats_R() 405s > 405s > 405s > set.seed(1) 405s > 405s > 405s > # Simulate data in a matrix of any shape 405s > nrow <- 60L 405s > ncol <- 30L 405s > x <- rnorm(nrow * ncol) 405s > dim(x) <- c(nrow, ncol) 405s > probs <- 0.3 405s > which <- asWhich(probs, max = ncol) 405s > 405s > y0 <- rowOrderStats_R(x, probs = probs) 405s > y1 <- rowOrderStats(x, which = which) 405s > stopifnot(all.equal(y1, y0)) 405s > y2 <- colOrderStats(t(x), which = which) 405s > stopifnot(all.equal(y2, y0)) 405s > 405s > 405s > 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > # Consistency checks 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > for (mode in c("integer", "double")) { 405s + cat("Consistency checks without NAs:\n") 405s + for (kk in 1:3) { 405s + cat("Random test #", kk, "\n", sep = "") 405s + 405s + # Simulate data in a matrix of any shape 405s + nrow <- sample(20L, size = 1L) 405s + ncol <- sample(20L, size = 1L) 405s + x <- rnorm(nrow * ncol) 405s + dim(x) <- c(nrow, ncol) 405s + 405s + cat("mode: ", mode, "\n", sep = "") 405s + storage.mode(x) <- mode 405s + str(x) 405s + 405s + probs <- runif(1) 405s + which <- asWhich(probs, max = ncol) 405s + 405s + y0 <- rowOrderStats_R(x, probs = probs) 405s + y1 <- rowOrderStats(x, which = which) 405s + stopifnot(all.equal(y1, y0)) 405s + y2 <- colOrderStats(t(x), which = which) 405s + stopifnot(all.equal(y2, y0)) 405s + } # for (kk in ...) 405s + } # for (mode ...) 405s Consistency checks without NAs: 405s Random test #1 405s mode: integer 405s int [1:14, 1:6] 0 0 1 0 2 -1 1 0 0 0 ... 405s Random test #2 405s mode: integer 405s int [1:8, 1:13] 0 0 1 -2 0 0 0 0 1 0 ... 405s Random test #3 405s mode: integer 405s int [1:20, 1:17] 0 0 0 0 1 0 1 0 0 -1 ... 405s Consistency checks without NAs: 405s Random test #1 405s mode: double 405s num [1:9, 1:5] -1.4286 -0.00386 -0.70456 -0.29242 -0.49607 ... 405s Random test #2 405s mode: double 405s num [1:11, 1:20] -0.796 0.482 -0.952 0.5 1.242 ... 405s Random test #3 405s mode: double 405s num [1:7, 1:18] 1.553 -2.405 0.167 -0.403 -1.746 ... 405s > 405s > 405s > # Check names attribute 405s > x <- matrix(1:9 + 0.1, nrow = 3L, ncol = 3L) 405s > 405s > probs <- runif(1) 405s > which <- asWhich(probs, max = ncol(x)) 405s > 405s > dimnames <- list(letters[1:3], LETTERS[1:3]) 405s > 405s > # Test with and without dimnames on x 405s > for (setDimnames in c(TRUE, FALSE)) { 405s + if (setDimnames) dimnames(x) <- dimnames 405s + else dimnames(x) <- NULL 405s + # Check names attribute 405s + for (useNames in c(TRUE, FALSE)) { 405s + y0 <- rowOrderStats_R(x, probs = probs, useNames = useNames) 405s + y1 <- rowOrderStats(x, which = which, useNames = useNames) 405s + stopifnot(all.equal(y1, y0)) 405s + y2 <- colOrderStats(t(x), which = which, useNames = useNames) 405s + stopifnot(all.equal(y2, y0)) 405s + } 405s + } 405s > 405s 405s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 405s Copyright (C) 2025 The R Foundation for Statistical Computing 405s Platform: aarch64-unknown-linux-gnu 405s 405s R is free software and comes with ABSOLUTELY NO WARRANTY. 405s You are welcome to redistribute it under certain conditions. 405s Type 'license()' or 'licence()' for distribution details. 405s 405s R is a collaborative project with many contributors. 405s Type 'contributors()' for more information and 405s 'citation()' on how to cite R or R packages in publications. 405s 405s Type 'demo()' for some demos, 'help()' for on-line help, or 405s 'help.start()' for an HTML browser interface to help. 405s Type 'q()' to quit R. 405s 405s > library("matrixStats") 405s > 405s > rowOrderStats_R <- function(x, probs, ..., useNames = TRUE) { 405s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 405s + 405s + # Remove Attributes 405s + if (!useNames || length(ans) == 0L) attributes(ans) <- NULL 405s + ans 405s + } # rowOrderStats_R() 405s > 405s > 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > # Subsetted tests 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > source("utils/validateIndicesFramework.R") 405s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 405s > storage.mode(x) <- "integer" 405s > 405s > # To check names attribute 405s > dimnames <- list(letters[1:6], LETTERS[1:6]) 405s > 405s > probs <- 0.3 405s > # Test with and without dimnames on x 405s > for (setDimnames in c(TRUE, FALSE)) { 405s + if (setDimnames) dimnames(x) <- dimnames 405s + else dimnames(x) <- NULL 405s + for (rows in index_cases) { 405s + for (cols in index_cases) { 405s + # Check names attribute 405s + for (useNames in c(TRUE, FALSE)) { 405s + if (is.null(cols)) which <- round(probs * ncol(x)) 405s + else { 405s + xxrows <- rows 405s + suppressWarnings({ 405s + xx <- tryCatch(x[, cols, drop = FALSE], error = function(c) "error") 405s + if (identical(xx, "error")) which <- 0L 405s + else which <- round(probs * ncol(xx)) 405s + }) 405s + } 405s + if (which == 0L) next 405s + 405s + validateIndicesTestMatrix(x, rows, cols, 405s + ftest = rowOrderStats, fsure = rowOrderStats_R, 405s + which = which, probs = probs, useNames = useNames) 405s + validateIndicesTestMatrix(x, rows, cols, 405s + fcoltest = colOrderStats, fsure = rowOrderStats_R, 405s + which = which, probs = probs, useNames = useNames) 405s + } 405s + } 405s + } 405s + } 406s > 406s 406s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 406s Copyright (C) 2025 The R Foundation for Statistical Computing 406s Platform: aarch64-unknown-linux-gnu 406s 406s R is free software and comes with ABSOLUTELY NO WARRANTY. 406s You are welcome to redistribute it under certain conditions. 406s Type 'license()' or 'licence()' for distribution details. 406s 406s R is a collaborative project with many contributors. 406s Type 'contributors()' for more information and 406s 'citation()' on how to cite R or R packages in publications. 406s 406s Type 'demo()' for some demos, 'help()' for on-line help, or 406s 'help.start()' for an HTML browser interface to help. 406s Type 'q()' to quit R. 406s 406s > library("matrixStats") 406s > 406s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = TRUE) { 406s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 406s + if (!useNames) names(res) <- NULL 406s + res 406s + } 406s > 406s > all.equal.na <- function(target, current, ...) { 406s + # Computations involving NaN may return NaN or NA, cf. ?is.nan 406s + current[is.nan(current)] <- NA_real_ 406s + target[is.nan(target)] <- NA_real_ 406s + all.equal(target, current, ...) 406s + } 406s > 406s > for (mode in c("integer", "double")) { 406s + # Missing values 406s + x <- matrix(c(1, NA, NaN, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 406s + cat("mode: ", mode, "\n", sep = "") 406s + storage.mode(x) <- mode 406s + str(x) 406s + 406s + # To check names attribute 406s + dimnames <- list(letters[1:4], LETTERS[1:2]) 406s + 406s + # Test with and without dimnames on x 406s + for (setDimnames in c(TRUE, FALSE)) { 406s + if (setDimnames) dimnames(x) <- dimnames 406s + else dimnames(x) <- NULL 406s + # Check names attribute 406s + for (useNames in c(TRUE, FALSE)) { 406s + y0 <- rowProds_R(x, na.rm = TRUE, useNames = useNames) 406s + print(y0) 406s + y1 <- rowProds(x, na.rm = TRUE, useNames = useNames) 406s + print(y1) 406s + y2 <- colProds(t(x), na.rm = TRUE, useNames = useNames) 406s + print(y2) 406s + stopifnot(all.equal(y1, y0)) 406s + stopifnot(all.equal(y2, y1)) 406s + 406s + # Missing values 406s + y0 <- rowProds_R(x, na.rm = FALSE, useNames = useNames) 406s + print(y0) 406s + y1 <- rowProds(x, na.rm = FALSE, useNames = useNames) 406s + print(y1) 406s + y2 <- colProds(t(x), na.rm = FALSE, useNames = useNames) 406s + print(y2) 406s + stopifnot(all.equal(y1, y0)) 406s + stopifnot(all.equal(y2, y1)) 406s + 406s + # "Empty" rows 406s + y0 <- rowProds_R(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 406s + print(y0) 406s + y1 <- rowProds(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 406s + print(y1) 406s + y2 <- colProds(t(x[integer(0), , drop = FALSE]), na.rm = FALSE, useNames = useNames) 406s + print(y2) 406s + stopifnot(all.equal.na(y1, y0)) 406s + stopifnot(all.equal(y2, y1)) 406s + stopifnot(length(y1) == 0L) 406s + 406s + # Using product() 406s + y1 <- rowProds(x, method = "expSumLog", na.rm = FALSE, useNames = useNames) 406s + print(y1) 406s + y2 <- colProds(t(x), method = "expSumLog", na.rm = FALSE, useNames = useNames) 406s + print(y2) 406s + stopifnot(all.equal(y2, y1)) 406s + } 406s + } 406s + } # for (mode ...) 406s mode: integer 406s int [1:4, 1:2] 1 NA NA 1 1 0 1 0 406s a b c d 406s 1 0 1 0 406s a b c d 406s 1 0 1 0 406s a b c d 406s 1 0 1 0 406s a b c d 406s 1 NA NA 0 406s a b c d 406s 1 NA NA 0 406s a b c d 406s 1 NA NA 0 406s numeric(0) 406s numeric(0) 406s numeric(0) 406s a b c d 406s 1 NA NA 0 406s a b c d 406s 1 NA NA 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s numeric(0) 406s numeric(0) 406s numeric(0) 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s numeric(0) 406s numeric(0) 406s numeric(0) 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s numeric(0) 406s numeric(0) 406s numeric(0) 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s mode: double 406s num [1:4, 1:2] 1 NA NaN 1 1 0 1 0 406s a b c d 406s 1 0 1 0 406s a b c d 406s 1 0 1 0 406s a b c d 406s 1 0 1 0 406s a b c d 406s 1 NA NaN 0 406s a b c d 406s 1 NA NaN 0 406s a b c d 406s 1 NA NaN 0 406s numeric(0) 406s numeric(0) 406s numeric(0) 406s a b c d 406s 1 NA NA 0 406s a b c d 406s 1 NA NA 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 NA NaN 0 406s [1] 1 NA NaN 0 406s [1] 1 NA NaN 0 406s numeric(0) 406s numeric(0) 406s numeric(0) 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 NA NaN 0 406s [1] 1 NA NaN 0 406s [1] 1 NA NaN 0 406s numeric(0) 406s numeric(0) 406s numeric(0) 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 0 1 0 406s [1] 1 NA NaN 0 406s [1] 1 NA NaN 0 406s [1] 1 NA NaN 0 406s numeric(0) 406s numeric(0) 406s numeric(0) 406s [1] 1 NA NA 0 406s [1] 1 NA NA 0 406s > 406s > 406s > # Bug report 2012-06-25 406s > x <- matrix(c(1, 1, 1, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 406s > y0 <- rowProds_R(x) 406s > print(y0) 406s [1] 1 0 1 0 406s > y1 <- rowProds(x) 406s > print(y1) 406s [1] 1 0 1 0 406s > y2 <- colProds(t(x)) 406s > print(y2) 406s [1] 1 0 1 0 406s > stopifnot(all.equal.na(y1, y0)) 406s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 406s > stopifnot(all.equal.na(y2, y1)) 406s > # Check names attribute 406s > dimnames(x) <- dimnames 406s > y0 <- rowProds_R(x, useNames = TRUE) 406s > print(y0) 406s a b c d 406s 1 0 1 0 406s > y1 <- rowProds(x, useNames = TRUE) 406s > print(y1) 406s a b c d 406s 1 0 1 0 406s > y2 <- colProds(t(x), useNames = TRUE) 406s > print(y2) 406s a b c d 406s 1 0 1 0 406s > stopifnot(all.equal.na(y1, y0)) 406s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 406s > stopifnot(all.equal.na(y2, y1)) 406s > 406s > # Bug report 2014-03-25 ("all rows contains a zero") 406s > x <- matrix(c(0, 1, 1, 0), nrow = 2, ncol = 2) 406s > # To check names attribute 406s > dimnames <- list(letters[1:2], LETTERS[1:2]) 406s > y0 <- rowProds_R(x) 406s > print(y0) 406s [1] 0 0 406s > y1 <- rowProds(x) 406s > print(y1) 406s [1] 0 0 406s > y2 <- colProds(t(x)) 406s > print(y2) 406s [1] 0 0 406s > stopifnot(all.equal.na(y1, y0)) 406s > stopifnot(all.equal.na(y1, c(0, 0))) 406s > stopifnot(all.equal.na(y2, y1)) 406s > # Check names attribute 406s > dimnames(x) <- dimnames 406s > y0 <- rowProds_R(x, useNames = TRUE) 406s > print(y0) 406s a b 406s 0 0 406s > y1 <- rowProds(x, useNames = TRUE) 406s > print(y1) 406s a b 406s 0 0 406s > y2 <- colProds(t(x), useNames = TRUE) 406s > print(y2) 406s a b 406s 0 0 406s > stopifnot(all.equal.na(y1, y0)) 406s > stopifnot(all.equal.na(y2, y1)) 406s > 406s 406s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 406s Copyright (C) 2025 The R Foundation for Statistical Computing 406s Platform: aarch64-unknown-linux-gnu 406s 406s R is free software and comes with ABSOLUTELY NO WARRANTY. 406s You are welcome to redistribute it under certain conditions. 406s Type 'license()' or 'licence()' for distribution details. 406s 406s R is a collaborative project with many contributors. 406s Type 'contributors()' for more information and 406s 'citation()' on how to cite R or R packages in publications. 406s 406s Type 'demo()' for some demos, 'help()' for on-line help, or 406s 'help.start()' for an HTML browser interface to help. 406s Type 'q()' to quit R. 406s 406s > library("matrixStats") 406s > 406s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = TRUE) { 406s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 406s + if (!useNames) names(res) <- NULL 406s + res 406s + } 406s > 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Subsetted tests 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > source("utils/validateIndicesFramework.R") 406s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 406s > storage.mode(x) <- "integer" 406s > 406s > # To check names attribute 406s > dimnames <- list(letters[1:6], LETTERS[1:6]) 406s > 406s > # Test with and without dimnames on x 406s > for (setDimnames in c(TRUE, FALSE)) { 406s + if (setDimnames) dimnames(x) <- dimnames 406s + else dimnames(x) <- NULL 406s + for (rows in index_cases) { 406s + for (cols in index_cases) { 406s + for (na.rm in c(TRUE, FALSE)) { 406s + for (useNames in c(TRUE, FALSE)) { 406s + validateIndicesTestMatrix(x, rows, cols, 406s + ftest = rowProds, fsure = rowProds_R, 406s + method = "expSumLog", 406s + FUN = product, na.rm = na.rm, useNames = useNames) 406s + validateIndicesTestMatrix(x, rows, cols, 406s + fcoltest = colProds, fsure = rowProds_R, 406s + method = "expSumLog", 406s + FUN = product, na.rm = na.rm, useNames = useNames) 406s + } 406s + } 406s + } 406s + } 406s + } 407s > 408s 408s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 408s Copyright (C) 2025 The R Foundation for Statistical Computing 408s Platform: aarch64-unknown-linux-gnu 408s 408s R is free software and comes with ABSOLUTELY NO WARRANTY. 408s You are welcome to redistribute it under certain conditions. 408s Type 'license()' or 'licence()' for distribution details. 408s 408s R is a collaborative project with many contributors. 408s Type 'contributors()' for more information and 408s 'citation()' on how to cite R or R packages in publications. 408s 408s Type 'demo()' for some demos, 'help()' for on-line help, or 408s 'help.start()' for an HTML browser interface to help. 408s Type 'q()' to quit R. 408s 408s > library("matrixStats") 408s > 408s > ## Create isFALSE() if running on an old version of R 408s > if (!exists("isFALSE", mode="function")) { 408s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 408s + } 408s > 408s > rowQuantiles_R <- function(x, probs = c(0, 0.25, 0.50, 0.75, 1), na.rm = FALSE, drop = TRUE, type = 7L, ..., useNames = TRUE) { 408s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 408s + if (!na.rm && any(is.na(x))) { 408s + na_value <- NA_real_ 408s + if (type != 7L) storage.mode(na_value) <- storage.mode(x) 408s + rep(na_value, times = length(probs)) 408s + } else { 408s + as.vector(quantile(x, probs = probs, na.rm = na.rm, type = type, names = FALSE, ...)) 408s + } 408s + }, probs = probs, na.rm = na.rm) 408s + 408s + if (!is.null(dim(q))) q <- t(q) 408s + else dim(q) <- c(nrow(x), length(probs)) 408s + 408s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 408s + rownames(q) <- rownames(x) 408s + if (isFALSE(useNames)) dimnames(q) <- NULL 408s + 408s + if (drop) q <- drop(q) 408s + q 408s + } 408s > 408s > 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > # Test with multiple quantiles 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > for (mode in c("logical", "integer", "double")) { 408s + cat("mode: ", mode, "\n", sep = "") 408s + x <- matrix(1:40 + 0.1, nrow = 8, ncol = 5) 408s + storage.mode(x) <- mode 408s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 408s + str(x) 408s + 408s + probs <- c(0, 0.5, 1) 408s + # Test with and without dimnames on x 408s + for (setDimnames in c(TRUE, FALSE)) { 408s + if (setDimnames) dimnames(x) <- dimnames 408s + else dimnames(x) <- NULL 408s + # Check names attribute 408s + for (useNames in c(TRUE, FALSE)) { 408s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 408s + print(q0) 408s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 408s + print(q1) 408s + stopifnot(all.equal(q1, q0)) 408s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 408s + stopifnot(all.equal(q2, q0)) 408s + } 408s + } 408s + } # for (mode ...) 408s mode: logical 408s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 408s 0% 50% 100% 408s a 1 1 1 408s b 1 1 1 408s c 1 1 1 408s d 1 1 1 408s e 1 1 1 408s f 1 1 1 408s g 1 1 1 408s h 1 1 1 408s 0% 50% 100% 408s a 1 1 1 408s b 1 1 1 408s c 1 1 1 408s d 1 1 1 408s e 1 1 1 408s f 1 1 1 408s g 1 1 1 408s h 1 1 1 408s [,1] [,2] [,3] 408s [1,] 1 1 1 408s [2,] 1 1 1 408s [3,] 1 1 1 408s [4,] 1 1 1 408s [5,] 1 1 1 408s [6,] 1 1 1 408s [7,] 1 1 1 408s [8,] 1 1 1 408s [,1] [,2] [,3] 408s [1,] 1 1 1 408s [2,] 1 1 1 408s [3,] 1 1 1 408s [4,] 1 1 1 408s [5,] 1 1 1 408s [6,] 1 1 1 408s [7,] 1 1 1 408s [8,] 1 1 1 408s 0% 50% 100% 408s [1,] 1 1 1 408s [2,] 1 1 1 408s [3,] 1 1 1 408s [4,] 1 1 1 408s [5,] 1 1 1 408s [6,] 1 1 1 408s [7,] 1 1 1 408s [8,] 1 1 1 408s 0% 50% 100% 408s [1,] 1 1 1 408s [2,] 1 1 1 408s [3,] 1 1 1 408s [4,] 1 1 1 408s [5,] 1 1 1 408s [6,] 1 1 1 408s [7,] 1 1 1 408s [8,] 1 1 1 408s [,1] [,2] [,3] 408s [1,] 1 1 1 408s [2,] 1 1 1 408s [3,] 1 1 1 408s [4,] 1 1 1 408s [5,] 1 1 1 408s [6,] 1 1 1 408s [7,] 1 1 1 408s [8,] 1 1 1 408s [,1] [,2] [,3] 408s [1,] 1 1 1 408s [2,] 1 1 1 408s [3,] 1 1 1 408s [4,] 1 1 1 408s [5,] 1 1 1 408s [6,] 1 1 1 408s [7,] 1 1 1 408s [8,] 1 1 1 408s mode: integer 408s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 408s 0% 50% 100% 408s a 1 17 33 408s b 2 18 34 408s c 3 19 35 408s d 4 20 36 408s e 5 21 37 408s f 6 22 38 408s g 7 23 39 408s h 8 24 40 408s 0% 50% 100% 408s a 1 17 33 408s b 2 18 34 408s c 3 19 35 408s d 4 20 36 408s e 5 21 37 408s f 6 22 38 408s g 7 23 39 408s h 8 24 40 408s [,1] [,2] [,3] 408s [1,] 1 17 33 408s [2,] 2 18 34 408s [3,] 3 19 35 408s [4,] 4 20 36 408s [5,] 5 21 37 408s [6,] 6 22 38 408s [7,] 7 23 39 408s [8,] 8 24 40 408s [,1] [,2] [,3] 408s [1,] 1 17 33 408s [2,] 2 18 34 408s [3,] 3 19 35 408s [4,] 4 20 36 408s [5,] 5 21 37 408s [6,] 6 22 38 408s [7,] 7 23 39 408s [8,] 8 24 40 408s 0% 50% 100% 408s [1,] 1 17 33 408s [2,] 2 18 34 408s [3,] 3 19 35 408s [4,] 4 20 36 408s [5,] 5 21 37 408s [6,] 6 22 38 408s [7,] 7 23 39 408s [8,] 8 24 40 408s 0% 50% 100% 408s [1,] 1 17 33 408s [2,] 2 18 34 408s [3,] 3 19 35 408s [4,] 4 20 36 408s [5,] 5 21 37 408s [6,] 6 22 38 408s [7,] 7 23 39 408s [8,] 8 24 40 408s [,1] [,2] [,3] 408s [1,] 1 17 33 408s [2,] 2 18 34 408s [3,] 3 19 35 408s [4,] 4 20 36 408s [5,] 5 21 37 408s [6,] 6 22 38 408s [7,] 7 23 39 408s [8,] 8 24 40 408s [,1] [,2] [,3] 408s [1,] 1 17 33 408s [2,] 2 18 34 408s [3,] 3 19 35 408s [4,] 4 20 36 408s [5,] 5 21 37 408s [6,] 6 22 38 408s [7,] 7 23 39 408s [8,] 8 24 40 408s mode: double 408s 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 ... 408s 0% 50% 100% 408s a 1.1 17.1 33.1 408s b 2.1 18.1 34.1 408s c 3.1 19.1 35.1 408s d 4.1 20.1 36.1 408s e 5.1 21.1 37.1 408s f 6.1 22.1 38.1 408s g 7.1 23.1 39.1 408s h 8.1 24.1 40.1 408s 0% 50% 100% 408s a 1.1 17.1 33.1 408s b 2.1 18.1 34.1 408s c 3.1 19.1 35.1 408s d 4.1 20.1 36.1 408s e 5.1 21.1 37.1 408s f 6.1 22.1 38.1 408s g 7.1 23.1 39.1 408s h 8.1 24.1 40.1 408s [,1] [,2] [,3] 408s [1,] 1.1 17.1 33.1 408s [2,] 2.1 18.1 34.1 408s [3,] 3.1 19.1 35.1 408s [4,] 4.1 20.1 36.1 408s [5,] 5.1 21.1 37.1 408s [6,] 6.1 22.1 38.1 408s [7,] 7.1 23.1 39.1 408s [8,] 8.1 24.1 40.1 408s [,1] [,2] [,3] 408s [1,] 1.1 17.1 33.1 408s [2,] 2.1 18.1 34.1 408s [3,] 3.1 19.1 35.1 408s [4,] 4.1 20.1 36.1 408s [5,] 5.1 21.1 37.1 408s [6,] 6.1 22.1 38.1 408s [7,] 7.1 23.1 39.1 408s [8,] 8.1 24.1 40.1 408s 0% 50% 100% 408s [1,] 1.1 17.1 33.1 408s [2,] 2.1 18.1 34.1 408s [3,] 3.1 19.1 35.1 408s [4,] 4.1 20.1 36.1 408s [5,] 5.1 21.1 37.1 408s [6,] 6.1 22.1 38.1 408s [7,] 7.1 23.1 39.1 408s [8,] 8.1 24.1 40.1 408s 0% 50% 100% 408s [1,] 1.1 17.1 33.1 408s [2,] 2.1 18.1 34.1 408s [3,] 3.1 19.1 35.1 408s [4,] 4.1 20.1 36.1 408s [5,] 5.1 21.1 37.1 408s [6,] 6.1 22.1 38.1 408s [7,] 7.1 23.1 39.1 408s [8,] 8.1 24.1 40.1 408s [,1] [,2] [,3] 408s [1,] 1.1 17.1 33.1 408s [2,] 2.1 18.1 34.1 408s [3,] 3.1 19.1 35.1 408s [4,] 4.1 20.1 36.1 408s [5,] 5.1 21.1 37.1 408s [6,] 6.1 22.1 38.1 408s [7,] 7.1 23.1 39.1 408s [8,] 8.1 24.1 40.1 408s [,1] [,2] [,3] 408s [1,] 1.1 17.1 33.1 408s [2,] 2.1 18.1 34.1 408s [3,] 3.1 19.1 35.1 408s [4,] 4.1 20.1 36.1 408s [5,] 5.1 21.1 37.1 408s [6,] 6.1 22.1 38.1 408s [7,] 7.1 23.1 39.1 408s [8,] 8.1 24.1 40.1 408s > 408s > 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > # Test with a single quantile 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > for (mode in c("logical", "integer", "double")) { 408s + cat("mode: ", mode, "\n", sep = "") 408s + x <- matrix(1:40, nrow = 8, ncol = 5) 408s + storage.mode(x) <- mode 408s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 408s + str(x) 408s + 408s + probs <- c(0.5) 408s + # Test with and without dimnames on x 408s + for (setDimnames in c(TRUE, FALSE)) { 408s + if (setDimnames) dimnames(x) <- dimnames 408s + else dimnames(x) <- NULL 408s + # Check names attribute 408s + for (useNames in c(TRUE, FALSE)) { 408s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 408s + print(q0) 408s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 408s + print(q1) 408s + stopifnot(all.equal(q1, q0)) 408s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 408s + stopifnot(all.equal(q2, q0)) 408s + } 408s + } 408s + } # for (mode ...) 408s mode: logical 408s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 408s a b c d e f g h 408s 1 1 1 1 1 1 1 1 408s a b c d e f g h 408s 1 1 1 1 1 1 1 1 408s [1] 1 1 1 1 1 1 1 1 408s [1] 1 1 1 1 1 1 1 1 408s [1] 1 1 1 1 1 1 1 1 408s [1] 1 1 1 1 1 1 1 1 408s [1] 1 1 1 1 1 1 1 1 408s [1] 1 1 1 1 1 1 1 1 408s mode: integer 408s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 408s a b c d e f g h 408s 17 18 19 20 21 22 23 24 408s a b c d e f g h 408s 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s mode: double 408s num [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 408s a b c d e f g h 408s 17 18 19 20 21 22 23 24 408s a b c d e f g h 408s 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s [1] 17 18 19 20 21 22 23 24 408s > 408s > 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > # Consistency checks 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > set.seed(1) 408s > 408s > probs <- seq(from = 0, to = 1, by = 0.25) 408s > 408s > cat("Consistency checks:\n") 408s Consistency checks: 408s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 6L else 24L 408s > for (kk in seq_len(n_sims)) { 408s + cat("Random test #", kk, "\n", sep = "") 408s + 408s + # Simulate data in a matrix of any shape 408s + dim <- sample(20:60, size = 2L) 408s + n <- prod(dim) 408s + x <- rnorm(n, sd = 100) 408s + dim(x) <- dim 408s + dimnames <- lapply(dim(x), FUN = function(n) rep(letters, length.out = n)) 408s + 408s + # Add NAs? 408s + has_na <- ((kk %% 2) == 0L) 408s + if (has_na) { 408s + cat("Adding NAs\n") 408s + nna <- sample(n, size = 1) 408s + na_values <- c(NA_real_, NaN) 408s + t <- sample(na_values, size = nna, replace = TRUE) 408s + x[sample(length(x), size = nna)] <- t 408s + } 408s + 408s + # Logical, integer, or double? 408s + mode <- "numeric" 408s + if ((kk %% 6) %in% 1:2) { 408s + cat("Coercing to logical\n") 408s + mode <- "logical" 408s + } else if ((kk %% 6) %in% 3:4) { 408s + cat("Coercing to integers\n") 408s + mode <- "integer" 408s + } 408s + storage.mode(x) <- mode 408s + 408s + str(x) 408s + 408s + # rowQuantiles(): 408s + for (type in 1:9) { 408s + cat(sprintf("type=%d, has_na=%s:\n", type, has_na)) 408s + # Test with and without dimnames on x 408s + for (setDimnames in c(TRUE, FALSE)) { 408s + if (setDimnames) dimnames(x) <- dimnames 408s + else dimnames(x) <- NULL 408s + # Check names attribute 408s + for (useNames in c(TRUE, FALSE)) { 408s + q0 <- rowQuantiles_R(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 408s + q1 <- rowQuantiles(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 408s + stopifnot(all.equal(q1, q0)) 408s + q2 <- colQuantiles(t(x), probs = probs, na.rm = has_na, type = type, useNames = useNames) 408s + stopifnot(all.equal(q2, q0)) 408s + } 408s + } 408s + } 408s + } # for (kk ...) 408s Random test #1 408s Coercing to logical 408s logi [1:23, 1:58] TRUE TRUE TRUE TRUE TRUE TRUE ... 408s type=1, has_na=FALSE: 408s type=2, has_na=FALSE: 408s type=3, has_na=FALSE: 408s type=4, has_na=FALSE: 408s type=5, has_na=FALSE: 408s type=6, has_na=FALSE: 408s type=7, has_na=FALSE: 408s type=8, has_na=FALSE: 408s type=9, has_na=FALSE: 408s Random test #2 408s Adding NAs 408s Coercing to logical 408s logi [1:58, 1:33] TRUE TRUE TRUE TRUE TRUE NA ... 408s type=1, has_na=TRUE: 408s type=2, has_na=TRUE: 408s type=3, has_na=TRUE: 408s type=4, has_na=TRUE: 408s type=5, has_na=TRUE: 408s type=6, has_na=TRUE: 408s type=7, has_na=TRUE: 409s type=8, has_na=TRUE: 409s type=9, has_na=TRUE: 409s Random test #3 409s Coercing to integers 409s int [1:28, 1:60] 119 -164 115 -129 209 -175 2 -32 120 -28 ... 409s type=1, has_na=FALSE: 409s type=2, has_na=FALSE: 409s type=3, has_na=FALSE: 409s type=4, has_na=FALSE: 409s type=5, has_na=FALSE: 409s type=6, has_na=FALSE: 409s type=7, has_na=FALSE: 409s type=8, has_na=FALSE: 409s type=9, has_na=FALSE: 409s Random test #4 409s Adding NAs 409s Coercing to integers 409s int [1:54, 1:35] 147 11 116 -50 NA -69 132 NA 114 NA ... 409s type=1, has_na=TRUE: 409s type=2, has_na=TRUE: 409s type=3, has_na=TRUE: 409s type=4, has_na=TRUE: 409s type=5, has_na=TRUE: 409s type=6, has_na=TRUE: 409s type=7, has_na=TRUE: 409s type=8, has_na=TRUE: 410s type=9, has_na=TRUE: 410s Random test #5 410s num [1:39, 1:53] 5.94 -27.16 -30.78 173 126.05 ... 410s type=1, has_na=FALSE: 410s type=2, has_na=FALSE: 410s type=3, has_na=FALSE: 410s type=4, has_na=FALSE: 410s type=5, has_na=FALSE: 410s type=6, has_na=FALSE: 410s type=7, has_na=FALSE: 410s type=8, has_na=FALSE: 410s type=9, has_na=FALSE: 410s Random test #6 410s Adding NAs 410s num [1:46, 1:22] 197 -107 15 148 -110 ... 410s type=1, has_na=TRUE: 410s type=2, has_na=TRUE: 410s type=3, has_na=TRUE: 410s type=4, has_na=TRUE: 410s type=5, has_na=TRUE: 410s type=6, has_na=TRUE: 410s type=7, has_na=TRUE: 410s type=8, has_na=TRUE: 410s type=9, has_na=TRUE: 410s Random test #7 410s Coercing to logical 410s logi [1:21, 1:51] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s type=1, has_na=FALSE: 410s type=2, has_na=FALSE: 411s type=3, has_na=FALSE: 411s type=4, has_na=FALSE: 411s type=5, has_na=FALSE: 411s type=6, has_na=FALSE: 411s type=7, has_na=FALSE: 411s type=8, has_na=FALSE: 411s type=9, has_na=FALSE: 411s Random test #8 411s Adding NAs 411s Coercing to logical 411s logi [1:33, 1:53] NA NA TRUE TRUE TRUE TRUE ... 411s type=1, has_na=TRUE: 411s type=2, has_na=TRUE: 411s type=3, has_na=TRUE: 411s type=4, has_na=TRUE: 411s type=5, has_na=TRUE: 411s type=6, has_na=TRUE: 411s type=7, has_na=TRUE: 411s type=8, has_na=TRUE: 411s type=9, has_na=TRUE: 411s Random test #9 411s Coercing to integers 411s int [1:53, 1:24] -73 10 -73 -5 44 -107 -100 95 58 -50 ... 411s type=1, has_na=FALSE: 411s type=2, has_na=FALSE: 411s type=3, has_na=FALSE: 411s type=4, has_na=FALSE: 411s type=5, has_na=FALSE: 411s type=6, has_na=FALSE: 411s type=7, has_na=FALSE: 411s type=8, has_na=FALSE: 412s type=9, has_na=FALSE: 412s Random test #10 412s Adding NAs 412s Coercing to integers 412s int [1:44, 1:20] NA -140 NA -57 -252 NA NA 20 NA NA ... 412s type=1, has_na=TRUE: 412s type=2, has_na=TRUE: 412s type=3, has_na=TRUE: 412s type=4, has_na=TRUE: 412s type=5, has_na=TRUE: 412s type=6, has_na=TRUE: 412s type=7, has_na=TRUE: 412s type=8, has_na=TRUE: 412s type=9, has_na=TRUE: 412s Random test #11 412s num [1:54, 1:23] -160.87 74.13 196.08 7.27 4.92 ... 412s type=1, has_na=FALSE: 412s type=2, has_na=FALSE: 412s type=3, has_na=FALSE: 412s type=4, has_na=FALSE: 412s type=5, has_na=FALSE: 412s type=6, has_na=FALSE: 412s type=7, has_na=FALSE: 412s type=8, has_na=FALSE: 412s type=9, has_na=FALSE: 413s Random test #12 413s Adding NAs 413s num [1:59, 1:27] -139.2 -86.3 NA -40.7 NA ... 413s type=1, has_na=TRUE: 413s type=2, has_na=TRUE: 413s type=3, has_na=TRUE: 413s type=4, has_na=TRUE: 413s type=5, has_na=TRUE: 413s type=6, has_na=TRUE: 413s type=7, has_na=TRUE: 413s type=8, has_na=TRUE: 413s type=9, has_na=TRUE: 413s Random test #13 413s Coercing to logical 413s logi [1:53, 1:60] TRUE TRUE TRUE TRUE TRUE TRUE ... 413s type=1, has_na=FALSE: 413s type=2, has_na=FALSE: 413s type=3, has_na=FALSE: 413s type=4, has_na=FALSE: 413s type=5, has_na=FALSE: 413s type=6, has_na=FALSE: 414s type=7, has_na=FALSE: 414s type=8, has_na=FALSE: 414s type=9, has_na=FALSE: 414s Random test #14 414s Adding NAs 414s Coercing to logical 414s logi [1:22, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 414s type=1, has_na=TRUE: 414s type=2, has_na=TRUE: 414s type=3, has_na=TRUE: 414s type=4, has_na=TRUE: 414s type=5, has_na=TRUE: 414s type=6, has_na=TRUE: 414s type=7, has_na=TRUE: 414s type=8, has_na=TRUE: 414s type=9, has_na=TRUE: 414s Random test #15 414s Coercing to integers 414s int [1:20, 1:34] 78 -41 183 190 -71 37 0 -4 -86 27 ... 414s type=1, has_na=FALSE: 414s type=2, has_na=FALSE: 414s type=3, has_na=FALSE: 414s type=4, has_na=FALSE: 414s type=5, has_na=FALSE: 414s type=6, has_na=FALSE: 414s type=7, has_na=FALSE: 414s type=8, has_na=FALSE: 414s type=9, has_na=FALSE: 414s Random test #16 414s Adding NAs 414s Coercing to integers 414s int [1:42, 1:37] NA 12 -15 41 -28 17 NA -74 NA NA ... 414s type=1, has_na=TRUE: 414s type=2, has_na=TRUE: 414s type=3, has_na=TRUE: 414s type=4, has_na=TRUE: 414s type=5, has_na=TRUE: 414s type=6, has_na=TRUE: 414s type=7, has_na=TRUE: 414s type=8, has_na=TRUE: 415s type=9, has_na=TRUE: 415s Random test #17 415s num [1:42, 1:29] -50.51 -6.51 -117.59 135.58 226.87 ... 415s type=1, has_na=FALSE: 415s type=2, has_na=FALSE: 415s type=3, has_na=FALSE: 415s type=4, has_na=FALSE: 415s type=5, has_na=FALSE: 415s type=6, has_na=FALSE: 415s type=7, has_na=FALSE: 415s type=8, has_na=FALSE: 415s type=9, has_na=FALSE: 415s Random test #18 415s Adding NAs 415s num [1:57, 1:39] 223 156.8 -44.6 -127.5 -147.7 ... 415s type=1, has_na=TRUE: 415s type=2, has_na=TRUE: 415s type=3, has_na=TRUE: 415s type=4, has_na=TRUE: 415s type=5, has_na=TRUE: 415s type=6, has_na=TRUE: 415s type=7, has_na=TRUE: 415s type=8, has_na=TRUE: 415s type=9, has_na=TRUE: 416s Random test #19 416s Coercing to logical 416s logi [1:52, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 416s type=1, has_na=FALSE: 416s type=2, has_na=FALSE: 416s type=3, has_na=FALSE: 416s type=4, has_na=FALSE: 416s type=5, has_na=FALSE: 416s type=6, has_na=FALSE: 416s type=7, has_na=FALSE: 416s type=8, has_na=FALSE: 416s type=9, has_na=FALSE: 416s Random test #20 416s Adding NAs 416s Coercing to logical 416s logi [1:25, 1:48] NA TRUE NA NA NA NA ... 416s type=1, has_na=TRUE: 416s type=2, has_na=TRUE: 416s type=3, has_na=TRUE: 416s type=4, has_na=TRUE: 416s type=5, has_na=TRUE: 416s type=6, has_na=TRUE: 416s type=7, has_na=TRUE: 416s type=8, has_na=TRUE: 416s type=9, has_na=TRUE: 416s Random test #21 416s Coercing to integers 416s int [1:53, 1:27] 3 -30 203 -49 19 -45 -138 28 46 -44 ... 416s type=1, has_na=FALSE: 416s type=2, has_na=FALSE: 416s type=3, has_na=FALSE: 416s type=4, has_na=FALSE: 417s type=5, has_na=FALSE: 417s type=6, has_na=FALSE: 417s type=7, has_na=FALSE: 417s type=8, has_na=FALSE: 417s type=9, has_na=FALSE: 417s Random test #22 417s Adding NAs 417s Coercing to integers 417s int [1:48, 1:36] -131 NA NA -201 45 -17 NA 57 NA NA ... 417s type=1, has_na=TRUE: 417s type=2, has_na=TRUE: 417s type=3, has_na=TRUE: 417s type=4, has_na=TRUE: 417s type=5, has_na=TRUE: 417s type=6, has_na=TRUE: 417s type=7, has_na=TRUE: 417s type=8, has_na=TRUE: 417s type=9, has_na=TRUE: 417s Random test #23 417s num [1:23, 1:43] -99.2 -68.8 -86.7 -104.2 48 ... 417s type=1, has_na=FALSE: 417s type=2, has_na=FALSE: 417s type=3, has_na=FALSE: 417s type=4, has_na=FALSE: 417s type=5, has_na=FALSE: 417s type=6, has_na=FALSE: 418s type=7, has_na=FALSE: 418s type=8, has_na=FALSE: 418s type=9, has_na=FALSE: 418s Random test #24 418s Adding NAs 418s num [1:53, 1:29] NaN -67.6 10.8 -88.4 130.1 ... 418s type=1, has_na=TRUE: 418s type=2, has_na=TRUE: 418s type=3, has_na=TRUE: 418s type=4, has_na=TRUE: 418s type=5, has_na=TRUE: 418s type=6, has_na=TRUE: 418s type=7, has_na=TRUE: 418s type=8, has_na=TRUE: 418s type=9, has_na=TRUE: 418s > 418s > 418s > 418s > for (mode in c("logical", "integer", "double")) { 418s + naValue <- NA_real_ 418s + storage.mode(naValue) <- mode 418s + 418s + someValue <- 1 418s + storage.mode(someValue) <- mode 418s + 418s + for (type in 1:9) { 418s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 418s + # All NA 418s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 418s + x <- matrix(naValue, nrow = 3L, ncol = 4L) 418s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 418s + # Test with and without dimnames on x 418s + for (setDimnames in c(TRUE, FALSE)) { 418s + if (setDimnames) dimnames(x) <- dimnames 418s + else dimnames(x) <- NULL 418s + # Check names attribute 418s + for (useNames in c(TRUE, FALSE)) { 418s + qr0 <- rowQuantiles_R(x, type = type, useNames = useNames) 418s + 418s + qr <- rowQuantiles(x, type = type, useNames = useNames) 418s + stopifnot(identical(qr, qr0)) 418s + 418s + # x <- matrix(naValue, nrow = 4L, ncol = 3L) 418s + qc <- colQuantiles(t(x), type = type, useNames = useNames) 418s + 418s + stopifnot(identical(qc, qr)) 418s + } 418s + } 418s + 418s + 418s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 418s + # Empty matrices 418s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 418s + probs <- c(0, 0.25, 0.75, 1) 418s + x <- matrix(naValue, nrow = 0L, ncol = 0L) 418s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 418s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 418s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 418s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 418s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 418s + 418s + x <- matrix(naValue, nrow = 2L, ncol = 0L) 418s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 418s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 418s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 418s + 418s + x <- matrix(naValue, nrow = 0L, ncol = 2L) 418s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 418s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 418s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 418s + 418s + 418s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 418s + # Single column matrices 418s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 418s + probs <- c(0, 0.25, 0.75, 1) 418s + x <- matrix(someValue, nrow = 2L, ncol = 1L) 418s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 418s + qr <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 418s + print(qr) 418s + 418s + x <- matrix(someValue, nrow = 1L, ncol = 2L) 418s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 418s + qc <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 418s + print(qc) 418s + 418s + stopifnot(identical(qc, qr)) 418s + } 418s + } 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s 0% 25% 75% 100% 418s a 1 1 1 1 418s b 1 1 1 1 418s > 418s 418s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 418s Copyright (C) 2025 The R Foundation for Statistical Computing 418s Platform: aarch64-unknown-linux-gnu 418s 418s R is free software and comes with ABSOLUTELY NO WARRANTY. 418s You are welcome to redistribute it under certain conditions. 418s Type 'license()' or 'licence()' for distribution details. 418s 418s R is a collaborative project with many contributors. 418s Type 'contributors()' for more information and 418s 'citation()' on how to cite R or R packages in publications. 418s 418s Type 'demo()' for some demos, 'help()' for on-line help, or 418s 'help.start()' for an HTML browser interface to help. 418s Type 'q()' to quit R. 418s 418s > library("matrixStats") 418s > 418s > ## Create isFALSE() if running on an old version of R 418s > if (!exists("isFALSE", mode="function")) { 418s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 418s + } 418s > 418s > rowQuantiles_R <- function(x, probs, na.rm = FALSE, drop = TRUE, ..., useNames = TRUE) { 418s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 418s + if (!na.rm && any(is.na(x))) { 418s + na_value <- NA_real_ 418s + storage.mode(na_value) <- storage.mode(x) 418s + rep(na_value, times = length(probs)) 418s + 418s + } else { 418s + as.vector(quantile(x, probs = probs, na.rm = na.rm, names = FALSE, ...)) 418s + } 418s + }, probs = probs, na.rm = na.rm) 418s + 418s + if (!is.null(dim(q))) q <- t(q) 418s + else dim(q) <- c(nrow(x), length(probs)) 418s + 418s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 418s + rownames(q) <- rownames(x) 418s + if (isFALSE(useNames)) dimnames(q) <- NULL 418s + 418s + if (drop) q <- drop(q) 418s + q 418s + } 418s > 418s > 418s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 418s > # Subsetted tests 418s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 418s > source("utils/validateIndicesFramework.R") 418s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 418s > dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 418s > probs <- c(0, 0.25, 0.75, 1) 418s > # Test with and without dimnames on x 418s > for (setDimnames in c(TRUE, FALSE)) { 418s + if (setDimnames) dimnames(x) <- dimnames 418s + else dimnames(x) <- NULL 418s + 418s + count <- 0L 418s + for (rows in index_cases) { 418s + for (cols in index_cases) { 418s + count <- count + 1L 418s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 418s + useNames <- c(TRUE, FALSE) 418s + useNames <- useNames[count %% length(useNames) + 1] 418s + 418s + validateIndicesTestMatrix(x, rows, cols, 418s + ftest = rowQuantiles, fsure = rowQuantiles_R, 418s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 418s + validateIndicesTestMatrix(x, rows, cols, 418s + fcoltest = colQuantiles, fsure = rowQuantiles_R, 418s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 418s + } 418s + } 418s + } 420s > 420s > 420s 420s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 420s Copyright (C) 2025 The R Foundation for Statistical Computing 420s Platform: aarch64-unknown-linux-gnu 420s 420s R is free software and comes with ABSOLUTELY NO WARRANTY. 420s You are welcome to redistribute it under certain conditions. 420s Type 'license()' or 'licence()' for distribution details. 420s 420s R is a collaborative project with many contributors. 420s Type 'contributors()' for more information and 420s 'citation()' on how to cite R or R packages in publications. 420s 420s Type 'demo()' for some demos, 'help()' for on-line help, or 420s 'help.start()' for an HTML browser interface to help. 420s Type 'q()' to quit R. 420s 420s > library("matrixStats") 420s > 420s > rowMins_R <- function(x, ..., useNames = TRUE) { 420s + suppressWarnings({ 420s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 420s + }) 420s + if (!useNames) names(res) <- NULL 420s + res 420s + } # rowMins_R() 420s > 420s > rowMaxs_R <- function(x, ..., useNames = TRUE) { 420s + suppressWarnings({ 420s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 420s + }) 420s + if (!useNames) names(res) <- NULL 420s + res 420s + } # rowMaxs_R() 420s > 420s > rowRanges_R <- function(x, ..., useNames = TRUE) { 420s + suppressWarnings({ 420s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 420s + }) 420s + 420s + # Preserve rownames attribute 420s + dim <- c(dim(x)[1], 2L) 420s + if (!isTRUE(all.equal(dim(ans), dim))) { 420s + dim(ans) <- dim 420s + rownames <- rownames(x) 420s + if (!is.null(dimnames)) rownames(ans) <- rownames 420s + } 420s + if (!useNames) dimnames(ans) <- NULL 420s + ans 420s + } # rowRanges_R() 420s > 420s > 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > # With and without some NAs 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > for (mode in c("integer", "double")) { 420s + cat("mode: ", mode, "\n", sep = "") 420s + 420s + for (add_na in c(FALSE, TRUE)) { 420s + cat("add_na = ", add_na, "\n", sep = "") 420s + 420s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 420s + if (add_na) { 420s + x[3:7, c(2, 4)] <- NA_real_ 420s + } 420s + storage.mode(x) <- mode 420s + str(x) 420s + 420s + # To check names attribute 420s + dimnames <- list(letters[1:10], LETTERS[1:5]) 420s + 420s + # Test with and without dimnames on x 420s + for (setDimnames in c(TRUE, FALSE)) { 420s + if (setDimnames) dimnames(x) <- dimnames 420s + else dimnames(x) <- NULL 420s + # Row/column extremes 420s + for (na.rm in c(FALSE, TRUE)) { 420s + # Check names attribute 420s + for (useNames in c(TRUE, FALSE)) { 420s + cat("na.rm = ", na.rm, "\n", sep = "") 420s + 420s + # Ranges 420s + cat("range:\n") 420s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 420s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 420s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + 420s + # Min 420s + cat("min:\n") 420s + m0 <- rowMins_R(x, na.rm = na.rm, useNames = useNames) 420s + m1 <- rowMins(x, na.rm = na.rm, useNames = useNames) 420s + m2 <- colMins(t(x), na.rm = na.rm, useNames = useNames) 420s + stopifnot(all.equal(m1, m2)) 420s + stopifnot(all.equal(m1, m0)) 420s + 420s + # Max 420s + cat("max:\n") 420s + m0 <- rowMaxs_R(x, na.rm = na.rm, useNames = useNames) 420s + m1 <- rowMaxs(x, na.rm = na.rm, useNames = useNames) 420s + m2 <- colMaxs(t(x), na.rm = na.rm, useNames = useNames) 420s + stopifnot(all.equal(m1, m2)) 420s + stopifnot(all.equal(m1, m0)) 420s + } 420s + } 420s + } 420s + } # for (add_na ...) 420s + } # for (mode ...) 420s mode: integer 420s add_na = FALSE 420s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s add_na = TRUE 420s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s mode: double 420s add_na = FALSE 420s 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 ... 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s add_na = TRUE 420s 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 ... 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = FALSE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s na.rm = TRUE 420s range: 420s min: 420s max: 420s > 420s > 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > # All NAs 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > for (mode in c("integer", "double")) { 420s + cat("mode: ", mode, "\n", sep = "") 420s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 420s + storage.mode(x) <- mode 420s + str(x) 420s + 420s + # Test with and without dimnames on x 420s + for (setDimnames in c(TRUE, FALSE)) { 420s + if (setDimnames) dimnames(x) <- dimnames 420s + else dimnames(x) <- NULL 420s + for (na.rm in c(FALSE, TRUE)) { 420s + # Check names attribute 420s + for (useNames in c(TRUE, FALSE)) { 420s + cat("na.rm = ", na.rm, "\n", sep = "") 420s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 420s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 420s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + } 420s + } 420s + } 420s + } # for (mode ...) 420s mode: integer 420s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 420s na.rm = FALSE 420s na.rm = FALSE 420s na.rm = TRUE 420s na.rm = TRUE 420s na.rm = FALSE 420s na.rm = FALSE 420s na.rm = TRUE 420s na.rm = TRUE 420s mode: double 420s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 420s na.rm = FALSE 420s na.rm = FALSE 420s na.rm = TRUE 420s na.rm = TRUE 420s na.rm = FALSE 420s na.rm = FALSE 420s na.rm = TRUE 420s na.rm = TRUE 420s > 420s > 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > # Special cases 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > # Nx0 matrix 420s > x <- matrix(double(0L), nrow = 5L, ncol = 0L) 420s > r0 <- rowRanges_R(x) 420s > #r1 <- rowRanges(x) 420s > #r_truth <- matrix(c(Inf, -Inf), nrow = nrow(x), ncol = 2L, byrow = TRUE) 420s > #stopifnot(all.equal(r1, r_truth)) 420s > 420s > # 0xN matrix 420s > x <- t(x) 420s > #r1 <- colRanges(x) 420s > #stopifnot(all.equal(r1, r_truth)) 420s > 420s > # Nx1 matrix 420s > x <- matrix(1:5, nrow = 5L, ncol = 1L) 420s > # To check names attribute 420s > dimnames <- list(letters[1:5], "A") 420s > r1 <- rowRanges(x) 420s > r_truth <- matrix(1:5, nrow = nrow(x), ncol = 2L, byrow = FALSE) 420s > stopifnot(all.equal(r1, r_truth)) 420s > # Check names attribute 420s > dimnames(x) <- dimnames 420s > r0 <- rowRanges_R(x, useNames = TRUE) 420s > r1 <- rowRanges(x, useNames = TRUE) 420s > stopifnot(all.equal(r1, r0)) 420s > dimnames(x) <- NULL 420s > 420s > # 1xN matrix 420s > x <- t(x) 420s > r1 <- colRanges(x) 420s > stopifnot(all.equal(r1, r_truth)) 420s > # Check names attribute 420s > dimnames(x) <- list("a", LETTERS[1:5]) 420s > r1 <- colRanges(x, useNames = TRUE) 420s > stopifnot(identical(rownames(r1), colnames(x))) 420s > 420s > 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > # Additional tests with NA_integer_, NA_real, NaN, -Inf, +Inf 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > x <- matrix(1:12, nrow = 4L, ncol = 3L) 420s > 420s > na_list <- list( 420s + "integer" = matrix(1:12, nrow = 4L, ncol = 3L), 420s + "integer w/ NA" = matrix(NA_integer_, nrow = 4L, ncol = 3L), 420s + "real" = matrix(as.double(1:12), nrow = 4L, ncol = 3L), 420s + "real w/ NA" = matrix(NA_real_, nrow = 4L, ncol = 3L) 420s + ) 420s > 420s > na <- na_list[["real"]] 420s > na[2, 2] <- NA 420s > na_list[["real + NA cell"]] <- na 420s > 420s > na <- na_list[["real"]] 420s > na[2, ] <- NA 420s > na_list[["real + NA row"]] <- na 420s > 420s > na <- na_list[["real"]] 420s > na[2, ] <- NaN 420s > na_list[["real + NaN row"]] <- na 420s > 420s > na <- na_list[["real"]] 420s > na[2, 2] <- Inf 420s > na_list[["real + Inf cell"]] <- na 420s > 420s > na <- na_list[["real"]] 420s > na[2, ] <- Inf 420s > na_list[["real + Inf row"]] <- na 420s > 420s > na <- na_list[["real"]] 420s > na[2, 2] <- NaN 420s > na_list[["real + NaN cell"]] <- na 420s > 420s > na <- na_list[["real w/ NA"]] 420s > na[2, 2] <- NaN 420s > na_list[["real w/ NA + NaN cell"]] <- na 420s > 420s > na <- na_list[["real w/ NA"]] 420s > na[2, ] <- NaN 420s > na_list[["real w/ NA + NaN row"]] <- na 420s > 420s > # To check names attribute 420s > dimnames <- list(letters[1:4], LETTERS[1:3]) 420s > 420s > # Test with and without dimnames on x 420s > for (setDimnames in c(TRUE, FALSE)) { 420s + if (setDimnames) dimnames(x) <- dimnames 420s + else dimnames(x) <- NULL 420s + for (na.rm in c(FALSE, TRUE)) { 420s + for (name in names(na_list)) { 420s + # Check names attribute 420s + for (useNames in c(TRUE, FALSE)) { 420s + na <- na_list[[name]] 420s + cat(sprintf("%s (%s) w/ na.rm = %s:\n", name, typeof(na), na.rm)) 420s + print(na) 420s + 420s + cat(" min:\n") 420s + y0 <- rowMins_R(na, na.rm = na.rm, useNames = useNames) 420s + str(y0) 420s + y1 <- rowMins(na, na.rm = na.rm, useNames = useNames) 420s + str(y1) 420s + stopifnot(all.equal(y1, y0)) 420s + y1c <- colMins(t(na), na.rm = na.rm, useNames = useNames) 420s + str(y1c) 420s + stopifnot(all.equal(y1c, y1)) 420s + 420s + cat(" max:\n") 420s + y0 <- rowMaxs_R(na, na.rm = na.rm, useNames = useNames) 420s + str(y0) 420s + y1 <- rowMaxs(na, na.rm = na.rm, useNames = useNames) 420s + str(y1) 420s + stopifnot(all.equal(y1, y0)) 420s + y1c <- colMaxs(t(na), na.rm = na.rm, useNames = useNames) 420s + str(y1c) 420s + stopifnot(all.equal(y1c, y1)) 420s + 420s + cat(" range:\n") 420s + y0 <- rowRanges_R(na, na.rm = na.rm, useNames = useNames) 420s + str(y0) 420s + y1 <- rowRanges(na, na.rm = na.rm, useNames = useNames) 420s + str(y1) 420s + stopifnot(all.equal(y1, y0)) 420s + y1c <- colRanges(t(na), na.rm = na.rm, useNames = useNames) 420s + str(y1c) 420s + stopifnot(all.equal(y1c, y1)) 420s + } 420s + } # for (name ...) 420s + } # for (na.rm ...) 420s + } 420s integer (integer) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s max: 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s range: 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s integer (integer) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s max: 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s range: 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s integer w/ NA (integer) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s max: 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s range: 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s integer w/ NA (integer) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s max: 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s range: 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s real (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real w/ NA (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s max: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s range: 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s real w/ NA (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s max: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s range: 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s real + NA cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NA 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s max: 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s range: 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s real + NA cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NA 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s max: 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s range: 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s real + NA row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NA NA NA 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s max: 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s range: 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s real + NA row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NA NA NA 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s max: 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s range: 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s real + NaN row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NaN NaN NaN 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s max: 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s range: 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s real + NaN row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NaN NaN NaN 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s max: 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s range: 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s real + Inf cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 Inf 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s real + Inf cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 Inf 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s real + Inf row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] Inf Inf Inf 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + Inf row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] Inf Inf Inf 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + NaN cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NaN 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s max: 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s range: 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s real + NaN cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NaN 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s max: 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s range: 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NaN NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s max: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s range: 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NaN NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s max: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s range: 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s real w/ NA + NaN row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NaN NaN NaN 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s max: 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s range: 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s real w/ NA + NaN row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NaN NaN NaN 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s max: 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s range: 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s integer (integer) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s max: 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s range: 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s integer (integer) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s max: 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s range: 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s integer w/ NA (integer) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s integer w/ NA (integer) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s real (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real w/ NA (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s real w/ NA (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s real + NA cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NA 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real + NA cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NA 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real + NA row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NA NA NA 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + NA row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NA NA NA 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + NaN row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NaN NaN NaN 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + NaN row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NaN NaN NaN 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + Inf cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 Inf 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s real + Inf cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 Inf 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s real + Inf row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] Inf Inf Inf 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + Inf row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] Inf Inf Inf 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + NaN cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NaN 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real + NaN cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NaN 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NaN NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NaN NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s real w/ NA + NaN row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NaN NaN NaN 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s real w/ NA + NaN row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NaN NaN NaN 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s integer (integer) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s max: 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s range: 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s integer (integer) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s max: 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s range: 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s integer w/ NA (integer) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s max: 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s range: 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s integer w/ NA (integer) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s max: 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s int [1:4] NA NA NA NA 420s range: 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s int [1:4, 1:2] NA NA NA NA NA NA NA NA 420s real (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real w/ NA (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s max: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s range: 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s real w/ NA (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s max: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s range: 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s real + NA cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NA 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s max: 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s range: 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s real + NA cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NA 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s max: 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s range: 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s real + NA row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NA NA NA 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s max: 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s range: 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s real + NA row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NA NA NA 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s num [1:4] 1 NA 3 4 420s max: 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s num [1:4] 9 NA 11 12 420s range: 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 420s real + NaN row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NaN NaN NaN 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s max: 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s range: 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s real + NaN row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NaN NaN NaN 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s max: 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s range: 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s real + Inf cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 Inf 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s real + Inf cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 Inf 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s real + Inf row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] Inf Inf Inf 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + Inf row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] Inf Inf Inf 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + NaN cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NaN 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s max: 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s range: 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s real + NaN cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NaN 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s num [1:4] 1 NaN 3 4 420s max: 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s num [1:4] 9 NaN 11 12 420s range: 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 420s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NaN NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s max: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s range: 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NaN NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s max: 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s num [1:4] NA NA NA NA 420s range: 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s num [1:4, 1:2] NA NA NA NA NA NA NA NA 420s real w/ NA + NaN row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NaN NaN NaN 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s max: 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s range: 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s real w/ NA + NaN row (double) w/ na.rm = FALSE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NaN NaN NaN 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s max: 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s num [1:4] NA NaN NA NA 420s range: 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 420s integer (integer) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s max: 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s range: 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s integer (integer) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s int [1:4] 1 2 3 4 420s max: 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s int [1:4] 9 10 11 12 420s range: 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s int [1:4, 1:2] 1 2 3 4 9 10 11 12 420s integer w/ NA (integer) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s integer w/ NA (integer) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s real (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 6 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real w/ NA (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s real w/ NA (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] NA NA NA 420s [2,] NA NA NA 420s [3,] NA NA NA 420s [4,] NA NA NA 420s min: 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s num [1:4] Inf Inf Inf Inf 420s max: 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s num [1:4] -Inf -Inf -Inf -Inf 420s range: 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 420s real + NA cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NA 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real + NA cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 NA 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s num [1:4] 9 10 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s num [1:4, 1:2] 1 2 3 4 9 10 11 12 420s real + NA row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NA NA NA 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + NA row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NA NA NA 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + NaN row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NaN NaN NaN 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + NaN row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] NaN NaN NaN 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s num [1:4] 9 -Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + Inf cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 Inf 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s real + Inf cell (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] 2 Inf 10 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s num [1:4] 1 2 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s num [1:4, 1:2] 1 2 3 4 9 ... 420s real + Inf row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] Inf Inf Inf 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s num [1:4] 9 Inf 11 12 420s range: 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s num [1:4, 1:2] 1 Inf 3 4 9 ... 420s real + Inf row (double) w/ na.rm = TRUE: 420s [,1] [,2] [,3] 420s [1,] 1 5 9 420s [2,] Inf Inf Inf 420s [3,] 3 7 11 420s [4,] 4 8 12 420s min: 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s num [1:4] 1 Inf 3 4 420s max: 421s num [1:4] 9 Inf 11 12 421s num [1:4] 9 Inf 11 12 421s num [1:4] 9 Inf 11 12 421s range: 421s num [1:4, 1:2] 1 Inf 3 4 9 ... 421s num [1:4, 1:2] 1 Inf 3 4 9 ... 421s num [1:4, 1:2] 1 Inf 3 4 9 ... 421s real + NaN cell (double) w/ na.rm = TRUE: 421s [,1] [,2] [,3] 421s [1,] 1 5 9 421s [2,] 2 NaN 10 421s [3,] 3 7 11 421s [4,] 4 8 12 421s min: 421s num [1:4] 1 2 3 4 421s num [1:4] 1 2 3 4 421s num [1:4] 1 2 3 4 421s max: 421s num [1:4] 9 10 11 12 421s num [1:4] 9 10 11 12 421s num [1:4] 9 10 11 12 421s range: 421s num [1:4, 1:2] 1 2 3 4 9 10 11 12 421s num [1:4, 1:2] 1 2 3 4 9 10 11 12 421s num [1:4, 1:2] 1 2 3 4 9 10 11 12 421s real + NaN cell (double) w/ na.rm = TRUE: 421s [,1] [,2] [,3] 421s [1,] 1 5 9 421s [2,] 2 NaN 10 421s [3,] 3 7 11 421s [4,] 4 8 12 421s min: 421s num [1:4] 1 2 3 4 421s num [1:4] 1 2 3 4 421s num [1:4] 1 2 3 4 421s max: 421s num [1:4] 9 10 11 12 421s num [1:4] 9 10 11 12 421s num [1:4] 9 10 11 12 421s range: 421s num [1:4, 1:2] 1 2 3 4 9 10 11 12 421s num [1:4, 1:2] 1 2 3 4 9 10 11 12 421s num [1:4, 1:2] 1 2 3 4 9 10 11 12 421s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 421s [,1] [,2] [,3] 421s [1,] NA NA NA 421s [2,] NA NaN NA 421s [3,] NA NA NA 421s [4,] NA NA NA 421s min: 421s num [1:4] Inf Inf Inf Inf 421s num [1:4] Inf Inf Inf Inf 421s num [1:4] Inf Inf Inf Inf 421s max: 421s num [1:4] -Inf -Inf -Inf -Inf 421s num [1:4] -Inf -Inf -Inf -Inf 421s num [1:4] -Inf -Inf -Inf -Inf 421s range: 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 421s [,1] [,2] [,3] 421s [1,] NA NA NA 421s [2,] NA NaN NA 421s [3,] NA NA NA 421s [4,] NA NA NA 421s min: 421s num [1:4] Inf Inf Inf Inf 421s num [1:4] Inf Inf Inf Inf 421s num [1:4] Inf Inf Inf Inf 421s max: 421s num [1:4] -Inf -Inf -Inf -Inf 421s num [1:4] -Inf -Inf -Inf -Inf 421s num [1:4] -Inf -Inf -Inf -Inf 421s range: 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s real w/ NA + NaN row (double) w/ na.rm = TRUE: 421s [,1] [,2] [,3] 421s [1,] NA NA NA 421s [2,] NaN NaN NaN 421s [3,] NA NA NA 421s [4,] NA NA NA 421s min: 421s num [1:4] Inf Inf Inf Inf 421s num [1:4] Inf Inf Inf Inf 421s num [1:4] Inf Inf Inf Inf 421s max: 421s num [1:4] -Inf -Inf -Inf -Inf 421s num [1:4] -Inf -Inf -Inf -Inf 421s num [1:4] -Inf -Inf -Inf -Inf 421s range: 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s real w/ NA + NaN row (double) w/ na.rm = TRUE: 421s [,1] [,2] [,3] 421s [1,] NA NA NA 421s [2,] NaN NaN NaN 421s [3,] NA NA NA 421s [4,] NA NA NA 421s min: 421s num [1:4] Inf Inf Inf Inf 421s num [1:4] Inf Inf Inf Inf 421s num [1:4] Inf Inf Inf Inf 421s max: 421s num [1:4] -Inf -Inf -Inf -Inf 421s num [1:4] -Inf -Inf -Inf -Inf 421s num [1:4] -Inf -Inf -Inf -Inf 421s range: 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 421s > 421s 421s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 421s Copyright (C) 2025 The R Foundation for Statistical Computing 421s Platform: aarch64-unknown-linux-gnu 421s 421s R is free software and comes with ABSOLUTELY NO WARRANTY. 421s You are welcome to redistribute it under certain conditions. 421s Type 'license()' or 'licence()' for distribution details. 421s 421s R is a collaborative project with many contributors. 421s Type 'contributors()' for more information and 421s 'citation()' on how to cite R or R packages in publications. 421s 421s Type 'demo()' for some demos, 'help()' for on-line help, or 421s 'help.start()' for an HTML browser interface to help. 421s Type 'q()' to quit R. 421s 421s > library("matrixStats") 421s > 421s > rowMins_R <- function(x, ..., useNames = TRUE) { 421s + suppressWarnings({ 421s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 421s + }) 421s + if (!useNames) names(res) <- NULL 421s + res 421s + } # rowMins_R() 421s > 421s > rowMaxs_R <- function(x, ..., useNames = TRUE) { 421s + suppressWarnings({ 421s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 421s + }) 421s + if (!useNames) names(res) <- NULL 421s + res 421s + } # rowMaxs_R() 421s > 421s > rowRanges_R <- function(x, ..., useNames = TRUE) { 421s + suppressWarnings({ 421s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 421s + }) 421s + 421s + # Preserve rownames attribute 421s + dim <- c(dim(x)[1], 2L) 421s + if (!isTRUE(all.equal(dim(ans), dim))) { 421s + dim(ans) <- dim 421s + rownames <- rownames(x) 421s + if (!is.null(dimnames)) rownames(ans) <- rownames 421s + } 421s + if (!useNames) dimnames(ans) <- NULL 421s + ans 421s + } # rowRanges_R() 421s > 421s > 421s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 421s > # Subsetted tests 421s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 421s > source("utils/validateIndicesFramework.R") 421s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 421s > storage.mode(x) <- "integer" 421s > 421s > # To check rownames/names attributes 421s > dimnames <- list(letters[1:6], LETTERS[1:6]) 421s > 421s > # Test with and without dimnames on x 421s > for (setDimnames in c(TRUE, FALSE)) { 421s + if (setDimnames) dimnames(x) <- dimnames 421s + else dimnames(x) <- NULL 421s + 421s + count <- 0L 421s + for (rows in index_cases) { 421s + for (cols in index_cases) { 421s + count <- count + 1L 421s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 421s + useNames <- c(TRUE, FALSE) 421s + useNames <- useNames[count %% length(useNames) + 1] 421s + 421s + validateIndicesTestMatrix(x, rows, cols, 421s + ftest = rowRanges, fsure = rowRanges_R, 421s + na.rm = na.rm, useNames = useNames) 421s + validateIndicesTestMatrix(x, rows, cols, 421s + ftest = rowMins, fsure = rowMins_R, 421s + na.rm = na.rm, useNames = useNames) 421s + validateIndicesTestMatrix(x, rows, cols, 421s + ftest = rowMaxs, fsure = rowMaxs_R, 421s + na.rm = na.rm, useNames = useNames) 421s + 421s + validateIndicesTestMatrix(x, rows, cols, 421s + fcoltest = colRanges, fsure = rowRanges_R, 421s + na.rm = na.rm, useNames = useNames) 421s + validateIndicesTestMatrix(x, rows, cols, 421s + fcoltest = colMins, fsure = rowMins_R, 421s + na.rm = na.rm, useNames = useNames) 421s + validateIndicesTestMatrix(x, rows, cols, 421s + fcoltest = colMaxs, fsure = rowMaxs_R, 421s + na.rm = na.rm, useNames = useNames) 421s + } 421s + } 421s + } 422s > 422s 422s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 422s Copyright (C) 2025 The R Foundation for Statistical Computing 422s Platform: aarch64-unknown-linux-gnu 422s 422s R is free software and comes with ABSOLUTELY NO WARRANTY. 422s You are welcome to redistribute it under certain conditions. 422s Type 'license()' or 'licence()' for distribution details. 422s 422s R is a collaborative project with many contributors. 422s Type 'contributors()' for more information and 422s 'citation()' on how to cite R or R packages in publications. 422s 422s Type 'demo()' for some demos, 'help()' for on-line help, or 422s 'help.start()' for an HTML browser interface to help. 422s Type 'q()' to quit R. 422s 422s > library("matrixStats") 422s > 422s > dense_rank <- function(x) match(x, table = sort(unique(x))) 422s > 422s > rowRanks_R <- function(x, ties.method, ..., useNames = TRUE) { 422s + if (ties.method == "dense") { 422s + res <- t(apply(x, MARGIN = 1L, FUN = dense_rank)) 422s + } else { 422s + res <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", ties.method = ties.method)) 422s + } 422s + 422s + # Preserve dimnames attribute? 422s + dim(res) <- dim(x) 422s + dimnames(res) <- if (useNames) dimnames(x) else NULL 422s + 422s + res 422s + } 422s > 422s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = TRUE) { 422s + if (ties.method == "dense") { 422s + res <- t(apply(x, MARGIN = 2L, FUN = dense_rank)) 422s + } else { 422s + res <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 422s + } 422s + 422s + # Preserve dimnames attribute? 422s + tx <- t(x) 422s + dim(res) <- dim(tx) 422s + dimnames(res) <- if (useNames) dimnames(tx) else NULL 422s + 422s + if (preserveShape) res <- t(res) 422s + res 422s + } 422s > 422s > set.seed(1) 422s > 422s > cat("Consistency checks:\n") 422s Consistency checks: 422s > xs <- vector("list", length = 4L) 422s > for (kk in 1:4) { 422s + 422s + # Simulate data in a matrix of any shape 422s + dim <- sample(40:80, size = 2L) 422s + n <- prod(dim) 422s + x <- rnorm(n, sd = 10) 422s + dim(x) <- dim 422s + 422s + # Add NAs? 422s + if ((kk %% 4) %in% c(3, 0)) { 422s + cat("Adding NAs\n") 422s + nna <- sample(n, size = 1L) 422s + x[sample(length(x), size = nna)] <- NA_real_ 422s + } 422s + 422s + # Integer or double? 422s + if ((kk %% 4) %in% c(2, 0)) { 422s + cat("Coercing to integers\n") 422s + storage.mode(x) <- "integer" 422s + } 422s + 422s + xs[[kk]] <- x 422s + } # for (kk ...) 422s Coercing to integers 422s Adding NAs 422s Adding NAs 422s Coercing to integers 422s > str(xs) 422s List of 4 422s $ : num [1:43, 1:78] 13.3 12.72 4.15 -15.4 -9.29 ... 422s $ : int [1:46, 1:61] 2 11 -16 -5 19 5 26 -13 1 -9 ... 422s $ : num [1:42, 1:47] NA -22.3 NA NA NA ... 422s $ : int [1:42, 1:78] NA NA NA NA NA NA NA NA NA NA ... 422s > 422s > for (kk in 1:4) { 422s + cat("Random test #", kk, "\n", sep = "") 422s + x <- xs[[kk]] 422s + tx <- t(x) 422s + 422s + for (ties in c("max", "min", "average", "first", "last", "dense")) { 422s + cat(sprintf("ties.method = %s\n", ties)) 422s + # rowRanks(): 422s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 422s + y2 <- rowRanks_R(x, ties.method = ties) 422s + stopifnot(identical(y1, y2)) 422s + 422s + y3 <- matrixStats::colRanks(tx, ties.method = ties) 422s + stopifnot(identical(y1, y3)) 422s + 422s + # colRanks(): 422s + y1 <- matrixStats::colRanks(x, ties.method = ties) 422s + y2 <- colRanks_R(x, ties.method = ties) 422s + stopifnot(identical(y1, y2)) 422s + 422s + y3 <- matrixStats::rowRanks(tx, ties.method = ties) 422s + stopifnot(identical(y1, y3)) 422s + } 422s + } # for (kk ...) 422s Random test #1 422s ties.method = max 422s ties.method = min 422s ties.method = average 422s ties.method = first 422s ties.method = last 422s ties.method = dense 422s Random test #2 422s ties.method = max 422s ties.method = min 422s ties.method = average 422s ties.method = first 422s ties.method = last 422s ties.method = dense 422s Random test #3 422s ties.method = max 422s ties.method = min 422s ties.method = average 422s ties.method = first 422s ties.method = last 422s ties.method = dense 422s Random test #4 422s ties.method = max 422s ties.method = min 422s ties.method = average 422s ties.method = first 422s ties.method = last 422s ties.method = dense 422s > 422s > # Note, below we know ties.method %in% c("min", "max", "average") is correct 422s > 422s > cat("Consistency checks for random:\n") 422s Consistency checks for random: 422s > tolerance <- 0.1 422s > nsamples <- 10000 422s > for (kk in 1:4) { 422s + cat("Random test #", kk, "\n", sep = "") 422s + x <- xs[[kk]] 422s + tx <- t(x) 422s + 422s + for (ties in c("random")) { 422s + cat(sprintf("ties.method = %s\n", ties)) 422s + 422s + ## rowRanks(): 422s + y0 <- rowRanks_R(x, ties.method = ties) 422s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 422s + 422s + ## Assert symmetric rank differences 422s + d <- y1 - y0 422s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 422s + 422s + ## Assert within [min, max] 422s + y2min <- matrixStats::rowRanks(x, ties.method = "min") 422s + y2max <- matrixStats::rowRanks(x, ties.method = "max") 422s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 422s + ## Assert near average 422s + y1list <- replicate(nsamples, matrixStats::rowRanks(x, ties.method = ties), simplify = FALSE) 422s + y1mean <- Reduce(`+`, y1list) / nsamples 422s + y2avg <- matrixStats::rowRanks(x, ties.method = "average") 422s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 422s + 422s + ## colRanks(): 422s + y0 <- colRanks_R(x, ties.method = ties) 422s + y1 <- matrixStats::colRanks(x, ties.method = ties) 422s + 422s + ## Assert symmetric rank differences 422s + d <- y1 - y0 422s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 422s + 422s + ## Assert within [min, max] 422s + y2min <- matrixStats::colRanks(x, ties.method = "min") 422s + y2max <- matrixStats::colRanks(x, ties.method = "max") 422s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 422s + y1list <- replicate(nsamples, matrixStats::colRanks(x, ties.method = ties), simplify = FALSE) 422s + y1mean <- Reduce(`+`, y1list) / nsamples 422s + ## Assert near average 422s + y2avg <- matrixStats::colRanks(x, ties.method = "average") 422s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 422s + } 422s + } # for (kk ...) 422s Random test #1 422s ties.method = random 425s Random test #2 425s ties.method = random 427s Random test #3 427s ties.method = random 428s Random test #4 428s ties.method = random 429s > 429s > 429s > ## Exception handling 429s > x <- matrix(1:12, nrow = 3L, ncol = 4L) 429s > y <- try(rowRanks(x, ties.method = "unknown"), silent = TRUE) 429s > stopifnot(inherits(y, "try-error")) 429s > 429s > y <- try(colRanks(x, ties.method = "unknown"), silent = TRUE) 429s > stopifnot(inherits(y, "try-error")) 429s > 429s > dimnames <- list(letters[1:3], LETTERS[1:4]) 429s > for (mode in c("integer", "double")){ 429s + storage.mode(x) <- mode 429s + # Test with and without dimnames on x 429s + for (setDimnames in c(TRUE, FALSE)) { 429s + if (setDimnames) dimnames(x) <- dimnames 429s + else dimnames(x) <- NULL 429s + # Check names attribute 429s + for (useNames in c(TRUE, FALSE)) { 429s + for (ties in c("max", "min", "average", "first", "last", "dense", "random")) { 429s + cat(sprintf("ties.method = %s\n", ties)) 429s + # rowRanks(): 429s + y1 <- matrixStats::rowRanks(x, ties.method = ties, useNames = useNames) 429s + y2 <- rowRanks_R(x, ties.method = ties, useNames = useNames) 429s + stopifnot(identical(y1, y2)) 429s + 429s + y3 <- matrixStats::colRanks(t(x), ties.method = ties, useNames = useNames) 429s + stopifnot(identical(y1, y3)) 429s + 429s + # colRanks(): 429s + y1 <- matrixStats::colRanks(x, ties.method = ties, useNames = useNames) 429s + y2 <- colRanks_R(x, ties.method = ties, useNames = useNames) 429s + stopifnot(identical(y1, y2)) 429s + 429s + y3 <- matrixStats::rowRanks(t(x), ties.method = ties, useNames = useNames) 429s + stopifnot(identical(y1, y3)) 429s + 429s + # Check preserveShape 429s + y1 <- matrixStats::colRanks(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 429s + y2 <- colRanks_R(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 429s + stopifnot(identical(y1, y2)) 429s + } 429s + } 429s + } 429s + } 429s ties.method = max 429s ties.method = min 429s ties.method = average 429s ties.method = first 429s ties.method = last 429s ties.method = dense 429s ties.method = random 429s ties.method = max 429s ties.method = min 429s ties.method = average 429s ties.method = first 429s ties.method = last 429s ties.method = dense 429s ties.method = random 429s ties.method = max 429s ties.method = min 429s ties.method = average 429s ties.method = first 429s ties.method = last 429s ties.method = dense 429s ties.method = random 429s ties.method = max 429s ties.method = min 429s ties.method = average 429s ties.method = first 429s ties.method = last 429s ties.method = dense 429s ties.method = random 429s ties.method = max 429s ties.method = min 429s ties.method = average 429s ties.method = first 429s ties.method = last 429s ties.method = dense 429s ties.method = random 429s ties.method = max 429s ties.method = min 429s ties.method = average 429s ties.method = first 429s ties.method = last 429s ties.method = dense 429s ties.method = random 429s ties.method = max 429s ties.method = min 429s ties.method = average 429s ties.method = first 429s ties.method = last 429s ties.method = dense 429s ties.method = random 429s ties.method = max 429s ties.method = min 429s ties.method = average 429s ties.method = first 429s ties.method = last 429s ties.method = dense 429s ties.method = random 429s > 429s 429s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 429s Copyright (C) 2025 The R Foundation for Statistical Computing 429s Platform: aarch64-unknown-linux-gnu 429s 429s R is free software and comes with ABSOLUTELY NO WARRANTY. 429s You are welcome to redistribute it under certain conditions. 429s Type 'license()' or 'licence()' for distribution details. 429s 429s R is a collaborative project with many contributors. 429s Type 'contributors()' for more information and 429s 'citation()' on how to cite R or R packages in publications. 429s 429s Type 'demo()' for some demos, 'help()' for on-line help, or 429s 'help.start()' for an HTML browser interface to help. 429s Type 'q()' to quit R. 429s 429s > library("matrixStats") 429s > 429s > rowRanks_R <- function(x, ties.method = "average", ..., useNames = TRUE) { 429s + ans <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", 429s + ties.method = ties.method)) 429s + 429s + # Preserve dimnames attribute? 429s + dim(ans) <- dim(x) 429s + dimnames(ans) <- if (useNames) dimnames(x) else NULL 429s + 429s + ans 429s + } 429s > 429s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = TRUE) { 429s + ans <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 429s + 429s + # Preserve dimnames attribute? 429s + tx <- t(x) 429s + dim(ans) <- dim(tx) 429s + dimnames(ans) <- if (useNames) dimnames(tx) else NULL 429s + 429s + if (preserveShape) ans <- t(ans) 429s + ans 429s + } 429s > 429s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 429s > # Subsetted tests 429s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 429s > source("utils/validateIndicesFramework.R") 429s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 429s > storage.mode(x) <- "integer" 429s > 429s > # To check dimnames attribute 429s > dimnames <- list(letters[1:6], LETTERS[1:6]) 429s > 429s > colRanks_R_t <- function(x, rows, cols, ..., useNames = TRUE) { 429s + t(colRanks(t(x), rows = cols, cols = rows, preserveShape = TRUE, ..., useNames = useNames)) 429s + } 429s > 429s > # Test with and without dimnames on x 429s > for (setDimnames in c(TRUE, FALSE)) { 429s + if (setDimnames) dimnames(x) <- dimnames 429s + else dimnames(x) <- NULL 429s + 429s + count <- 0L 429s + for (rows in index_cases) { 429s + for (cols in index_cases) { 429s + count <- count + 1L 429s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 429s + useNames <- c(TRUE, FALSE) 429s + useNames <- useNames[count %% length(useNames) + 1] 429s + 429s + validateIndicesTestMatrix(x, rows, cols, 429s + ftest = rowRanks, fsure = rowRanks_R, 429s + ties.method = "average", useNames = useNames) 429s + 429s + validateIndicesTestMatrix(x, rows, cols, 429s + ftest = colRanks_R_t, fsure = rowRanks_R, 429s + ties.method = "average", useNames = useNames) 429s + 429s + for (perserveShape in c(TRUE, FALSE)) { 429s + validateIndicesTestMatrix(x, rows, cols, 429s + ftest = colRanks, fsure = colRanks_R, 429s + ties.method = "average", perserveShape = perserveShape, 429s + useNames = useNames) 429s + } 429s + } 429s + } 429s + } 430s > 430s 430s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 430s Copyright (C) 2025 The R Foundation for Statistical Computing 430s Platform: aarch64-unknown-linux-gnu 430s 430s R is free software and comes with ABSOLUTELY NO WARRANTY. 430s You are welcome to redistribute it under certain conditions. 430s Type 'license()' or 'licence()' for distribution details. 430s 430s R is a collaborative project with many contributors. 430s Type 'contributors()' for more information and 430s 'citation()' on how to cite R or R packages in publications. 430s 430s Type 'demo()' for some demos, 'help()' for on-line help, or 430s 'help.start()' for an HTML browser interface to help. 430s Type 'q()' to quit R. 430s 430s > library("matrixStats") 430s > 430s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 430s > options(matrixStats.center.onUse = "ignore") 430s > 430s > ## Create isFALSE() if running on an old version of R 430s > if (!exists("isFALSE", mode="function")) { 430s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 430s + } 430s > 430s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 430s + suppressWarnings({ 430s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 430s + }) 430s + stopifnot(!any(is.infinite(sigma))) 430s + 430s + # Keep naming support consistency same as rowSds() 430s + if (is.null(center) || ncol(x) <= 1L) { 430s + if (isFALSE(useNames)) names(sigma) <- NULL 430s + } 430s + else if (isFALSE(useNames)) names(sigma) <- NULL 430s + sigma 430s + } 430s > 430s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 430s + suppressWarnings({ 430s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 430s + }) 430s + stopifnot(!any(is.infinite(sigma))) 430s + 430s + # Keep naming support consistency same as colSds() 430s + if (is.null(center) || nrow(x) <= 1L) { 430s + if (isFALSE(useNames)) names(sigma) <- NULL 430s + } 430s + if (isFALSE(useNames)) names(sigma) <- NULL 430s + sigma 430s + } 430s > 430s > 430s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 430s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 430s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 430s + stopifnot(!any(is.infinite(sigma))) 430s + sigma 430s + } 430s > 430s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 430s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 430s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 430s + stopifnot(!any(is.infinite(sigma))) 430s + sigma 430s + } 430s > 430s > 430s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 430s > # With and without some NAs 430s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 430s > for (mode in c("integer", "double")) { 430s + for (add_na in c(FALSE, TRUE)) { 430s + cat("add_na = ", add_na, "\n", sep = "") 430s + 430s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 430s + if (add_na) { 430s + x[3:7, c(2, 4)] <- NA_real_ 430s + } 430s + cat("mode: ", mode, "\n", sep = "") 430s + storage.mode(x) <- mode 430s + str(x) 430s + 430s + # To check names attribute 430s + dimnames <- list(letters[1:10], LETTERS[1:5]) 430s + 430s + # Test with and without dimnames on x 430s + for (setDimnames in c(TRUE, FALSE)) { 430s + if (setDimnames) dimnames(x) <- dimnames 430s + else dimnames(x) <- NULL 430s + # Row/column ranges 430s + for (na.rm in c(FALSE, TRUE)) { 430s + # Check names attribute 430s + for (useNames in c(TRUE, FALSE)) { 430s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 430s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 430s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 430s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 430s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 430s + stopifnot(all.equal(r1, r2)) 430s + stopifnot(all.equal(r1, r0)) 430s + stopifnot(all.equal(r2, r0)) 430s + stopifnot(all.equal(r1b, r2b)) 430s + stopifnot( 430s + !any(is.infinite(r1)), 430s + !any(is.infinite(r2)), 430s + !any(is.infinite(r1b)), 430s + !any(is.infinite(r2b)) 430s + ) 430s + } 430s + } 430s + } 430s + } # for (add_na ...) 430s + } 430s add_na = FALSE 430s mode: integer 430s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 430s add_na = TRUE 430s mode: integer 430s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 430s add_na = FALSE 430s mode: double 430s 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 ... 430s add_na = TRUE 430s mode: double 430s 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 ... 430s > 430s > 430s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 430s > # All NAs 430s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 430s > for (mode in c("integer", "double")) { 430s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 430s + cat("mode: ", mode, "\n", sep = "") 430s + storage.mode(x) <- mode 430s + str(x) 430s + 430s + # Test with and without dimnames on x 430s + for (setDimnames in c(TRUE, FALSE)) { 430s + if (setDimnames) dimnames(x) <- dimnames 430s + else dimnames(x) <- NULL 430s + # Row/column ranges 430s + for (na.rm in c(FALSE, TRUE)) { 430s + # Check names attribute 430s + for (useNames in c(TRUE, FALSE)) { 430s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 430s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 430s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 430s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 430s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 430s + stopifnot(all.equal(r1, r2)) 430s + stopifnot(all.equal(r1, r0)) 430s + stopifnot(all.equal(r2, r0)) 430s + stopifnot(all.equal(r1b, r2b)) 430s + stopifnot( 430s + !any(is.infinite(r1)), 430s + !any(is.infinite(r2)), 430s + !any(is.infinite(r1b)), 430s + !any(is.infinite(r2b)) 430s + ) 430s + } 430s + } 430s + } 430s + } 430s mode: integer 430s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 430s mode: double 430s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 430s > 430s > 430s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 430s > # A 1x1 matrix 430s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 430s > x <- matrix(0, nrow = 1L, ncol = 1L) 430s > dimnames <- list("a", "A") 430s > for (na.rm in c(FALSE, TRUE)) { 430s + cat("na.rm = ", na.rm, "\n", sep = "") 430s + 430s + # Test with and without dimnames on x 430s + for (setDimnames in c(TRUE, FALSE)) { 430s + if (setDimnames) dimnames(x) <- dimnames 430s + else dimnames(x) <- NULL 430s + # Row/column ranges 430s + for (na.rm in c(FALSE, TRUE)) { 430s + # Check names attribute 430s + for (useNames in c(TRUE, FALSE)) { 430s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 430s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 430s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 430s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 430s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 430s + stopifnot(all.equal(r1, r2)) 430s + stopifnot(all.equal(r1, r0)) 430s + stopifnot(all.equal(r2, r0)) 430s + stopifnot(all.equal(r1b, r2b)) 430s + stopifnot( 430s + !any(is.infinite(r1)), 430s + !any(is.infinite(r2)), 430s + !any(is.infinite(r1b)), 430s + !any(is.infinite(r2b)) 430s + ) 430s + } 430s + } 430s + } 430s + } 430s na.rm = FALSE 430s na.rm = TRUE 430s > 430s 430s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 430s Copyright (C) 2025 The R Foundation for Statistical Computing 430s Platform: aarch64-unknown-linux-gnu 430s 430s R is free software and comes with ABSOLUTELY NO WARRANTY. 430s You are welcome to redistribute it under certain conditions. 430s Type 'license()' or 'licence()' for distribution details. 430s 430s R is a collaborative project with many contributors. 430s Type 'contributors()' for more information and 430s 'citation()' on how to cite R or R packages in publications. 430s 430s Type 'demo()' for some demos, 'help()' for on-line help, or 430s 'help.start()' for an HTML browser interface to help. 430s Type 'q()' to quit R. 430s 431s > library("matrixStats") 431s > 431s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 431s > options(matrixStats.center.onUse = "ignore") 431s > 431s > ## Create isFALSE() if running on an old version of R 431s > if (!exists("isFALSE", mode="function")) { 431s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 431s + } 431s > 431s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 431s + suppressWarnings({ 431s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 431s + }) 431s + stopifnot(!any(is.infinite(sigma))) 431s + 431s + # Keep naming support consistency same as rowSds() 431s + if (is.null(center) || ncol(x) <= 1L) { 431s + if (isFALSE(useNames)) names(sigma) <- NULL 431s + } 431s + else if (isFALSE(useNames)) names(sigma) <- NULL 431s + sigma 431s + } 431s > 431s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 431s + suppressWarnings({ 431s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 431s + }) 431s + stopifnot(!any(is.infinite(sigma))) 431s + 431s + # Keep naming support consistency same as colSds() 431s + if (is.null(center) || nrow(x) <= 1L) { 431s + if (isFALSE(useNames)) names(sigma) <- NULL 431s + } 431s + else if (isFALSE(useNames)) names(sigma) <- NULL 431s + sigma 431s + } 431s > 431s > 431s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 431s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 431s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 431s + stopifnot(!any(is.infinite(sigma))) 431s + sigma 431s + } 431s > 431s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 431s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 431s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 431s + stopifnot(!any(is.infinite(sigma))) 431s + sigma 431s + } 431s > 431s > 431s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 431s > # Subsetted tests 431s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 431s > source("utils/validateIndicesFramework.R") 431s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 431s > storage.mode(x) <- "integer" 431s > 431s > # To check names attribute 431s > dimnames <- list(letters[1:6], LETTERS[1:6]) 431s > 431s > # Test with and without dimnames on x 431s > for (setDimnames in c(TRUE, FALSE)) { 431s + if (setDimnames) dimnames(x) <- dimnames 431s + else dimnames(x) <- NULL 431s + 431s + count <- 0L 431s + for (rows in index_cases) { 431s + for (cols in index_cases) { 431s + count <- count + 1L 431s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 431s + useNames <- c(TRUE, FALSE) 431s + useNames <- useNames[count %% length(useNames) + 1] 431s + 431s + validateIndicesTestMatrix(x, rows, cols, 431s + ftest = rowSds, fsure = rowSds_R, 431s + na.rm = na.rm, useNames = useNames) 431s + validateIndicesTestMatrix(x, rows, cols, 431s + ftest = rowSds_center, fsure = rowSds_R, 431s + na.rm = na.rm, center = TRUE, useNames = useNames) 431s + 431s + validateIndicesTestMatrix(x, rows, cols, 431s + fcoltest = colSds, fsure = rowSds_R, 431s + na.rm = na.rm, useNames = useNames) 431s + validateIndicesTestMatrix(x, rows, cols, 431s + fcoltest = colSds_center, fsure = rowSds_R, 431s + na.rm = na.rm, center = TRUE, useNames = useNames) 431s + } 431s + } 431s + } 431s > 431s 431s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 431s Copyright (C) 2025 The R Foundation for Statistical Computing 431s Platform: aarch64-unknown-linux-gnu 431s 431s R is free software and comes with ABSOLUTELY NO WARRANTY. 431s You are welcome to redistribute it under certain conditions. 431s Type 'license()' or 'licence()' for distribution details. 431s 431s R is a collaborative project with many contributors. 431s Type 'contributors()' for more information and 431s 'citation()' on how to cite R or R packages in publications. 431s 431s Type 'demo()' for some demos, 'help()' for on-line help, or 431s 'help.start()' for an HTML browser interface to help. 431s Type 'q()' to quit R. 431s 431s > library("matrixStats") 431s > 431s > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 431s + ## FIXME: sum() may overflow for integers, whereas 431s + ## base::rowSums() doesn't. What should rowSums2() do? 431s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 431s + res <- rowSums(x, na.rm = na.rm) 431s + if (!useNames) names(res) <- NULL 431s + res 431s + } 431s > 431s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 431s + ## FIXME: sum() may overflow for integers, whereas 431s + ## base::colSums() doesn't. What should colSums2() do? 431s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 431s + res <- colSums(x, na.rm = na.rm) 431s + if (!useNames) names(res) <- NULL 431s + res 431s + } 432s > 432s > for (mode in c("integer", "logical", "double")) { 432s + x <- matrix(-4:4, nrow = 3, ncol = 3) 432s + storage.mode(x) <- mode 432s + if (mode == "double") x <- x + 0.1 432s + 432s + # To check names attribute 432s + dimnames <- list(letters[1:3], LETTERS[1:3]) 432s + 432s + # Test with and without dimnames on x 432s + for (setDimnames in c(TRUE, FALSE)) { 432s + if (setDimnames) dimnames(x) <- dimnames 432s + else dimnames(x) <- NULL 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + 432s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + } 432s + } 432s + } 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Special case: Single-element matrix 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > cat("Special case: Single-element matrix:\n") 432s Special case: Single-element matrix: 432s > for (mode in c("integer", "logical", "double")) { 432s + x <- matrix(1, nrow = 1, ncol = 1) 432s + storage.mode(x) <- mode 432s + 432s + # To check names attribute 432s + dimnames <- list("a", "A") 432s + 432s + # Test with and without dimnames on x 432s + for (setDimnames in c(TRUE, FALSE)) { 432s + if (setDimnames) dimnames(x) <- dimnames 432s + else dimnames(x) <- NULL 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + 432s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + } 432s + } 432s + } 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Special case: Empty matrix 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > cat("Special case: Empty matrix:\n") 432s Special case: Empty matrix: 432s > for (mode in c("integer", "logical", "double")) { 432s + x <- matrix(integer(0), nrow = 0, ncol = 0) 432s + storage.mode(x) <- mode 432s + 432s + y0 <- rowSums2_R(x, na.rm = FALSE) 432s + y1 <- rowSums2(x, na.rm = FALSE) 432s + stopifnot(all.equal(y1, y0)) 432s + 432s + y0 <- colSums2_R(x, na.rm = FALSE) 432s + y1 <- colSums2(x, na.rm = FALSE) 432s + stopifnot(all.equal(y1, y0)) 432s + } 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Special case: All NAs 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > cat("Special case: All NAs:\n") 432s Special case: All NAs: 432s > for (mode in c("integer", "logical", "double")) { 432s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 432s + storage.mode(x) <- mode 432s + 432s + # To check names attribute 432s + dimnames <- list(letters[1:3], LETTERS[1:3]) 432s + 432s + # Test with and without dimnames on x 432s + for (setDimnames in c(TRUE, FALSE)) { 432s + if (setDimnames) dimnames(x) <- dimnames 432s + else dimnames(x) <- NULL 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 432s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + 432s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 432s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + } 432s + } 432s + } 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Special case: All NaNs 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > cat("Special case: All NaNs:\n") 432s Special case: All NaNs: 432s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 432s > 432s > # Test with and without dimnames on x 432s > for (setDimnames in c(TRUE, FALSE)) { 432s + if (setDimnames) dimnames(x) <- dimnames 432s + else dimnames(x) <- NULL 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 432s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + 432s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 432s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + } 432s + } 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Special case: All Infs 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > cat("Special case: All Infs:\n") 432s Special case: All Infs: 432s > x <- matrix(Inf, nrow = 3, ncol = 3) 432s > 432s > # Test with and without dimnames on x 432s > for (setDimnames in c(TRUE, FALSE)) { 432s + if (setDimnames) dimnames(x) <- dimnames 432s + else dimnames(x) <- NULL 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + 432s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + } 432s + } 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Special case: All -Infs 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > cat("Special case: All -Infs:\n") 432s Special case: All -Infs: 432s > x <- matrix(-Inf, nrow = 3, ncol = 3) 432s > 432s > # Test with and without dimnames on x 432s > for (setDimnames in c(TRUE, FALSE)) { 432s + if (setDimnames) dimnames(x) <- dimnames 432s + else dimnames(x) <- NULL 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + 432s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + } 432s + } 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Special case: Infs and -Infs 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > cat("Special case: Infs and -Infs:\n") 432s Special case: Infs and -Infs: 432s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 432s > 432s > # To check names attribute 432s > dimnames <- list(letters[1:4], LETTERS[1:4]) 432s > 432s > # Test with and without dimnames on x 432s > for (setDimnames in c(TRUE, FALSE)) { 432s + if (setDimnames) dimnames(x) <- dimnames 432s + else dimnames(x) <- NULL 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + 432s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + } 432s + } 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Special case: NaNs and NAs 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > cat("Special case: Infs and -Infs:\n") 432s Special case: Infs and -Infs: 432s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 432s > 432s > y0 <- rowSums(x, na.rm = FALSE) 432s > str(y0) 432s num [1:4] NaN NA NaN NA 432s > stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 432s > y1 <- rowSums2(x, na.rm = FALSE) 432s > str(y0) 432s num [1:4] NaN NA NaN NA 432s > stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 432s > stopifnot(all.equal(y1, y0)) 432s > 432s > y0 <- colSums(x, na.rm = FALSE) 432s > stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 432s > y1 <- colSums2(x, na.rm = FALSE) 432s > stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 432s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 432s > ## returned here (as one would expect). NaN might very well be returned, 432s > ## when both NA and NaN are involved. This is an accepted feature in R, 432s > ## which is documented in help("is.nan"). See also 432s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 432s > ## Thus, we cannot guarantee that y1 is identical to y0. 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Special case: Integer overflow with ties 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > cat("Special case: Integer overflow with ties:\n") 432s Special case: Integer overflow with ties: 432s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 432s > 432s > # Test with and without dimnames on x 432s > for (setDimnames in c(TRUE, FALSE)) { 432s + if (setDimnames) dimnames(x) <- dimnames 432s + else dimnames(x) <- NULL 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + 432s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 432s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 432s + stopifnot(all.equal(y1, y0)) 432s + } 432s + } 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Consistency checks 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > set.seed(1) 432s > 432s > cat("Consistency checks:\n") 432s Consistency checks: 432s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 432s > for (kk in seq_len(n_sims)) { 432s + cat("Random test #", kk, "\n", sep = "") 432s + 432s + # Simulate data in a matrix of any shape 432s + dim <- sample(50:200, size = 2) 432s + n <- prod(dim) 432s + x <- rnorm(n, sd = 100) 432s + dim(x) <- dim 432s + 432s + # Add NAs? 432s + if ((kk %% 4) %in% c(3, 0)) { 432s + cat("Adding NAs\n") 432s + nna <- sample(n, size = 1) 432s + na_values <- c(NA_real_, NaN) 432s + t <- sample(na_values, size = nna, replace = TRUE) 432s + x[sample(length(x), size = nna)] <- t 432s + } 432s + 432s + # Mode? 432s + modes <- "double" 432s + if ((kk %% 4) %in% c(2, 0)) { 432s + modes <- c("integer", "logical") 432s + } 432s + 432s + for (mode in modes) { 432s + if (mode != "double") { 432s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 432s + storage.mode(x) <- mode 432s + } 432s + 432s + na.rm <- sample(c(TRUE, FALSE), size = 1) 432s + 432s + # rowSums2(): 432s + y0 <- rowSums2_R(x, na.rm = na.rm) 432s + y1 <- rowSums2(x, na.rm = na.rm) 432s + stopifnot(all.equal(y1, y0)) 432s + y2 <- colSums2(t(x), na.rm = na.rm) 432s + stopifnot(all.equal(y2, y0)) 432s + 432s + # colSums2(): 432s + y0 <- colSums2_R(x, na.rm = na.rm) 432s + y1 <- colSums2(x, na.rm = na.rm) 432s + stopifnot(all.equal(y1, y0)) 432s + y2 <- rowSums2(t(x), na.rm = na.rm) 432s + stopifnot(all.equal(y2, y0)) 432s + } 432s + } # for (kk ...) 432s Random test #1 432s Random test #2 432s Coercing from double to integer 432s Coercing from integer to logical 432s Random test #3 432s Adding NAs 432s Random test #4 432s Adding NAs 432s Coercing from double to integer 432s Coercing from integer to logical 432s Random test #5 432s Random test #6 432s Coercing from double to integer 432s Coercing from integer to logical 432s Random test #7 432s Adding NAs 432s Random test #8 432s Adding NAs 432s Coercing from double to integer 432s Coercing from integer to logical 432s Random test #9 432s Random test #10 432s Coercing from double to integer 432s Coercing from integer to logical 432s Random test #11 432s Adding NAs 432s Random test #12 432s Adding NAs 432s Coercing from double to integer 432s Coercing from integer to logical 432s Random test #13 432s Random test #14 432s Coercing from double to integer 432s Coercing from integer to logical 432s Random test #15 432s Adding NAs 432s Random test #16 432s Adding NAs 432s Coercing from double to integer 432s Coercing from integer to logical 432s Random test #17 432s Random test #18 432s Coercing from double to integer 432s Coercing from integer to logical 432s Random test #19 432s Adding NAs 432s Random test #20 432s Adding NAs 432s Coercing from double to integer 432s Coercing from integer to logical 432s > 432s 432s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 432s Copyright (C) 2025 The R Foundation for Statistical Computing 432s Platform: aarch64-unknown-linux-gnu 432s 432s R is free software and comes with ABSOLUTELY NO WARRANTY. 432s You are welcome to redistribute it under certain conditions. 432s Type 'license()' or 'licence()' for distribution details. 432s 432s R is a collaborative project with many contributors. 432s Type 'contributors()' for more information and 432s 'citation()' on how to cite R or R packages in publications. 432s 432s Type 'demo()' for some demos, 'help()' for on-line help, or 432s 'help.start()' for an HTML browser interface to help. 432s Type 'q()' to quit R. 432s 432s > library("matrixStats") 432s > 432s > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 432s + ## FIXME: sum() may overflow for integers, whereas 432s + ## base::rowSums() doesn't. What should rowSums2() do? 432s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 432s + res <- rowSums(x, na.rm = na.rm) 432s + if (!useNames) names(res) <- NULL 432s + res 432s + } 432s > 432s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 432s + ## FIXME: sum() may overflow for integers, whereas 432s + ## base::colSums() doesn't. What should colSums2() do? 432s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 432s + res <- colSums(x, na.rm = na.rm) 432s + if (!useNames) names(res) <- NULL 432s + res 432s + } 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Subsetted tests 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > source("utils/validateIndicesFramework.R") 432s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 432s > storage.mode(x) <- "integer" 432s > 432s > # To check names attribute 432s > dimnames <- list(letters[1:6], LETTERS[1:6]) 432s > 432s > # Test with and without dimnames on x 432s > for (setDimnames in c(TRUE, FALSE)) { 432s + if (setDimnames) dimnames(x) <- dimnames 432s + else dimnames(x) <- NULL 432s + for (rows in index_cases) { 432s + for (cols in index_cases) { 432s + for (na.rm in c(TRUE, FALSE)) { 432s + for (useNames in c(TRUE, FALSE)) { 432s + validateIndicesTestMatrix(x, rows, cols, 432s + ftest = rowSums2, fsure = rowSums2_R, 432s + na.rm = na.rm, useNames = useNames) 432s + validateIndicesTestMatrix(x, rows, cols, 432s + fcoltest = colSums2, fsure = rowSums2_R, 432s + na.rm = na.rm, useNames = useNames) 432s + } 432s + } 432s + } 432s + } 432s + } 433s > 433s 433s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 433s Copyright (C) 2025 The R Foundation for Statistical Computing 433s Platform: aarch64-unknown-linux-gnu 433s 433s R is free software and comes with ABSOLUTELY NO WARRANTY. 433s You are welcome to redistribute it under certain conditions. 433s Type 'license()' or 'licence()' for distribution details. 433s 433s R is a collaborative project with many contributors. 433s Type 'contributors()' for more information and 433s 'citation()' on how to cite R or R packages in publications. 433s 433s Type 'demo()' for some demos, 'help()' for on-line help, or 433s 'help.start()' for an HTML browser interface to help. 433s Type 'q()' to quit R. 433s 433s > library("matrixStats") 433s > 433s > nrow <- 6L 433s > ncol <- 5L 433s > data <- matrix(0:4, nrow = nrow, ncol = ncol) 433s > 433s > # To check names attribute 433s > dimnames <- list(letters[1:6], LETTERS[1:5]) 433s > 433s > modes <- c("integer", "logical", "raw") 433s > for (mode in modes) { 433s + cat(sprintf("Mode: %s...\n", mode)) 433s + 433s + x <- data 433s + if (mode == "logical") x <- x - 2L 433s + if (mode != "raw") x[c(2,5,7)] <- NA_integer_ 433s + storage.mode(x) <- mode 433s + print(x) 433s + 433s + unique_values <- unique(as.vector(x)) 433s + nbr_of_unique_values <- length(unique_values) 433s + 433s + y <- rowTabulates(x) 433s + print(y) 433s + stopifnot( 433s + identical(dim(y), c(nrow, nbr_of_unique_values)), 433s + all(y >= 0) 433s + ) 433s + if (mode != "raw") { 433s + y0 <- t(table(x, row(x), useNA = "always")[, seq_len(nrow(x))]) 433s + stopifnot(all(y == y0)) 433s + } 433s + # Check names attribute 433s + dimnames(x) <- dimnames 433s + y1 <- rowTabulates(x, useNames = FALSE) 433s + stopifnot(all.equal(y1, y)) 433s + y <- rowTabulates(x, useNames = TRUE) 433s + stopifnot(identical(rownames(y), rownames(x))) 433s + dimnames(x) <- NULL 433s + 433s + y <- colTabulates(x) 433s + print(y) 433s + stopifnot( 433s + identical(dim(y), c(ncol, nbr_of_unique_values)), 433s + all(y >= 0) 433s + ) 433s + if (mode != "raw") { 433s + y0 <- t(table(x, col(x), useNA = "always")[, seq_len(ncol(x))]) 433s + stopifnot(all(y == y0)) 433s + } 433s + # Check names attribute 433s + dimnames(x) <- dimnames 433s + y1 <- colTabulates(x, useNames = FALSE) 433s + stopifnot(all.equal(y1, y)) 433s + y <- colTabulates(x, useNames = TRUE) 433s + stopifnot(identical(rownames(y), colnames(x))) 433s + dimnames(x) <- NULL 433s + 433s + # Count only certain values 433s + if (mode == "integer") { 433s + subset <- c(0:2, NA_integer_) 433s + } else if (mode == "logical") { 433s + subset <- c(TRUE, FALSE, NA) 433s + } else { 433s + subset <- c(0:2) 433s + } 433s + y <- rowTabulates(x, values = subset) 433s + print(y) 433s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 433s + # Check names attribute 433s + dimnames(x) <- dimnames 433s + y1 <- rowTabulates(x, values = subset, useNames = FALSE) 433s + stopifnot(all.equal(y1, y)) 433s + y <- rowTabulates(x, values = subset, useNames = TRUE) 433s + stopifnot(identical(rownames(y), rownames(x))) 433s + dimnames(x) <- NULL 433s + 433s + y <- colTabulates(x, values = subset) 433s + print(y) 433s + stopifnot(identical(dim(y), c(ncol, length(subset)))) 433s + # Check names attribute 433s + dimnames(x) <- dimnames 433s + y1 <- colTabulates(x, values = subset, useNames = FALSE) 433s + stopifnot(all.equal(y1, y)) 433s + y <- colTabulates(x, values = subset, useNames = TRUE) 433s + stopifnot(identical(rownames(y), colnames(x))) 433s + dimnames(x) <- NULL 433s + 433s + # Raw 433s + if (mode %in% c("integer", "raw")) { 433s + subset <- c(0:2) 433s + 433s + y <- rowTabulates(x, values = as.raw(subset)) 433s + print(y) 433s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 433s + # Check names attribute 433s + dimnames(x) <- dimnames 433s + y1 <- rowTabulates(x, values = as.raw(subset), useNames = FALSE) 433s + stopifnot(all.equal(y1, y)) 433s + y3 <- rowTabulates(x, values = as.raw(subset), useNames = TRUE) 433s + stopifnot(identical(rownames(y3), rownames(x))) 433s + dimnames(x) <- NULL 433s + 433s + y2 <- colTabulates(t(x), values = as.raw(subset)) 433s + print(y2) 433s + stopifnot( 433s + identical(dim(y2), c(nrow, length(subset))), 433s + identical(y2, y) 433s + ) 433s + # Check names attribute 433s + dimnames(x) <- dimnames 433s + y1 <- colTabulates(t(x), values = as.raw(subset), useNames = FALSE) 433s + stopifnot(all.equal(y1, y)) 433s + y <- colTabulates(t(x), values = as.raw(subset), useNames = TRUE) 433s + stopifnot(identical(rownames(y), colnames(t(x)))) 433s + dimnames(x) <- NULL 433s + } 433s + 433s + cat(sprintf("Mode: %s...done\n", mode)) 433s + } # for (mode ...) 433s Mode: integer... 433s [,1] [,2] [,3] [,4] [,5] 433s [1,] 0 NA 2 3 4 433s [2,] NA 2 3 4 0 433s [3,] 2 3 4 0 1 433s [4,] 3 4 0 1 2 433s [5,] NA 0 1 2 3 433s [6,] 0 1 2 3 4 433s 0 1 2 3 4 433s [1,] 1 0 1 1 1 1 433s [2,] 1 0 1 1 1 1 433s [3,] 1 1 1 1 1 0 433s [4,] 1 1 1 1 1 0 433s [5,] 1 1 1 1 0 1 433s [6,] 1 1 1 1 1 0 433s 0 1 2 3 4 433s [1,] 2 0 1 1 0 2 433s [2,] 1 1 1 1 1 1 433s [3,] 1 1 2 1 1 0 433s [4,] 1 1 1 2 1 0 433s [5,] 1 1 1 1 2 0 433s 0 1 2 433s [1,] 1 0 1 1 433s [2,] 1 0 1 1 433s [3,] 1 1 1 0 433s [4,] 1 1 1 0 433s [5,] 1 1 1 1 433s [6,] 1 1 1 0 433s 0 1 2 433s [1,] 2 0 1 2 433s [2,] 1 1 1 1 433s [3,] 1 1 2 0 433s [4,] 1 1 1 0 433s [5,] 1 1 1 0 433s 0x0 0x1 0x2 433s [1,] 1 0 1 433s [2,] 1 0 1 433s [3,] 1 1 1 433s [4,] 1 1 1 433s [5,] 1 1 1 433s [6,] 1 1 1 433s 0x0 0x1 0x2 433s [1,] 1 0 1 433s [2,] 1 0 1 433s [3,] 1 1 1 433s [4,] 1 1 1 433s [5,] 1 1 1 433s [6,] 1 1 1 433s Mode: integer...done 433s Mode: logical... 433s [,1] [,2] [,3] [,4] [,5] 433s [1,] TRUE NA FALSE TRUE TRUE 433s [2,] NA FALSE TRUE TRUE TRUE 433s [3,] FALSE TRUE TRUE TRUE TRUE 433s [4,] TRUE TRUE TRUE TRUE FALSE 433s [5,] NA TRUE TRUE FALSE TRUE 433s [6,] TRUE TRUE FALSE TRUE TRUE 433s FALSE TRUE 433s [1,] 1 3 1 433s [2,] 1 3 1 433s [3,] 1 4 0 433s [4,] 1 4 0 433s [5,] 1 3 1 433s [6,] 1 4 0 433s FALSE TRUE 433s [1,] 1 3 2 433s [2,] 1 4 1 433s [3,] 2 4 0 433s [4,] 1 5 0 433s [5,] 1 5 0 433s TRUE FALSE 433s [1,] 3 1 1 433s [2,] 3 1 1 433s [3,] 4 1 0 433s [4,] 4 1 0 433s [5,] 3 1 1 433s [6,] 4 1 0 433s TRUE FALSE 433s [1,] 3 1 2 433s [2,] 4 1 1 433s [3,] 4 2 0 433s [4,] 5 1 0 433s [5,] 5 1 0 433s Mode: logical...done 433s Mode: raw... 433s [,1] [,2] [,3] [,4] [,5] 433s [1,] 00 01 02 03 04 433s [2,] 01 02 03 04 00 433s [3,] 02 03 04 00 01 433s [4,] 03 04 00 01 02 433s [5,] 04 00 01 02 03 433s [6,] 00 01 02 03 04 433s 0x0 0x1 0x2 0x3 0x4 433s [1,] 1 1 1 1 1 433s [2,] 1 1 1 1 1 433s [3,] 1 1 1 1 1 433s [4,] 1 1 1 1 1 433s [5,] 1 1 1 1 1 433s [6,] 1 1 1 1 1 433s 0x0 0x1 0x2 0x3 0x4 433s [1,] 2 1 1 1 1 433s [2,] 1 2 1 1 1 433s [3,] 1 1 2 1 1 433s [4,] 1 1 1 2 1 433s [5,] 1 1 1 1 2 433s 0 1 2 433s [1,] 1 1 1 433s [2,] 1 1 1 433s [3,] 1 1 1 433s [4,] 1 1 1 433s [5,] 1 1 1 433s [6,] 1 1 1 433s 0 1 2 433s [1,] 2 1 1 433s [2,] 1 2 1 433s [3,] 1 1 2 433s [4,] 1 1 1 433s [5,] 1 1 1 433s 0x0 0x1 0x2 433s [1,] 1 1 1 433s [2,] 1 1 1 433s [3,] 1 1 1 433s [4,] 1 1 1 433s [5,] 1 1 1 433s [6,] 1 1 1 433s 0x0 0x1 0x2 433s [1,] 1 1 1 433s [2,] 1 1 1 433s [3,] 1 1 1 433s [4,] 1 1 1 433s [5,] 1 1 1 433s [6,] 1 1 1 433s Mode: raw...done 433s > 433s 433s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 433s Copyright (C) 2025 The R Foundation for Statistical Computing 433s Platform: aarch64-unknown-linux-gnu 433s 433s R is free software and comes with ABSOLUTELY NO WARRANTY. 433s You are welcome to redistribute it under certain conditions. 433s Type 'license()' or 'licence()' for distribution details. 433s 433s R is a collaborative project with many contributors. 433s Type 'contributors()' for more information and 433s 'citation()' on how to cite R or R packages in publications. 433s 433s Type 'demo()' for some demos, 'help()' for on-line help, or 433s 'help.start()' for an HTML browser interface to help. 433s Type 'q()' to quit R. 433s 433s > library("matrixStats") 433s > 433s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 433s > # Subsetted tests 433s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 433s > source("utils/validateIndicesFramework.R") 433s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 433s > storage.mode(x) <- "integer" 433s > 433s > # To check names attribute 433s > dimnames <- list(letters[1:6], LETTERS[1:6]) 433s > 433s > # Test with and without dimnames on x 433s > for (setDimnames in c(TRUE, FALSE)) { 433s + if (setDimnames) dimnames(x) <- dimnames 433s + else dimnames(x) <- NULL 433s + 433s + count <- 0L 433s + for (rows in index_cases) { 433s + for (cols in index_cases) { 433s + count <- count + 1L 433s + useNames <- c(TRUE, FALSE) 433s + useNames <- useNames[count %% length(useNames) + 1] 433s + 433s + validateIndicesTestMatrix(x, rows, cols, 433s + ftest = rowTabulates, fsure = rowTabulates, useNames = useNames) 433s + validateIndicesTestMatrix(x, rows, cols, 433s + ftest = rowTabulates, fsure = rowTabulates, 433s + values = 1:3, useNames = useNames) 433s + 433s + validateIndicesTestMatrix(x, rows, cols, 433s + ftest = colTabulates, fsure = colTabulates, useNames = useNames) 433s + validateIndicesTestMatrix(x, rows, cols, 433s + ftest = colTabulates, fsure = colTabulates, 433s + values = 1:3, useNames = useNames) 433s + } 433s + } 433s + } 434s > 434s 434s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 434s Copyright (C) 2025 The R Foundation for Statistical Computing 434s Platform: aarch64-unknown-linux-gnu 434s 434s R is free software and comes with ABSOLUTELY NO WARRANTY. 434s You are welcome to redistribute it under certain conditions. 434s Type 'license()' or 'licence()' for distribution details. 434s 434s R is a collaborative project with many contributors. 434s Type 'contributors()' for more information and 434s 'citation()' on how to cite R or R packages in publications. 434s 434s Type 'demo()' for some demos, 'help()' for on-line help, or 434s 'help.start()' for an HTML browser interface to help. 434s Type 'q()' to quit R. 434s 435s > library("matrixStats") 435s > 435s > fcns <- list( 435s + rowVarDiffs = list(rowVarDiffs, colVarDiffs), 435s + rowSdDiffs = list(rowSdDiffs, colSdDiffs), 435s + rowMadDiffs = list(rowMadDiffs, colMadDiffs), 435s + rowIQRDiffs = list(rowIQRDiffs, colIQRDiffs) 435s + ) 435s > 435s > for (fcn in names(fcns)) { 435s + cat(sprintf("%s()...\n", fcn)) 435s + row_fcn <- fcns[[fcn]][[1L]] 435s + col_fcn <- fcns[[fcn]][[2L]] 435s + 435s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s + # With and without some NAs 435s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s + for (mode in c("integer", "double")) { 435s + for (add_na in c(FALSE, TRUE)) { 435s + cat("add_na = ", add_na, "\n", sep = "") 435s + 435s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 435s + if (add_na) { 435s + x[3:7, c(2, 4)] <- NA_real_ 435s + } 435s + cat("mode: ", mode, "\n", sep = "") 435s + storage.mode(x) <- mode 435s + str(x) 435s + 435s + # To check names attribute 435s + dimnames <- list(letters[1:10], LETTERS[1:5]) 435s + 435s + # Test with and without dimnames on x 435s + for (setDimnames in c(TRUE, FALSE)) { 435s + if (setDimnames) dimnames(x) <- dimnames 435s + else dimnames(x) <- NULL 435s + # Row/column ranges 435s + for (na.rm in c(FALSE, TRUE)) { 435s + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + cat("na.rm = ", na.rm, "\n", sep = "") 435s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 435s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 435s + stopifnot(all.equal(r1, r2)) 435s + } 435s + } 435s + } 435s + } # for (add_na ...) 435s + } 435s + 435s + 435s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s + # All NAs 435s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s + for (mode in c("integer", "double")) { 435s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 435s + cat("mode: ", mode, "\n", sep = "") 435s + storage.mode(x) <- mode 435s + str(x) 435s + 435s + # Test with and without dimnames on x 435s + for (setDimnames in c(TRUE, FALSE)) { 435s + if (setDimnames) dimnames(x) <- dimnames 435s + else dimnames(x) <- NULL 435s + # Row/column ranges 435s + for (na.rm in c(FALSE, TRUE)) { 435s + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + cat("na.rm = ", na.rm, "\n", sep = "") 435s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 435s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 435s + stopifnot(all.equal(r1, r2)) 435s + } 435s + } 435s + } 435s + } 435s + 435s + 435s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s + # A 1x1 matrix 435s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s + x <- matrix(0, nrow = 1L, ncol = 1L) 435s + dimnames <- list("a", "A") 435s + # Test with and without dimnames on x 435s + for (setDimnames in c(TRUE, FALSE)) { 435s + if (setDimnames) dimnames(x) <- dimnames 435s + else dimnames(x) <- NULL 435s + # Row/column ranges 435s + for (na.rm in c(FALSE, TRUE)) { 435s + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + cat("na.rm = ", na.rm, "\n", sep = "") 435s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 435s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 435s + stopifnot(all.equal(r1, r2)) 435s + } 435s + } 435s + } 435s + 435s + cat(sprintf("%s()...DONE\n", fcn)) 435s + } # for (fcn ...) 435s rowVarDiffs()... 435s add_na = FALSE 435s mode: integer 435s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = TRUE 435s mode: integer 435s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = FALSE 435s mode: double 435s 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 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = TRUE 435s mode: double 435s 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 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s mode: integer 435s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s mode: double 435s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s rowVarDiffs()...DONE 435s rowSdDiffs()... 435s add_na = FALSE 435s mode: integer 435s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = TRUE 435s mode: integer 435s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = FALSE 435s mode: double 435s 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 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = TRUE 435s mode: double 435s 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 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s mode: integer 435s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s mode: double 435s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s rowSdDiffs()...DONE 435s rowMadDiffs()... 435s add_na = FALSE 435s mode: integer 435s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = TRUE 435s mode: integer 435s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = FALSE 435s mode: double 435s 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 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = TRUE 435s mode: double 435s 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 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s mode: integer 435s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s mode: double 435s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s rowMadDiffs()...DONE 435s rowIQRDiffs()... 435s add_na = FALSE 435s mode: integer 435s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = TRUE 435s mode: integer 435s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = FALSE 435s mode: double 435s 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 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s add_na = TRUE 435s mode: double 435s 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 ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s mode: integer 435s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s mode: double 435s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s na.rm = FALSE 435s na.rm = FALSE 435s na.rm = TRUE 435s na.rm = TRUE 435s rowIQRDiffs()...DONE 435s > 435s 435s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 435s Copyright (C) 2025 The R Foundation for Statistical Computing 435s Platform: aarch64-unknown-linux-gnu 435s 435s R is free software and comes with ABSOLUTELY NO WARRANTY. 435s You are welcome to redistribute it under certain conditions. 435s Type 'license()' or 'licence()' for distribution details. 435s 435s R is a collaborative project with many contributors. 435s Type 'contributors()' for more information and 435s 'citation()' on how to cite R or R packages in publications. 435s 435s Type 'demo()' for some demos, 'help()' for on-line help, or 435s 'help.start()' for an HTML browser interface to help. 435s Type 'q()' to quit R. 435s 435s > library("matrixStats") 435s > 435s > fcns <- list( 435s + madDiff = c(rowMadDiffs, colMadDiffs), 435s + iqrDiff = c(rowIQRDiffs, colIQRDiffs) 435s + ) 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Subsetted tests 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > source("utils/validateIndicesFramework.R") 435s > # To check names attribute 435s > dimnames <- list(letters[1:6], LETTERS[1:6]) 435s > trim <- runif(1, min = 0, max = 0.5) 435s > for (fcn in names(fcns)) { 435s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 435s + row_fcn <- fcns[[fcn]][[1L]] 435s + col_fcn <- fcns[[fcn]][[2L]] 435s + 435s + for (mode in c("numeric", "integer")) { 435s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 435s + storage.mode(x) <- mode 435s + if (mode == "numeric") x[1:2, 3:4] <- Inf 435s + 435s + # Test with and without dimnames on x 435s + for (setDimnames in c(TRUE, FALSE)) { 435s + if (setDimnames) dimnames(x) <- dimnames 435s + else dimnames(x) <- NULL 435s + 435s + count <- 0L 435s + for (diff in 1:2) { 435s + for (rows in index_cases) { 435s + for (cols in index_cases) { 435s + count <- count + 1L 435s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 435s + useNames <- c(TRUE, FALSE) 435s + useNames <- useNames[count %% length(useNames) + 1] 435s + validateIndicesTestMatrix(x, rows, cols, 435s + ftest = row_fcn, fsure = row_fcn, 435s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 435s + validateIndicesTestMatrix(x, rows, cols, 435s + fcoltest = col_fcn, fsure = row_fcn, 435s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 435s + } 435s + } 435s + } 435s + } 435s + } 435s + cat(sprintf("%s()...DONE\n", fcn)) 435s + } 435s subsetted tests on madDiff()... 437s madDiff()...DONE 437s subsetted tests on iqrDiff()... 440s iqrDiff()...DONE 440s > 440s 440s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 440s Copyright (C) 2025 The R Foundation for Statistical Computing 440s Platform: aarch64-unknown-linux-gnu 440s 440s R is free software and comes with ABSOLUTELY NO WARRANTY. 440s You are welcome to redistribute it under certain conditions. 440s Type 'license()' or 'licence()' for distribution details. 440s 440s R is a collaborative project with many contributors. 440s Type 'contributors()' for more information and 440s 'citation()' on how to cite R or R packages in publications. 440s 440s Type 'demo()' for some demos, 'help()' for on-line help, or 440s 'help.start()' for an HTML browser interface to help. 440s Type 'q()' to quit R. 440s 440s > library("matrixStats") 440s > 440s > fcns <- list( 440s + varDiff = c(rowVarDiffs, colVarDiffs), 440s + sdDiff = c(rowSdDiffs, colSdDiffs) 440s + ) 440s > 440s > 440s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 440s > # Subsetted tests 440s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 440s > source("utils/validateIndicesFramework.R") 440s > # To check names attribute 440s > dimnames <- list(letters[1:6], LETTERS[1:6]) 440s > trim <- runif(1, min = 0, max = 0.5) 440s > for (fcn in names(fcns)) { 440s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 440s + row_fcn <- fcns[[fcn]][[1L]] 440s + col_fcn <- fcns[[fcn]][[2L]] 440s + 440s + for (mode in c("numeric", "integer")) { 440s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 440s + storage.mode(x) <- mode 440s + if (mode == "numeric") x[1:2, 3:4] <- Inf 440s + 440s + # Test with and without dimnames on x 440s + for (setDimnames in c(TRUE, FALSE)) { 440s + if (setDimnames) dimnames(x) <- dimnames 440s + else dimnames(x) <- NULL 440s + 440s + count <- 0L 440s + for (diff in 1:2) { 440s + for (rows in index_cases) { 440s + for (cols in index_cases) { 440s + count <- count + 1L 440s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 440s + useNames <- c(TRUE, FALSE) 440s + useNames <- useNames[count %% length(useNames) + 1] 440s + 440s + validateIndicesTestMatrix(x, rows, cols, 440s + ftest = row_fcn, fsure = row_fcn, 440s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 440s + validateIndicesTestMatrix(x, rows, cols, 440s + fcoltest = col_fcn, fsure = row_fcn, 440s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 440s + } 440s + } 440s + } 440s + } 440s + } 440s + cat(sprintf("%s()...DONE\n", fcn)) 440s + } 440s subsetted tests on varDiff()... 442s varDiff()...DONE 442s subsetted tests on sdDiff()... 443s sdDiff()...DONE 443s > 443s 443s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 443s Copyright (C) 2025 The R Foundation for Statistical Computing 443s Platform: aarch64-unknown-linux-gnu 443s 443s R is free software and comes with ABSOLUTELY NO WARRANTY. 443s You are welcome to redistribute it under certain conditions. 443s Type 'license()' or 'licence()' for distribution details. 443s 443s R is a collaborative project with many contributors. 443s Type 'contributors()' for more information and 443s 'citation()' on how to cite R or R packages in publications. 443s 443s Type 'demo()' for some demos, 'help()' for on-line help, or 443s 'help.start()' for an HTML browser interface to help. 443s Type 'q()' to quit R. 443s 443s > library("matrixStats") 443s > 443s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 443s > options(matrixStats.center.onUse = "ignore") 443s > options(matrixStats.vars.formula.freq = Inf) 443s > 443s > ## Create isFALSE() if running on an old version of R 443s > if (!exists("isFALSE", mode="function")) { 443s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 443s + } 443s > 443s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 443s + suppressWarnings({ 443s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 443s + }) 443s + stopifnot(!any(is.infinite(res))) 443s + 443s + # Keep naming support consistency same as rowVars() 443s + if (is.null(center) || ncol(x) <= 1L) { 443s + if (isFALSE(useNames)) names(res) <- NULL 443s + } 443s + else if (isFALSE(useNames)) names(res) <- NULL 443s + res 443s + } 443s > 443s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 443s + suppressWarnings({ 443s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 443s + }) 443s + stopifnot(!any(is.infinite(res))) 443s + 443s + # Keep naming support consistency same as colVars() 443s + if (is.null(center) || ncol(x) <= 1L) { 443s + if (isFALSE(useNames)) names(res) <- NULL 443s + } 443s + else if (isFALSE(useNames)) names(res) <- NULL 443s + res 443s + } 443s > 443s > 443s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 443s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 443s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 443s + stopifnot(!any(is.infinite(res))) 443s + res 443s + } 443s > 443s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 443s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 443s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 443s + stopifnot(!any(is.infinite(res))) 443s + res 443s + } 443s > 443s > rowVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = TRUE) { 443s + x <- sweep(x, MARGIN = 1, STATS = as.array(center), FUN = "-") 443s + x[is.infinite(center), ] <- NaN 443s + res <- rowVars(x, rows = rows, cols = cols, center = rep(0, times = nrow(x)), na.rm = na.rm, useNames = useNames) 443s + stopifnot(!any(is.infinite(res))) 443s + res 443s + } 443s > 443s > colVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = TRUE) { 443s + x <- sweep(x, MARGIN = 2, STATS = as.array(center), FUN = "-") 443s + x[, is.infinite(center)] <- NaN 443s + res <- colVars(x, rows = rows, cols = cols, center = rep(0, times = ncol(x)), na.rm = na.rm, useNames = useNames) 443s + stopifnot(!any(is.infinite(res))) 443s + res 443s + } 443s > 443s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 443s > # With and without some NAs or Infs 443s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 443s > for (mode in c("integer", "double")) { 443s + if (mode == "integer") { 443s + specials <- c(0L, NA_integer_) 443s + delta <- 0L 443s + } else { 443s + specials <- c(0, NA_real_, Inf) 443s + delta <- 0.1 443s + } 443s + 443s + for (special in specials) { 443s + cat("special = ", special, "\n", sep = "") 443s + x <- matrix(1:50 + delta, nrow = 10L, ncol = 5L) 443s + x[3:7, c(2, 4)] <- special 443s + cat("mode: ", mode, "\n", sep = "") 443s + str(x) 443s + stopifnot(storage.mode(x) == mode) 443s + 443s + # To check names attribute 443s + dimnames <- list(letters[1:10], LETTERS[1:5]) 443s + 443s + # Test with and without dimnames on x 443s + for (setDimnames in c(TRUE, FALSE)) { 443s + if (setDimnames) dimnames(x) <- dimnames 443s + else dimnames(x) <- NULL 443s + # Row/column variance 443s + for (na.rm in c(FALSE, TRUE)) { 443s + # Check names attribute 443s + for (useNames in c(TRUE, FALSE)) { 443s + cat("na.rm = ", na.rm, "\n", sep = "") 443s + center <- rowMeans(x, na.rm = na.rm) 443s + 443s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 443s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 443s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 443s + r1c <- rowVars(x, center = center, na.rm = na.rm, useNames = useNames) 443s + 443s + tx <- t(x) 443s + r2 <- colVars(tx, na.rm = na.rm, useNames = useNames) 443s + r2b <- colVars_center(tx, na.rm = na.rm, useNames = useNames) 443s + r2c <- colVars(tx, center = center, na.rm = na.rm, useNames = useNames) 443s + tx <- NULL 443s + 443s + stopifnot(all.equal(r1, r2)) 443s + stopifnot(all.equal(r1, r0)) 443s + stopifnot(all.equal(r1b, r1c)) 443s + stopifnot(all.equal(r2, r0)) 443s + stopifnot(all.equal(r2b, r2c)) 443s + 443s + center <- colMeans(x, na.rm = na.rm) 443s + 443s + r3 <- colVars(x, center = center, na.rm = na.rm, useNames = useNames) 443s + r3b <- colVars_center_naive(x, center = center, na.rm = na.rm, useNames = useNames) 443s + r3c <- rowVars(t(x), center = center, na.rm = na.rm, useNames = useNames) 443s + r3d <- rowVars_center_naive(t(x), center = center, na.rm = na.rm, useNames = useNames) 443s + stopifnot(all.equal(r3b, r3)) 443s + stopifnot(all.equal(r3c, r3)) 443s + stopifnot(all.equal(r3d, r3)) 443s + 443s + stopifnot( 443s + !any(is.infinite(r0)), 443s + !any(is.infinite(r1)), 443s + !any(is.infinite(r2)), 443s + !any(is.infinite(r3)), 443s + !any(is.infinite(r1b)), 443s + !any(is.infinite(r1c)), 443s + !any(is.infinite(r2b)), 443s + !any(is.infinite(r2c)), 443s + !any(is.infinite(r3b)), 443s + !any(is.infinite(r3c)), 443s + !any(is.infinite(r3d)) 443s + ) 443s + } 443s + } 443s + } 443s + } # for (special ...) 443s + } 444s special = 0 444s mode: integer 444s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s special = NA 444s mode: integer 444s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s special = 0 444s mode: double 444s 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 ... 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s special = NA 444s mode: double 444s 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 ... 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s special = Inf 444s mode: double 444s 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 ... 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s > 444s > 444s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 444s > # All NAs 444s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 444s > for (mode in c("integer", "double")) { 444s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 444s + cat("mode: ", mode, "\n", sep = "") 444s + storage.mode(x) <- mode 444s + str(x) 444s + 444s + # Test with and without dimnames on x 444s + for (setDimnames in c(TRUE, FALSE)) { 444s + if (setDimnames) dimnames(x) <- dimnames 444s + else dimnames(x) <- NULL 444s + # Row/column variance 444s + for (na.rm in c(FALSE, TRUE)) { 444s + # Check names attribute 444s + for (useNames in c(TRUE, FALSE)) { 444s + cat("na.rm = ", na.rm, "\n", sep = "") 444s + 444s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 444s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 444s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 444s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 444s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 444s + stopifnot(all.equal(r1, r2)) 444s + stopifnot(all.equal(r1, r0)) 444s + stopifnot(all.equal(r2, r0)) 444s + stopifnot(all.equal(r1b, r2b)) 444s + stopifnot( 444s + !any(is.infinite(r0)), 444s + !any(is.infinite(r1)), 444s + !any(is.infinite(r2)), 444s + !any(is.infinite(r1b)), 444s + !any(is.infinite(r2b)) 444s + ) 444s + } 444s + } 444s + } 444s + } 444s mode: integer 444s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s mode: double 444s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s > 444s > 444s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 444s > # A 1x1 matrix 444s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 444s > x <- matrix(0, nrow = 1L, ncol = 1L) 444s > dimnames <- list("a", "A") 444s > # Test with and without dimnames on x 444s > for (setDimnames in c(TRUE, FALSE)) { 444s + if (setDimnames) dimnames(x) <- dimnames 444s + else dimnames(x) <- NULL 444s + # Row/column variance 444s + for (na.rm in c(FALSE, TRUE)) { 444s + # Check names attribute 444s + for (useNames in c(TRUE, FALSE)) { 444s + cat("na.rm = ", na.rm, "\n", sep = "") 444s + 444s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 444s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 444s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 444s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 444s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 444s + stopifnot(all.equal(r1, r2)) 444s + stopifnot(all.equal(r1, r0)) 444s + stopifnot(all.equal(r2, r0)) 444s + stopifnot(all.equal(r1b, r2b)) 444s + stopifnot( 444s + !any(is.infinite(r0)), 444s + !any(is.infinite(r1)), 444s + !any(is.infinite(r2)), 444s + !any(is.infinite(r1b)), 444s + !any(is.infinite(r2b)) 444s + ) 444s + } 444s + } 444s + } 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s na.rm = FALSE 444s na.rm = FALSE 444s na.rm = TRUE 444s na.rm = TRUE 444s > 444s > 444s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 444s > # center and .dim 444s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 444s > m <- matrix(1:12, nrow = 3L, ncol = 4L) 444s > a <- array(m, dim = c(3, 2, 2)) 444s > stopifnot(prod(dim(a)) == prod(dim(m))) 444s > 444s > y0 <- rowVars(m, dim. = dim(m)) 444s > print(y0) 444s [1] 15 15 15 444s > y1 <- rowVars(a, dim. = dim(m)) 444s > print(y1) 444s [1] 15 15 15 444s > stopifnot(identical(y1, y0)) 444s > stopifnot( 444s + !any(is.infinite(y0)), 444s + !any(is.infinite(y1)) 444s + ) 444s > 444s > mu <- rowMeans(m) 444s > y0 <- rowVars(m, center = mu, dim. = dim(m)) 444s > print(y0) 444s [1] 15 15 15 444s > y1 <- rowVars(a, center = mu, dim. = dim(m)) 444s > print(y1) 444s [1] 15 15 15 444s > stopifnot(identical(y1, y0)) 444s > stopifnot( 444s + !any(is.infinite(y0)), 444s + !any(is.infinite(y1)) 444s + ) 444s > 444s > 444s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 444s > # Corner cases 444s > # https://github.com/HenrikBengtsson/matrixStats/issues/195 444s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 444s > x <- matrix(c(1,2,3,4), nrow = 2L, ncol = 2L) 444s > x[1,1] <- NA_real_ 444s > x[1,2] <- Inf 444s > 444s > center <- colMeans2(x, na.rm = TRUE) 444s > y <- colVars(x, center = center, na.rm = TRUE) 444s > stopifnot(!any(is.infinite(y))) 444s > 444s > x <- t(x) 444s > center <- rowMeans2(x, na.rm = TRUE) 444s > y <- rowVars(x, center = center, na.rm = TRUE) 444s > stopifnot(!any(is.infinite(y))) 444s > 444s 444s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 444s Copyright (C) 2025 The R Foundation for Statistical Computing 444s Platform: aarch64-unknown-linux-gnu 444s 444s R is free software and comes with ABSOLUTELY NO WARRANTY. 444s You are welcome to redistribute it under certain conditions. 444s Type 'license()' or 'licence()' for distribution details. 444s 444s R is a collaborative project with many contributors. 444s Type 'contributors()' for more information and 444s 'citation()' on how to cite R or R packages in publications. 444s 444s Type 'demo()' for some demos, 'help()' for on-line help, or 444s 'help.start()' for an HTML browser interface to help. 444s Type 'q()' to quit R. 444s 444s > library("matrixStats") 444s > 444s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 444s > options(matrixStats.center.onUse = "ignore") 444s > 444s > ## Create isFALSE() if running on an old version of R 444s > if (!exists("isFALSE", mode="function")) { 444s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 444s + } 444s > 444s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 444s + suppressWarnings({ 444s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 444s + }) 444s + stopifnot(!any(is.infinite(res))) 444s + 444s + # Keep naming support consistency same as rowVars() 444s + if (is.null(center) || ncol(x) <= 1L) { 444s + if (isFALSE(useNames)) names(res) <- NULL 444s + } 444s + else if (isFALSE(useNames)) names(res) <- NULL 444s + res 444s + } 444s > 444s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 444s + suppressWarnings({ 444s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 444s + }) 444s + stopifnot(!any(is.infinite(res))) 444s + 444s + # Keep naming support consistency same as colVars() 444s + if (is.null(center) || nrow(x) <= 1L) { 444s + if (isFALSE(useNames)) names(res) <- NULL 444s + } 444s + else if (isFALSE(useNames)) names(res) <- NULL 444s + res 444s + } 444s > 444s > 444s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 444s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 444s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 444s + stopifnot(!any(is.infinite(res))) 444s + res 444s + } 444s > 444s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 444s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 444s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 444s + stopifnot(!any(is.infinite(res))) 444s + res 444s + } 444s > 444s > 444s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 444s > # Subsetted tests 444s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 444s > source("utils/validateIndicesFramework.R") 444s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 444s > storage.mode(x) <- "integer" 444s > 444s > # To check names attribute 444s > dimnames <- list(letters[1:6], LETTERS[1:6]) 444s > 444s > # Test with and without dimnames on x 444s > for (setDimnames in c(TRUE, FALSE)) { 444s + if (setDimnames) dimnames(x) <- dimnames 444s + else dimnames(x) <- NULL 444s + 444s + count <- 0L 444s + for (rows in index_cases) { 444s + for (cols in index_cases) { 444s + count <- count + 1L 444s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 444s + useNames <- c(TRUE, FALSE) 444s + useNames <- useNames[count %% length(useNames) + 1] 444s + 444s + validateIndicesTestMatrix(x, rows, cols, 444s + ftest = rowVars, fsure = rowVars_R, 444s + na.rm = na.rm, useNames = useNames) 444s + validateIndicesTestMatrix(x, rows, cols, 444s + ftest = rowVars_center, fsure = rowVars_R, 444s + na.rm = na.rm, center = TRUE, useNames = useNames) 444s + 444s + validateIndicesTestMatrix(x, rows, cols, 444s + fcoltest = colVars, fsure = rowVars_R, 444s + na.rm = na.rm, useNames = useNames) 444s + validateIndicesTestMatrix(x, rows, cols, 444s + fcoltest = colVars_center, fsure = rowVars_R, 444s + na.rm = na.rm, center = TRUE, useNames = useNames) 444s + } 444s + } 444s + } 445s > 445s 445s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 445s Copyright (C) 2025 The R Foundation for Statistical Computing 445s Platform: aarch64-unknown-linux-gnu 445s 445s R is free software and comes with ABSOLUTELY NO WARRANTY. 445s You are welcome to redistribute it under certain conditions. 445s Type 'license()' or 'licence()' for distribution details. 445s 445s R is a collaborative project with many contributors. 445s Type 'contributors()' for more information and 445s 'citation()' on how to cite R or R packages in publications. 445s 445s Type 'demo()' for some demos, 'help()' for on-line help, or 445s 'help.start()' for an HTML browser interface to help. 445s Type 'q()' to quit R. 445s 445s > library("matrixStats") 445s > 445s > ## Create isFALSE() if running on an old version of R 445s > if (!exists("isFALSE", mode="function")) { 445s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 445s + } 445s > 445s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 445s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 445s + 445s + # Keep naming support consistency same as rowWeightedMeans() 445s + idxs <- which(is.na(w) | w != 0) 445s + nw <- length(idxs) 445s + if (na.rm) na.rm <- anyMissing(x) 445s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 445s + if (!useNames) names(res) <- NULL 445s + } 445s + else if (isFALSE(useNames)) names(res) <- NULL 445s + 445s + res 445s + } 445s > 445s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 445s + res <- apply(x, MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 445s + 445s + # Keep naming support consistency same as colWeightedMeans() 445s + idxs <- which(is.na(w) | w != 0) 445s + nw <- length(idxs) 445s + if (!is.null(w) && nw == 0L) { 445s + if (!useNames) names(res) <- NULL 445s + } 445s + else if (isFALSE(useNames)) names(res) <- NULL 445s + 445s + res 445s + } 445s > 445s > set.seed(1) 445s > 445s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 445s > print(x) 445s [,1] [,2] [,3] [,4] 445s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 445s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 445s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 445s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 445s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 445s > 445s > # To check names attribute 445s > dimnames <- list(letters[1:5], LETTERS[1:4]) 445s > 445s > # Non-weighted row averages 445s > x_est0 <- rowMeans(x) 445s > x_est1 <- rowWeightedMeans(x) 445s > print(x_est1) 445s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > x_est2 <- colWeightedMeans(t(x)) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > # Check names attribute 445s > dimnames(x) <- dimnames 445s > x_est1 <- rowWeightedMeans(x, useNames = FALSE) 445s > x_est2 <- colWeightedMeans(t(x), useNames = FALSE) 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > x_est0 <- rowMeans(x) 445s > x_est1 <- rowWeightedMeans(x, useNames = TRUE) 445s > x_est2 <- colWeightedMeans(t(x), useNames = TRUE) 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > dimnames(x) <- NULL 445s > 445s > 445s > # Weighted row averages (uniform weights) 445s > w <- rep(2.5, times = ncol(x)) 445s > x_est0 <- rowMeans(x) 445s > x_est1 <- rowWeightedMeans(x, w = w) 445s > print(x_est1) 445s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > x_est2 <- colWeightedMeans(t(x), w = w) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > # Test with and without dimnames on x 445s > for (setDimnames in c(TRUE, FALSE)) { 445s + if (setDimnames) dimnames(x) <- dimnames 445s + else dimnames(x) <- NULL 445s + # Check names attribute 445s + for (useNames in c(TRUE, FALSE)) { 445s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 445s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 445s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + } 445s + } 445s > 445s > 445s > # Weighted row averages (excluding some columns) 445s > w <- c(1, 1, 0, 1) 445s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 445s > x_est1 <- rowWeightedMeans(x, w = w) 445s > print(x_est1) 445s [1] -0.4972853 0.2182940 0.2821774 0.9974278 0.2060069 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > x_est2 <- colWeightedMeans(t(x), w = w) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > # Test with and without dimnames on x 445s > for (setDimnames in c(TRUE, FALSE)) { 445s + if (setDimnames) dimnames(x) <- dimnames 445s + else dimnames(x) <- NULL 445s + # Check names attribute 445s + for (useNames in c(TRUE, FALSE)) { 445s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 445s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 445s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + } 445s + } 445s > 445s > 445s > # Weighted row averages (excluding some columns) 445s > w <- c(0, 1, 0, 0) 445s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 445s > x_est1 <- rowWeightedMeans(x, w = w) 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > x_est2 <- colWeightedMeans(t(x), w = w) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > # Test with and without dimnames on x 445s > for (setDimnames in c(TRUE, FALSE)) { 445s + if (setDimnames) dimnames(x) <- dimnames 445s + else dimnames(x) <- NULL 445s + # Check names attribute 445s + for (useNames in c(TRUE, FALSE)) { 445s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 445s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 445s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + } 445s + } 445s > 445s > 445s > # Weighted row averages (all zero weights) 445s > w <- c(0, 0, 0, 0) 445s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 445s > x_est1 <- rowWeightedMeans(x, w = w) 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > x_est2 <- colWeightedMeans(t(x), w = w) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > # Test with and without dimnames on x 445s > for (setDimnames in c(TRUE, FALSE)) { 445s + if (setDimnames) dimnames(x) <- dimnames 445s + else dimnames(x) <- NULL 445s + # Check names attribute 445s + for (useNames in c(TRUE, FALSE)) { 445s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 445s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 445s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + } 445s + } 445s > 445s > 445s > # Weighted averages by rows and columns 445s > w <- 1:4 445s > x_est1 <- rowWeightedMeans(x, w = w) 445s > print(x_est1) 445s [1] 0.20882185 0.22632701 0.25526439 -0.06123714 0.54691290 445s > x_est2 <- colWeightedMeans(t(x), w = w) 445s > stopifnot(all.equal(x_est2, x_est1)) 445s > # Test with and without dimnames on x 445s > for (setDimnames in c(TRUE, FALSE)) { 445s + if (setDimnames) dimnames(x) <- dimnames 445s + else dimnames(x) <- NULL 445s + # Check names attribute 445s + for (useNames in c(TRUE, FALSE)) { 445s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 445s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 445s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + } 445s + } 445s > 445s > 445s > x[sample(length(x), size = 0.3 * length(x))] <- NA 445s > print(x) 445s [,1] [,2] [,3] [,4] 445s [1,] -0.6264538 NA 1.5117812 -0.04493361 445s [2,] 0.1836433 NA NA -0.01619026 445s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 445s [4,] 1.5952808 NA -2.2146999 0.82122120 445s [5,] 0.3295078 NA NA 0.59390132 445s > 445s > # Non-weighted row averages with missing values 445s > x_est0 <- rowMeans(x, na.rm = TRUE) 445s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE) 445s > print(x_est1) 445s [1] 0.28013125 0.08372653 0.05632293 0.06726737 0.46170455 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > # Check names attribute 445s > dimnames(x) <- dimnames 445s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = FALSE) 445s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = FALSE) 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > x_est0 <- rowMeans(x, na.rm = TRUE) 445s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = TRUE) 445s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = TRUE) 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > dimnames(x) <- NULL 445s > 445s > 445s > # Weighted row averages with missing values 445s > x_est0 <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = TRUE) 445s > print(x_est0) 445s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 445s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 445s > print(x_est1) 445s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 445s > stopifnot(all.equal(x_est1, x_est0)) 445s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 445s > stopifnot(all.equal(x_est2, x_est0)) 445s > # Test with and without dimnames on x 445s > for (setDimnames in c(TRUE, FALSE)) { 445s + if (setDimnames) dimnames(x) <- dimnames 445s + else dimnames(x) <- NULL 445s + # Check names attribute 445s + for (useNames in c(TRUE, FALSE)) { 445s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 445s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 445s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + } 445s + } 445s > 445s > 445s > # Weighted averages by rows and columns 445s > w <- 1:4 445s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 445s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 445s > stopifnot(all.equal(x_est2, x_est1)) 445s > # Test with and without dimnames on x 445s > for (setDimnames in c(TRUE, FALSE)) { 445s + if (setDimnames) dimnames(x) <- dimnames 445s + else dimnames(x) <- NULL 445s + # Check names attribute 445s + for (useNames in c(TRUE, FALSE)) { 445s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 445s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 445s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + } 445s + } 445s > 445s > 445s > # w contains missing value 445s > w[1] <- NA_integer_ 445s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 445s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 445s > stopifnot(all.equal(x_est2, x_est1)) 445s > # Test with and without dimnames on x 445s > for (setDimnames in c(TRUE, FALSE)) { 445s + if (setDimnames) dimnames(x) <- dimnames 445s + else dimnames(x) <- NULL 445s + # Check names attribute 445s + for (useNames in c(TRUE, FALSE)) { 445s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 445s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 445s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + } 445s + } 445s > 445s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE) 445s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = FALSE) 445s > stopifnot(all.equal(x_est2, x_est1)) 445s > # Test with and without dimnames on x 445s > for (setDimnames in c(TRUE, FALSE)) { 445s + if (setDimnames) dimnames(x) <- dimnames 445s + else dimnames(x) <- NULL 445s + # Check names attribute 445s + for (useNames in c(TRUE, FALSE)) { 445s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = FALSE, useNames = useNames) 445s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = FALSE, useNames = useNames) 445s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = FALSE, useNames = useNames) 445s + stopifnot(all.equal(x_est1, x_est0)) 445s + } 445s + } 445s > 445s 445s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 445s Copyright (C) 2025 The R Foundation for Statistical Computing 445s Platform: aarch64-unknown-linux-gnu 445s 445s R is free software and comes with ABSOLUTELY NO WARRANTY. 445s You are welcome to redistribute it under certain conditions. 445s Type 'license()' or 'licence()' for distribution details. 445s 445s R is a collaborative project with many contributors. 445s Type 'contributors()' for more information and 445s 'citation()' on how to cite R or R packages in publications. 445s 445s Type 'demo()' for some demos, 'help()' for on-line help, or 445s 'help.start()' for an HTML browser interface to help. 445s Type 'q()' to quit R. 445s 445s > library("matrixStats") 445s > 445s > ## Create isFALSE() if running on an old version of R 445s > if (!exists("isFALSE", mode="function")) { 445s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 445s + } 445s > 445s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 445s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 445s + 445s + # Keep naming support consistency same as rowWeightedMeans() 445s + idxs <- which(is.na(w) | w != 0) 445s + nw <- length(idxs) 445s + if (na.rm) na.rm <- anyMissing(x) 445s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 445s + if (!useNames) names(res) <- NULL 445s + } 445s + else if (isFALSE(useNames)) names(res) <- NULL 445s + 445s + res 445s + } 445s > 445s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 445s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 445s + 445s + # Keep naming support consistency same as colWeightedMeans() 445s + idxs <- which(is.na(w) | w != 0) 445s + nw <- length(idxs) 445s + if (!is.null(w) && nw == 0L) { 445s + if (!useNames) names(res) <- NULL 445s + } 445s + else if (isFALSE(useNames)) names(res) <- NULL 445s + 445s + res 445s + } 445s > 445s > 445s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 445s > # Subsetted tests 445s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 445s > source("utils/validateIndicesFramework.R") 445s > # To check names attribute 445s > dimnames <- list(letters[1:6], LETTERS[1:6]) 445s > for (mode in c("numeric", "integer", "logical")) { 445s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 445s + w <- runif(6, min = 0, max = 6) 445s + storage.mode(x) <- mode 445s + storage.mode(w) <- if (mode == "logical") "integer" else mode 445s + if (mode == "numeric") w[1] <- Inf 445s + 445s + # Test with and without dimnames on x 445s + for (setDimnames in c(TRUE, FALSE)) { 445s + if (setDimnames) dimnames(x) <- dimnames 445s + else dimnames(x) <- NULL 445s + 445s + count <- 0L 445s + for (rows in index_cases) { 445s + for (cols in index_cases) { 445s + count <- count + 1L 445s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 445s + useNames <- c(TRUE, FALSE) 445s + useNames <- useNames[count %% length(useNames) + 1] 445s + 445s + validateIndicesTestMatrix_w(x, w, rows, cols, 445s + ftest = rowWeightedMeans, fsure = rowWeightedMeans_R, 445s + na.rm = na.rm, useNames = useNames) 445s + validateIndicesTestMatrix_w(x, w, rows, cols, 445s + fcoltest = colWeightedMeans, fsure = colWeightedMeans_R, 445s + na.rm = na.rm, useNames = useNames) 445s + } 445s + } 445s + } 445s + } 446s > 446s 446s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 446s Copyright (C) 2025 The R Foundation for Statistical Computing 446s Platform: aarch64-unknown-linux-gnu 446s 446s R is free software and comes with ABSOLUTELY NO WARRANTY. 446s You are welcome to redistribute it under certain conditions. 446s Type 'license()' or 'licence()' for distribution details. 446s 446s R is a collaborative project with many contributors. 446s Type 'contributors()' for more information and 446s 'citation()' on how to cite R or R packages in publications. 446s 446s Type 'demo()' for some demos, 'help()' for on-line help, or 446s 'help.start()' for an HTML browser interface to help. 446s Type 'q()' to quit R. 446s 446s > library("matrixStats") 446s > 446s > ## Create isFALSE() if running on an old version of R 446s > if (!exists("isFALSE", mode="function")) { 446s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 446s + } 446s > 446s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 446s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 446s + 446s + # Keep naming support consistency same as rowWeightedMedians() 446s + if (!is.null(w)) { 446s + if (isFALSE(useNames)) names(res) <- NULL 446s + } 446s + else if (!useNames) names(res) <- NULL 446s + 446s + res 446s + } 446s > 446s > colWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 446s + res <- apply(x, MARGIN = 2L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 446s + 446s + # Keep naming support consistency same as colWeightedMedians() 446s + if (!is.null(w)) { 446s + if (isFALSE(useNames)) names(res) <- NULL 446s + } 446s + else if (!useNames) names(res) <- NULL 446s + 446s + res 446s + } 446s > 446s > set.seed(1) 446s > 446s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 446s > print(x) 446s [,1] [,2] [,3] [,4] 446s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 446s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 446s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 446s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 446s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 446s > 446s > # To check names attribute 446s > dimnames <- list(letters[1:5], LETTERS[1:4]) 446s > 446s > # Non-weighted row medians 446s > x_est0 <- rowMedians(x) 446s > x_est1 <- rowWeightedMedians(x) 446s > stopifnot(all.equal(x_est1, x_est0)) 446s > x_est2 <- colWeightedMedians(t(x)) 446s > stopifnot(all.equal(x_est2, x_est0)) 446s > # Test with and without dimnames on x 446s > for (setDimnames in c(TRUE, FALSE)) { 446s + if (setDimnames) dimnames(x) <- dimnames 446s + else dimnames(x) <- NULL 446s + # Check names attribute 446s + for (useNames in c(TRUE, FALSE)) { 446s + x_est0 <- rowMedians(x, useNames = useNames) 446s + x_est1 <- rowWeightedMedians(x, useNames = useNames) 446s + x_est2 <- colWeightedMedians(t(x), useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + stopifnot(all.equal(x_est2, x_est0)) 446s + } 446s + } 446s > 446s > 446s > # Weighted row medians (uniform weights) 446s > w <- rep(2.5, times = ncol(x)) 446s > x_est0 <- rowMedians(x) 446s > x_est1 <- rowWeightedMedians(x, w = w) 446s > stopifnot(all.equal(x_est1, x_est0)) 446s > x_est2 <- colWeightedMedians(t(x), w = w) 446s > stopifnot(all.equal(x_est2, x_est0)) 446s > # Test with and without dimnames on x 446s > for (setDimnames in c(TRUE, FALSE)) { 446s + if (setDimnames) dimnames(x) <- dimnames 446s + else dimnames(x) <- NULL 446s + # Check names attribute 446s + for (useNames in c(TRUE, FALSE)) { 446s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 446s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 446s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + } 446s + } 446s > 446s > 446s > # Weighted row medians (excluding some columns) 446s > w <- c(1, 1, 0, 1) 446s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 446s > x_est1 <- rowWeightedMedians(x, w = w) 446s > stopifnot(all.equal(x_est1, x_est0)) 446s > x_est2 <- colWeightedMedians(t(x), w = w) 446s > stopifnot(all.equal(x_est2, x_est0)) 446s > # Test with and without dimnames on x 446s > for (setDimnames in c(TRUE, FALSE)) { 446s + if (setDimnames) dimnames(x) <- dimnames 446s + else dimnames(x) <- NULL 446s + # Check names attribute 446s + for (useNames in c(TRUE, FALSE)) { 446s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 446s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 446s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + } 446s + } 446s > 446s > # Weighted row medians (excluding some columns) 446s > w <- c(0, 1, 0, 0) 446s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 446s > x_est1 <- rowWeightedMedians(x, w = w) 446s > stopifnot(all.equal(x_est1, x_est0)) 446s > x_est2 <- colWeightedMedians(t(x), w = w) 446s > stopifnot(all.equal(x_est2, x_est0)) 446s > # Test with and without dimnames on x 446s > for (setDimnames in c(TRUE, FALSE)) { 446s + if (setDimnames) dimnames(x) <- dimnames 446s + else dimnames(x) <- NULL 446s + # Check names attribute 446s + for (useNames in c(TRUE, FALSE)) { 446s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 446s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 446s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + } 446s + } 446s > 446s > # Weighted row medians (all zero weights) 446s > w <- c(0, 0, 0, 0) 446s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 446s > x_est1 <- rowWeightedMedians(x, w = w) 446s > stopifnot(all.equal(x_est1, x_est0)) 446s > x_est2 <- colWeightedMedians(t(x), w = w) 446s > stopifnot(all.equal(x_est2, x_est0)) 446s > # Test with and without dimnames on x 446s > for (setDimnames in c(TRUE, FALSE)) { 446s + if (setDimnames) dimnames(x) <- dimnames 446s + else dimnames(x) <- NULL 446s + # Check names attribute 446s + for (useNames in c(TRUE, FALSE)) { 446s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 446s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 446s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + } 446s + } 446s > 446s > # Weighted medians by rows and columns 446s > w <- 1:4 446s > x_est1 <- rowWeightedMedians(x, w = w) 446s > x_est2 <- colWeightedMedians(t(x), w = w) 446s > stopifnot(all.equal(x_est2, x_est1)) 446s > # Test with and without dimnames on x 446s > for (setDimnames in c(TRUE, FALSE)) { 446s + if (setDimnames) dimnames(x) <- dimnames 446s + else dimnames(x) <- NULL 446s + # Check names attribute 446s + for (useNames in c(TRUE, FALSE)) { 446s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 446s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 446s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + } 446s + } 446s > 446s > 446s > # Weighted row medians with missing values 446s > x_est0 <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = TRUE) 446s > print(x_est0) 446s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 446s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 446s > print(x_est1) 446s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 446s > stopifnot(all.equal(x_est1, x_est0)) 446s > x_est2 <- colWeightedMedians(t(x), w = w) 446s > stopifnot(all.equal(x_est2, x_est0)) 446s > # Test with and without dimnames on x 446s > for (setDimnames in c(TRUE, FALSE)) { 446s + if (setDimnames) dimnames(x) <- dimnames 446s + else dimnames(x) <- NULL 446s + # Check names attribute 446s + for (useNames in c(TRUE, FALSE)) { 446s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 446s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 446s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + } 446s + } 446s > 446s > # Weighted medians by rows and columns 446s > w <- 1:4 446s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 446s > x_est2 <- colWeightedMedians(t(x), w = w, na.rm = TRUE) 446s > stopifnot(all.equal(x_est2, x_est1)) 446s > # Test with and without dimnames on x 446s > for (setDimnames in c(TRUE, FALSE)) { 446s + if (setDimnames) dimnames(x) <- dimnames 446s + else dimnames(x) <- NULL 446s + # Check names attribute 446s + for (useNames in c(TRUE, FALSE)) { 446s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 446s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 446s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + } 446s + } 446s > 446s > 446s > # Inf weight 446s > x <- matrix(1:2, nrow = 1, ncol = 2) 446s > w <- c(7, Inf) 446s > x_est1 <- rowWeightedMedians(x, w = w) 446s > x_est2 <- colWeightedMedians(t(x), w = w) 446s > stopifnot(identical(2, x_est1)) 446s > stopifnot(identical(2, x_est2)) 446s > # Test with and without dimnames on x 446s > dimnames <- list("a", LETTERS[1:2]) 446s > for (setDimnames in c(TRUE, FALSE)) { 446s + if (setDimnames) dimnames(x) <- dimnames 446s + else dimnames(x) <- NULL 446s + # Check names attribute 446s + for (useNames in c(TRUE, FALSE)) { 446s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 446s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 446s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 446s + stopifnot(all.equal(x_est1, x_est0)) 446s + } 446s + } 447s > 447s 447s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 447s Copyright (C) 2025 The R Foundation for Statistical Computing 447s Platform: aarch64-unknown-linux-gnu 447s 447s R is free software and comes with ABSOLUTELY NO WARRANTY. 447s You are welcome to redistribute it under certain conditions. 447s Type 'license()' or 'licence()' for distribution details. 447s 447s R is a collaborative project with many contributors. 447s Type 'contributors()' for more information and 447s 'citation()' on how to cite R or R packages in publications. 447s 447s Type 'demo()' for some demos, 'help()' for on-line help, or 447s 'help.start()' for an HTML browser interface to help. 447s Type 'q()' to quit R. 447s 447s > library("matrixStats") 447s > 447s > ## Create isFALSE() if running on an old version of R 447s > if (!exists("isFALSE", mode="function")) { 447s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 447s + } 447s > 447s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 447s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 447s + 447s + # Keep naming support consistency same as rowWeightedMedians() 447s + if (!is.null(w)) { 447s + if (isFALSE(useNames)) names(res) <- NULL 447s + } 447s + else if (!useNames) names(res) <- NULL 447s + 447s + res 447s + } 447s > 447s > 447s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 447s > # Subsetted tests 447s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 447s > source("utils/validateIndicesFramework.R") 447s > # To check names attribute 447s > dimnames <- list(letters[1:6], LETTERS[1:6]) 447s > for (mode in c("numeric", "integer", "logical")) { 447s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 447s + w <- runif(6, min = 0, max = 6) 447s + storage.mode(x) <- mode 447s + storage.mode(w) <- if (mode == "logical") "integer" else mode 447s + if (mode == "numeric") w[1] <- Inf 447s + 447s + # Test with and without dimnames on x 447s + for (setDimnames in c(TRUE, FALSE)) { 447s + if (setDimnames) dimnames(x) <- dimnames 447s + else dimnames(x) <- NULL 447s + 447s + count <- 0L 447s + for (rows in index_cases) { 447s + for (cols in index_cases) { 447s + count <- count + 1L 447s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 447s + useNames <- c(TRUE, FALSE) 447s + useNames <- useNames[count %% length(useNames) + 1] 447s + 447s + validateIndicesTestMatrix_w(x, w, rows, cols, 447s + ftest = rowWeightedMedians, 447s + fsure = rowWeightedMedians_R, 447s + na.rm = na.rm, useNames = useNames) 447s + validateIndicesTestMatrix_w(x, w, rows, cols, 447s + fcoltest = colWeightedMedians, 447s + fsure = rowWeightedMedians_R, 447s + na.rm = na.rm, useNames = useNames) 447s + } 447s + } 447s + } 447s + } 448s > 448s 448s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 448s Copyright (C) 2025 The R Foundation for Statistical Computing 448s Platform: aarch64-unknown-linux-gnu 448s 448s R is free software and comes with ABSOLUTELY NO WARRANTY. 448s You are welcome to redistribute it under certain conditions. 448s Type 'license()' or 'licence()' for distribution details. 448s 448s R is a collaborative project with many contributors. 448s Type 'contributors()' for more information and 448s 'citation()' on how to cite R or R packages in publications. 448s 448s Type 'demo()' for some demos, 'help()' for on-line help, or 448s 'help.start()' for an HTML browser interface to help. 448s Type 'q()' to quit R. 448s 448s > library("matrixStats") 448s > 448s > set.seed(1) 448s > 448s > x <- matrix(rnorm(20), nrow = 5L, ncol = 4L) 448s > print(x) 448s [,1] [,2] [,3] [,4] 448s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 448s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 448s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 448s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 448s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 448s > 448s > # To check names attribute 448s > dimnames <- list(letters[1:5], LETTERS[1:4]) 448s > 448s > # Weighted row variances (uniform weights - all w = 1) 448s > # Non-weighted row variances 448s > x_est0 <- rowVars(x) 448s > w <- rep(1, times = ncol(x)) 448s > x_est1 <- rowWeightedVars(x, w = w) 448s > print(x_est1) 448s [1] 1.11767161 0.05022969 0.83582537 2.76819528 0.35351857 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > x_est2 <- colWeightedVars(t(x), w = w) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > # Check names attribute 448s > dimnames(x) <- dimnames 448s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 448s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > x_est0 <- rowVars(x, useNames = TRUE) 448s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 448s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > dimnames(x) <- NULL 448s > 448s > 448s > # Weighted row variances (uniform weights - all w = 3) 448s > x3 <- cbind(x, x, x) 448s > x_est0 <- rowVars(x3) 448s > w <- rep(3, times = ncol(x)) 448s > x_est1 <- rowWeightedVars(x, w = w) 448s > print(x_est1) 448s [1] 0.91445859 0.04109702 0.68385712 2.26488705 0.28924246 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > x_est2 <- colWeightedVars(t(x), w = w) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > # Check names attribute 448s > dimnames(x) <- dimnames 448s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 448s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > x3 <- cbind(x, x, x) 448s > x_est0 <- rowVars(x3, useNames = TRUE) 448s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 448s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > dimnames(x) <- NULL 448s > 448s > 448s > # Weighted row variances (excluding some columns) 448s > w <- c(1, 1, 0, 1) 448s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 448s > x_est1 <- rowWeightedVars(x, w = w) 448s > print(x_est1) 448s [1] 0.16287693 0.06430861 0.94767651 0.28313135 0.21361984 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > x_est2 <- colWeightedVars(t(x), w = w) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > # Check names attribute 448s > dimnames(x) <- dimnames 448s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 448s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 448s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 448s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > dimnames(x) <- NULL 448s > 448s > 448s > # Weighted row variances (excluding some columns) 448s > w <- c(0, 1, 0, 0) 448s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 448s > x_est1 <- rowWeightedVars(x, w = w) 448s > #stopifnot(all.equal(x_est1, x_est0)) 448s > x_est2 <- colWeightedVars(t(x), w = w) 448s > stopifnot(all.equal(x_est2, x_est1)) 448s > # Check names attribute 448s > dimnames(x) <- dimnames 448s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 448s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 448s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 448s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > dimnames(x) <- NULL 448s > 448s > 448s > # Weighted row variances (all zero weights) 448s > w <- c(0, 0, 0, 0) 448s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 448s > x_est1 <- rowWeightedVars(x, w = w) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > x_est2 <- colWeightedVars(t(x), w = w) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > # Check names attribute 448s > dimnames(x) <- dimnames 448s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 448s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 448s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 448s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > dimnames(x) <- NULL 448s > 448s > # Weighted variances by rows and columns 448s > w <- 1:4 448s > # Test with and without dimnames on x 448s > for (setDimnames in c(TRUE, FALSE)) { 448s + if (setDimnames) dimnames(x) <- dimnames 448s + else dimnames(x) <- NULL 448s + # Check names attribute 448s + for (useNames in c(TRUE, FALSE)) { 448s + x_est1 <- rowWeightedVars(x, w = w, useNames = useNames) 448s + print(x_est1) 448s + x_est2 <- colWeightedVars(t(x), w = w, useNames = useNames) 448s + stopifnot(all.equal(x_est2, x_est1)) 448s + } 448s + } 448s a b c d e 448s 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 448s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 448s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 448s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 448s > 448s > 448s > x[sample(length(x), size = 0.3 * length(x))] <- NA 448s > print(x) 448s [,1] [,2] [,3] [,4] 448s [1,] -0.6264538 NA 1.5117812 -0.04493361 448s [2,] 0.1836433 NA NA -0.01619026 448s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 448s [4,] 1.5952808 NA -2.2146999 0.82122120 448s [5,] 0.3295078 NA NA 0.59390132 448s > 448s > # Non-weighted row variances with missing values 448s > x_est0 <- rowVars(x, na.rm = TRUE) 448s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE) 448s > print(x_est1) 448s [1] 1.22226258 0.01996673 0.83582537 4.05532299 0.03495197 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > # Check names attribute 448s > dimnames(x) <- dimnames 448s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 448s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > x_est0 <- rowVars(x, na.rm = TRUE, useNames = TRUE) 448s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 448s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > dimnames(x) <- NULL 448s > 448s > 448s > # Weighted row variances with missing values 448s > # Test with and without dimnames on x 448s > for (setDimnames in c(TRUE, FALSE)) { 448s + if (setDimnames) dimnames(x) <- dimnames 448s + else dimnames(x) <- NULL 448s + # Check names attribute 448s + for (useNames in c(TRUE, FALSE)) { 448s + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 448s + print(x_est1) 448s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 448s + stopifnot(all.equal(x_est2, x_est1)) 448s + } 448s + } 448s a b c d e 448s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 448s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 448s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 448s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 448s > 448s > 448s > # Weighted variances by rows and columns 448s > w <- 1:4 448s > # Test with and without dimnames on x 448s > for (setDimnames in c(TRUE, FALSE)) { 448s + if (setDimnames) dimnames(x) <- dimnames 448s + else dimnames(x) <- NULL 448s + # Check names attribute 448s + for (useNames in c(TRUE, FALSE)) { 448s + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 448s + print(x_est1) 448s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 448s + stopifnot(all.equal(x_est2, x_est1)) 448s + } 448s + } 448s a b c d e 448s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 448s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 448s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 448s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 448s > 448s > 448s > # Weighted row standard deviation (excluding some columns) 448s > w <- c(1, 1, 0, 1) 448s > ## FIXME: rowVars()/rowSds() needs na.rm = FALSE (wrong default) 448s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE) 448s > x_est1 <- rowWeightedSds(x, w = w) 448s > print(x_est1) 448s [1] NA NA 0.9734868 NA NA 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > # Check names attribute 448s > dimnames(x) <- dimnames 448s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = FALSE) 448s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = FALSE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE, useNames = TRUE) 448s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = TRUE) 448s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = TRUE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > dimnames(x) <- NULL 448s > 448s > 448s > # Weighted row MADs (excluding some columns) 448s > w <- c(1, 1, 0, 1) 448s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE]) 448s > x_est1 <- rowWeightedMads(x, w = w) 448s > print(x_est1) 448s [1] NA NA 0.3046914 NA NA 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > x_est2 <- colWeightedMads(t(x), w = w) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > # Check names attribute 448s > dimnames(x) <- dimnames 448s > x_est1 <- rowWeightedMads(x, w = w, useNames = FALSE) 448s > x_est2 <- colWeightedMads(t(x), w = w, useNames = FALSE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE], useNames = TRUE) 448s > x_est1 <- rowWeightedMads(x, w = w, useNames = TRUE) 448s > x_est2 <- colWeightedMads(t(x), w = w, useNames = TRUE) 448s > stopifnot(all.equal(x_est1, x_est0)) 448s > stopifnot(all.equal(x_est2, x_est0)) 448s > dimnames(x) <- NULL 448s > 448s 448s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 448s Copyright (C) 2025 The R Foundation for Statistical Computing 448s Platform: aarch64-unknown-linux-gnu 448s 448s R is free software and comes with ABSOLUTELY NO WARRANTY. 448s You are welcome to redistribute it under certain conditions. 448s Type 'license()' or 'licence()' for distribution details. 448s 448s R is a collaborative project with many contributors. 448s Type 'contributors()' for more information and 448s 'citation()' on how to cite R or R packages in publications. 448s 448s Type 'demo()' for some demos, 'help()' for on-line help, or 448s 'help.start()' for an HTML browser interface to help. 448s Type 'q()' to quit R. 448s 448s > library("matrixStats") 448s > 448s > fcns <- list( 448s + weightedVar = c(rowWeightedVars, colWeightedVars), 448s + weightedSd = c(rowWeightedSds, colWeightedSds), 448s + weightedMad = c(rowWeightedMads, colWeightedMads) 448s + ) 448s > 448s > 448s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 448s > # Subsetted tests 448s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 448s > source("utils/validateIndicesFramework.R") 448s > # To check names attribute 448s > dimnames <- list(letters[1:6], LETTERS[1:6]) 448s > for (fcn in names(fcns)) { 448s + cat(sprintf("subsetted tests on matrix %s()...\n", fcn)) 448s + row_fcn <- fcns[[fcn]][[1]] 448s + col_fcn <- fcns[[fcn]][[2]] 448s + 448s + for (mode in c("numeric", "integer")) { 448s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 448s + w <- runif(6, min = 0, max = 6) 448s + storage.mode(x) <- mode 448s + storage.mode(w) <- mode 448s + if (mode == "numeric") w[1] <- Inf 448s + 448s + # Test with and without dimnames on x 448s + for (setDimnames in c(TRUE, FALSE)) { 448s + if (setDimnames) dimnames(x) <- dimnames 448s + else dimnames(x) <- NULL 448s + 448s + count <- 0L 448s + for (rows in index_cases) { 448s + for (cols in index_cases) { 448s + count <- count + 1L 448s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 448s + useNames <- c(TRUE, FALSE) 448s + useNames <- useNames[count %% length(useNames) + 1] 448s + 448s + validateIndicesTestMatrix_w(x, w, rows, cols, 448s + ftest = row_fcn, fsure = row_fcn, 448s + na.rm = na.rm, useNames = useNames) 448s + validateIndicesTestMatrix_w(x, w, rows, cols, 448s + fcoltest = col_fcn, fsure = row_fcn, 448s + na.rm = na.rm, useNames = useNames) 448s + } 448s + } 448s + } 448s + } 448s + cat(sprintf("%s()...DONE\n", fcn)) 448s + } 448s subsetted tests on matrix weightedVar()... 449s weightedVar()...DONE 449s subsetted tests on matrix weightedSd()... 450s weightedSd()...DONE 450s subsetted tests on matrix weightedMad()... 450s weightedMad()...DONE 450s > 450s 450s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 450s Copyright (C) 2025 The R Foundation for Statistical Computing 450s Platform: aarch64-unknown-linux-gnu 450s 450s R is free software and comes with ABSOLUTELY NO WARRANTY. 450s You are welcome to redistribute it under certain conditions. 450s Type 'license()' or 'licence()' for distribution details. 450s 450s R is a collaborative project with many contributors. 450s Type 'contributors()' for more information and 450s 'citation()' on how to cite R or R packages in publications. 450s 450s Type 'demo()' for some demos, 'help()' for on-line help, or 450s 'help.start()' for an HTML browser interface to help. 450s Type 'q()' to quit R. 450s 450s > library("matrixStats") 450s > 450s > signTabulate0 <- function(x, ...) { 450s + nneg <- sum(x < 0, na.rm = TRUE) 450s + nzero <- sum(x == 0, na.rm = TRUE) 450s + npos <- sum(x > 0, na.rm = TRUE) 450s + nna <- sum(is.na(x)) 450s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 450s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 450s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 450s + res <- as.double(res) 450s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 450s + if (is.integer(x)) res <- res[1:4] 450s + res 450s Doubles: 450s + } # signTabulate0() 450s > 450s > 450s > # Simulate data 450s > set.seed(0xBEEF) 450s > n <- 100L 450s > x <- runif(n) 450s > x[sample(n, size = 0.1 * n)] <- 0 450s > x[sample(n, size = 0.1 * n)] <- NA_real_ 450s > x[sample(n, size = 0.1 * n)] <- -Inf 450s > x[sample(n, size = 0.1 * n)] <- +Inf 450s > 450s > # Doubles 450s > message("Doubles:") 450s > counts0 <- signTabulate0(x) 450s > print(counts0) 450s -1 0 +1 NA -Inf +Inf 450s 9 7 77 7 9 10 450s > counts1 <- signTabulate(x) 450s > print(counts1) 450s -1 0 +1 NA -Inf +Inf 450s 9 7 77 7 9 10 450s > stopifnot(identical(counts1, counts0)) 450s > 450s > # Integers 450s > message("Integers:") 450s Integers: 450s > x <- suppressWarnings(as.integer(x)) 450s > counts0 <- signTabulate0(x) 450s > print(counts0) 450s -1 0 +1 NA 450s 0 74 0 26 450s > counts1 <- signTabulate(x) 450s > print(counts1) 450s -1 0 +1 NA 450s 0 74 0 26 450s > stopifnot(identical(counts1, counts0)) 450s > 450s 450s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 450s Copyright (C) 2025 The R Foundation for Statistical Computing 450s Platform: aarch64-unknown-linux-gnu 450s 450s R is free software and comes with ABSOLUTELY NO WARRANTY. 450s You are welcome to redistribute it under certain conditions. 450s Type 'license()' or 'licence()' for distribution details. 450s 450s R is a collaborative project with many contributors. 450s Type 'contributors()' for more information and 450s 'citation()' on how to cite R or R packages in publications. 450s 450s Type 'demo()' for some demos, 'help()' for on-line help, or 450s 'help.start()' for an HTML browser interface to help. 450s Type 'q()' to quit R. 450s 451s > library("matrixStats") 451s > 451s > signTabulate0 <- function(x, ...) { 451s + nneg <- sum(x < 0, na.rm = TRUE) 451s + nzero <- sum(x == 0, na.rm = TRUE) 451s + npos <- sum(x > 0, na.rm = TRUE) 451s + nna <- sum(is.na(x)) 451s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 451s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 451s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 451s + res <- as.double(res) 451s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 451s + if (is.integer(x)) res <- res[1:4] 451s + res 451s + } # signTabulate0() 451s > 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # Subsetted tests 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > source("utils/validateIndicesFramework.R") 451s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 451s > x[2:3, 4:5] <- +Inf 451s > x[4:5, 1:2] <- -Inf 451s > for (idxs in index_cases) { 451s + validateIndicesTestVector(x, idxs, 451s + ftest = signTabulate, fsure = signTabulate0) 451s + } 451s > 451s 451s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 451s Copyright (C) 2025 The R Foundation for Statistical Computing 451s Platform: aarch64-unknown-linux-gnu 451s 451s R is free software and comes with ABSOLUTELY NO WARRANTY. 451s You are welcome to redistribute it under certain conditions. 451s Type 'license()' or 'licence()' for distribution details. 451s 451s R is a collaborative project with many contributors. 451s Type 'contributors()' for more information and 451s 'citation()' on how to cite R or R packages in publications. 451s 451s Type 'demo()' for some demos, 'help()' for on-line help, or 451s 'help.start()' for an HTML browser interface to help. 451s Type 'q()' to quit R. 451s 451s > library("matrixStats") 451s > options(warn = 1) 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # Consistency checks 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > set.seed(1) 451s > 451s > sum2_R <- function(x, na.rm = FALSE, idxs = NULL) { 451s + if (is.null(idxs)) { 451s + sum(x, na.rm = na.rm) 451s + } else { 451s + sum(x[idxs], na.rm = na.rm) 451s + } 451s + } # sum2_R() 451s > 451s > 451s > cat("Consistency checks:\n") 451s Consistency checks: 451s > for (kk in 1:20) { 451s + cat("Random test #", kk, "\n", sep = "") 451s + 451s + # Simulate data in a matrix of any shape 451s + n <- sample(1e3, size = 1L) 451s + x <- rnorm(n, sd = 100) 451s + 451s + # Add NAs? 451s + if ((kk %% 4) %in% c(3, 0)) { 451s + cat("Adding NAs\n") 451s + nna <- sample(n, size = 1L) 451s + na_values <- c(NA_real_, NaN) 451s + t <- sample(na_values, size = nna, replace = TRUE) 451s + x[sample(length(x), size = nna)] <- t 451s + } 451s + 451s + # Integer or double? 451s + if ((kk %% 4) %in% c(2, 0)) { 451s + cat("Coercing to integers\n") 451s + storage.mode(x) <- "integer" 451s + } 451s + 451s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 451s + 451s + # Sum over all 451s + y0 <- sum2_R(x, na.rm = na.rm) 451s + y1 <- sum2(x, na.rm = na.rm) 451s + stopifnot(all.equal(y1, y0)) 451s + 451s + # Sum over subset 451s + nidxs <- sample(n, size = 1L) 451s + idxs <- sample(n, size = nidxs) 451s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 451s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 451s + stopifnot(all.equal(y1, y0)) 451s + 451s + if (storage.mode(x) == "integer") { 451s + storage.mode(x) <- "logical" 451s + 451s + y0 <- sum2_R(x, na.rm = na.rm) 451s + y1 <- sum2(x, na.rm = na.rm) 451s + stopifnot(all.equal(y1, y0)) 451s + 451s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 451s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 451s + stopifnot(all.equal(y1, y0)) 451s + } 451s + } # for (kk ...) 451s Random test #1 451s Random test #2 451s Coercing to integers 451s Random test #3 451s Adding NAs 451s Random test #4 451s Adding NAs 451s Coercing to integers 451s Random test #5 451s Random test #6 451s Coercing to integers 451s Random test #7 451s Adding NAs 451s Random test #8 451s Adding NAs 451s Coercing to integers 451s Random test #9 451s Random test #10 451s Coercing to integers 451s Random test #11 451s Adding NAs 451s Random test #12 451s Adding NAs 451s Coercing to integers 451s Random test #13 451s Random test #14 451s Coercing to integers 451s Random test #15 451s Adding NAs 451s Random test #16 451s Adding NAs 451s Coercing to integers 451s Random test #17 451s Random test #18 451s Coercing to integers 451s Random test #19 451s Adding NAs 451s Random test #20 451s Adding NAs 451s Coercing to integers 451s > 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # All missing values 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > for (n in 0:2) { 451s + for (na.rm in c(FALSE, TRUE)) { 451s + x <- rep(NA_real_, times = n) 451s + y0 <- sum(x, na.rm = na.rm) 451s + y <- sum2(x, na.rm = na.rm) 451s + stopifnot(all.equal(y, y0)) 451s + 451s + x <- rep(NA_integer_, times = n) 451s + y0 <- sum(x, na.rm = na.rm) 451s + y <- sum2(x, na.rm = na.rm) 451s + stopifnot(all.equal(y, y0)) 451s + 451s + x <- rep(NA, times = n) 451s + y0 <- sum(x, na.rm = na.rm) 451s + y <- sum2(x, na.rm = na.rm) 451s + stopifnot(all.equal(y, y0)) 451s + } 451s + } 451s > 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # Special cases 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > for (na.rm in c(FALSE, TRUE)) { 451s + # Summing over zero elements (integers) 451s + x <- integer(0) 451s + s1 <- sum(x, na.rm = na.rm) 451s + s2 <- sum2(x, na.rm = na.rm) 451s + stopifnot(identical(s1, s2)) 451s + 451s + x <- 1:10 451s + idxs <- integer(0) 451s + s1 <- sum(x[idxs], na.rm = na.rm) 451s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 451s + stopifnot(identical(s1, s2)) 451s + 451s + # Summing over NA_integer_:s 451s + x <- rep(NA_integer_, times = 10L) 451s + s1 <- sum(x, na.rm = na.rm) 451s + s2 <- sum2(x, na.rm = na.rm) 451s + stopifnot(identical(s1, s2)) 451s + 451s + x <- rep(NA_integer_, times = 10L) 451s + idxs <- 1:5 451s + s1 <- sum(x[idxs], na.rm = na.rm) 451s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 451s + stopifnot(identical(s1, s2)) 451s + 451s + 451s + # Summing over zero elements (doubles) 451s + x <- double(0) 451s + s1 <- sum(x) 451s + s2 <- sum2(x) 451s + stopifnot( 451s + identical(s1, 0), 451s + identical(s1, s2) 451s + ) 451s + 451s + x <- as.double(1:10) 451s + idxs <- integer(0) 451s + s1 <- sum(x[idxs]) 451s + s2 <- sum2(x, idxs = idxs) 451s + stopifnot( 451s + identical(s1, 0), 451s + identical(s1, s2) 451s + ) 451s + 451s + # Summing over NA_real_:s 451s + x <- rep(NA_real_, times = 10L) 451s + s1 <- sum(x, na.rm = na.rm) 451s + s2 <- sum2(x, na.rm = na.rm) 451s + stopifnot( 451s + !na.rm || s1 == 0, 451s + identical(s1, s2) 451s + ) 451s + 451s + x <- rep(NA_real_, times = 10L) 451s + idxs <- 1:5 451s + s1 <- sum(x[idxs], na.rm = na.rm) 451s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 451s + stopifnot( 451s + !na.rm || s1 == 0, 451s + identical(s1, s2) 451s + ) 451s + 451s + # Summing over -Inf:s 451s + x <- rep(-Inf, times = 3L) 451s + s1 <- sum(x, na.rm = na.rm) 451s + s2 <- sum2(x, na.rm = na.rm) 451s + stopifnot( 451s + is.infinite(s1) && s1 < 0, 451s + identical(s1, s2) 451s + ) 451s + 451s + # Summing over +Inf:s 451s + x <- rep(+Inf, times = 3L) 451s + s1 <- sum(x, na.rm = na.rm) 451s + s2 <- sum2(x, na.rm = na.rm) 451s + stopifnot(identical(s1, s2)) 451s + stopifnot( 451s + is.infinite(s1) && s1 > 0, 451s + identical(s1, s2) 451s + ) 451s + 451s + # Summing over mix of -Inf:s and +Inf:s 451s + x <- rep(c(-Inf, +Inf), times = 3L) 451s + s1 <- sum(x, na.rm = na.rm) 451s + s2 <- sum2(x, na.rm = na.rm) 451s + stopifnot( 451s + is.nan(s1), 451s + identical(s1, s2) 451s + ) 451s + 451s + # Summing over mix of -Inf:s and +Inf:s and numerics 451s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 451s + s1 <- sum(x, na.rm = na.rm) 451s + s2 <- sum2(x, na.rm = na.rm) 451s + stopifnot( 451s + is.nan(s1), 451s + identical(s1, s2) 451s + ) 451s + 451s + # Summing over mix of NaN, NA, +Inf, and numerics 451s + x <- c(NaN, NA, +Inf, 3.14) 451s + s1 <- sum(x, na.rm = na.rm) 451s + s2 <- sum2(x, na.rm = na.rm) 451s + if (na.rm) { 451s + stopifnot( 451s + is.infinite(s1) && s1 > 0, 451s + identical(s2, s1) 451s + ) 451s + } else { 451s + stopifnot(is.na(s1), is.na(s2)) 451s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 451s + ## returned here (as one would expect). NaN might very well be returned, 451s + ## when both NA and NaN are involved. This is an accepted feature in R, 451s + ## which is documented in help("is.nan"). See also 451s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 451s + ## Thus, we cannot guarantee that s1 is identical to s0. 451s + } 451s + 451s + # Summing over mix of NaN, NA, +Inf, and numerics 451s + x <- c(NA, NaN, +Inf, 3.14) 451s + s1 <- sum(x, na.rm = na.rm) 451s + s2 <- sum2(x, na.rm = na.rm) 451s + if (na.rm) { 451s + stopifnot( 451s + is.infinite(s1) && s1 > 0, 451s + identical(s2, s1) 451s + ) 451s + } else { 451s + stopifnot(is.na(s1), is.na(s2)) 451s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 451s + ## returned here (as one would expect). NaN might very well be returned, 451s + ## when both NA and NaN are involved. This is an accepted feature in R, 451s + ## which is documented in help("is.nan"). See also 451s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 451s + ## Thus, we cannot guarantee that s1 is identical to s0. 451s + } 451s + } 451s > 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # Summing of large integers 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > x <- c(.Machine$integer.max, 1L, -.Machine$integer.max) 451s > 451s > # Total gives integer overflow 451s > s1 <- sum(x[1:2]) # NA_integer_ w/ warning 451s > s2 <- sum2(x[1:2]) # NA_integer_ w/ warning 451s > stopifnot( 451s + identical(s2, NA_integer_) 451s + ) 451s > 451s > ## Assert above warning 451s > res <- tryCatch({ 451s Warning in sum2(x[1:2]) : 451s Integer overflow. Use sum2(..., mode = "double") to avoid this. 451s + s2 <- sum2(x[1:2]) 451s + }, warning = identity) 451s > stopifnot(inherits(res, "warning")) 451s > 451s > 451s > # Total gives integer overflow (coerce to numeric) 451s > s1 <- sum(as.numeric(x[1:2])) # 2147483648 451s > s2 <- sum2(as.numeric(x[1:2])) # 2147483648 451s > s3 <- sum2(x[1:2], mode = "double") # 2147483648 451s > stopifnot( 451s + identical(s1, 2147483648), 451s + identical(s1, s2), 451s + identical(s1, s3) 451s + ) 451s > 451s > # Cumulative sum would give integer overflow but not the total 451s > s1 <- sum(x) # 1L 451s > s2 <- sum2(x) # 1L 451s > stopifnot( 451s + Warning in sum2(x, mode = "integer") : 451s sum2(x, mode = "integer") called with typeof(x) == "double"; did you mean to use as.integer(sum2(x))? 451s identical(s1, 1L), 451s + identical(s1, s2) 451s + ) 451s > 451s > # Input is double but coercing result to integer 451s > x <- c(1, 2, 3.1) 451s > s1 <- sum2(x) 451s > s2 <- sum2(x, mode = "integer") 451s > stopifnot( 451s + identical(as.integer(s1), s2) 451s + ) 451s > 451s > ## Assert above warning 451s > res <- tryCatch({ 451s + s2 <- sum2(x, mode = "integer") 451s + }, warning = identity) 451s > stopifnot(inherits(res, "warning")) 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # Summing of large doubles 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > ## Double overflow 451s > x <- rep(.Machine$double.xmax, times = 2L) 451s > y0 <- sum(x) 451s > print(y0) 451s [1] Inf 451s > y <- sum2(x) 451s > print(y) 451s [1] Inf 451s > stopifnot( 451s + is.infinite(y) && y > 0, 451s + identical(y, y0) 451s + ) 451s > 451s > x <- rep(-.Machine$double.xmax, times = 2L) 451s > y0 <- sum(x) 451s > print(y0) 451s [1] -Inf 451s > y <- sum2(x) 451s > print(y) 451s [1] -Inf 451s > stopifnot( 451s + is.infinite(y) && y < 0, 451s + identical(y, y0) 451s + ) 451s > 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # Argument 'idxs' 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > x <- 1:10 451s > idxs_list <- list( 451s + integer = 1:5, 451s + double = as.double(1:5), 451s + logical = (x <= 5) 451s + ) 451s > 451s > for (idxs in idxs_list) { 451s + cat("idxs:\n") 451s + str(idxs) 451s + s1 <- sum(x[idxs], na.rm = TRUE) 451s + s2 <- sum2(x, idxs = idxs, na.rm = TRUE) 451s + stopifnot(identical(s1, s2)) 451s + } 451s idxs: 451s int [1:5] 1 2 3 4 5 451s idxs: 451s num [1:5] 1 2 3 4 5 451s idxs: 451s logi [1:10] TRUE TRUE TRUE TRUE TRUE FALSE ... 451s > 451s 451s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 451s Copyright (C) 2025 The R Foundation for Statistical Computing 451s Platform: aarch64-unknown-linux-gnu 451s 451s R is free software and comes with ABSOLUTELY NO WARRANTY. 451s You are welcome to redistribute it under certain conditions. 451s Type 'license()' or 'licence()' for distribution details. 451s 451s R is a collaborative project with many contributors. 451s Type 'contributors()' for more information and 451s 'citation()' on how to cite R or R packages in publications. 451s 451s Type 'demo()' for some demos, 'help()' for on-line help, or 451s 'help.start()' for an HTML browser interface to help. 451s Type 'q()' to quit R. 451s 451s > library("matrixStats") 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # Subsetted tests 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > source("utils/validateIndicesFramework.R") 451s > x <- runif(6, min = -6, max = 6) 451s > storage.mode(x) <- "integer" 451s > for (idxs in index_cases) { 451s + validateIndicesTestVector(x, idxs, 451s + ftest = sum2, fsure = sum, 451s + na.rm = FALSE) 451s + validateIndicesTestVector(x, idxs, 451s + ftest = sum2, fsure = sum, 451s + na.rm = TRUE) 451s + } 451s > 451s 451s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 451s Copyright (C) 2025 The R Foundation for Statistical Computing 451s Platform: aarch64-unknown-linux-gnu 451s 451s R is free software and comes with ABSOLUTELY NO WARRANTY. 451s You are welcome to redistribute it under certain conditions. 451s Type 'license()' or 'licence()' for distribution details. 451s 451s R is a collaborative project with many contributors. 451s Type 'contributors()' for more information and 451s 'citation()' on how to cite R or R packages in publications. 451s 451s Type 'demo()' for some demos, 'help()' for on-line help, or 451s 'help.start()' for an HTML browser interface to help. 451s Type 'q()' to quit R. 451s 451s > library("matrixStats") 451s > 451s > set.seed(1) 451s > x <- rnorm(1e4) 451s > 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # Variance estimators 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > sigma2_a <- var(x) 451s > cat(sprintf("var(x) = %g\n", sigma2_a)) 451s var(x) = 1.02487 451s > 451s > sigma2_b <- varDiff(x) 451s > cat(sprintf("varDiff(x) = %g\n", sigma2_b)) 451s varDiff(x) = 1.01224 451s > 451s > d <- abs(sigma2_b - sigma2_a) 451s > cat(sprintf("Absolute difference = %g\n", d)) 451s Absolute difference = 0.0126268 451s > stopifnot(d < 0.02) 451s > 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # Standard deviation estimators 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > sigma_a <- sd(x) 451s > cat(sprintf("sd(x) = %g\n", sigma_a)) 451s sd(x) = 1.01236 451s > 451s > sigma_b <- sdDiff(x) 451s > cat(sprintf("sdDiff(x) = %g\n", sigma_b)) 451s sdDiff(x) = 1.0061 451s > 451s > d <- abs(sigma_b - sigma_a) 451s > cat(sprintf("Absolute difference = %g\n", d)) 451s Absolute difference = 0.00625567 451s > stopifnot(d < 0.01) 451s > 451s > # Sanity checks 451s > stopifnot(abs(sigma2_a - sigma_a ^ 2) < 1e-9) 451s > stopifnot(abs(sigma2_b - sigma_b ^ 2) < 1e-9) 451s > 451s > 451s > sigma_a2 <- mad(x) 451s > cat(sprintf("mad(x) = %g\n", sigma_a2)) 451s mad(x) = 0.998376 451s > 451s > sigma_b2 <- madDiff(x) 451s > cat(sprintf("madDiff(x) = %g\n", sigma_b2)) 451s madDiff(x) = 1.02513 451s > 451s > d <- abs(sigma_b2 - sigma_a2) 451s > cat(sprintf("Absolute difference = %g\n", d)) 451s Absolute difference = 0.0267497 451s > stopifnot(d < 0.05) 451s > 451s > 451s > sigma_a3 <- IQR(x) 451s > cat(sprintf("IQR(x) = %g\n", sigma_a3)) 451s IQR(x) = 1.35105 451s > 451s > sigma_b3 <- iqrDiff(x) 451s > cat(sprintf("iqrDiff(x) = %g\n", sigma_b3)) 451s iqrDiff(x) = 1.37797 451s > 451s > d <- abs(sigma_b3 - sigma_a3) 451s > cat(sprintf("Absolute difference = %g\n", d)) 451s Absolute difference = 0.0269152 451s > stopifnot(d < 0.05) 451s > 451s > 451s > 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > # Trimmed estimators 451s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 451s > y <- x 451s > outliers <- sample(length(x), size = 0.1 * length(x)) 451s > y[outliers] <- 100 * y[outliers] 451s > 451s > sigma_ao <- sd(y[-outliers]) 451s > cat(sprintf("sd(y) = %g\n", sigma_ao)) 451s sd(y) = 1.01166 451s > 451s > sigma_bo <- sdDiff(y[-outliers]) 451s > cat(sprintf("sdDiff(y) = %g\n", sigma_bo)) 451s sdDiff(y) = 1.00743 451s > 451s > d <- abs(sigma_b - sigma_a) 451s > cat(sprintf("Absolute difference = %g\n", d)) 451s Absolute difference = 0.00625567 451s > stopifnot(d < 0.01) 451s > 451s > sigma_bot <- sdDiff(y, trim = 0.05) 451s > cat(sprintf("sdDiff(y, trim = 0.05) = %g\n", sigma_bot)) 451s sdDiff(y, trim = 0.05) = 7.74327 451s > 451s > d <- abs(sigma_bot - sigma_a) 451s > cat(sprintf("Absolute difference = %g\n", d)) 451s Absolute difference = 6.73091 451s > #stopifnot(d < 1e-3) 451s > 451s > sigma_cot <- madDiff(y, trim = 0.05) 451s > cat(sprintf("madDiff(y, trim = 0.05) = %g\n", sigma_cot)) 451s madDiff(y, trim = 0.05) = 1.15278 451s > 451s > sigma_dot <- iqrDiff(y, trim = 0.05) 451s > cat(sprintf("iqrDiff(y, trim = 0.05) = %g\n", sigma_dot)) 451s iqrDiff(y, trim = 0.05) = 1.55762 451s > 451s > 451s > fcns <- list( 451s + varDiff = varDiff, 451s + sdDiff = sdDiff, 451s + madDiff = madDiff, 451s + iqrDiff = iqrDiff 451s + ) 451s > 451s > for (name in names(fcns)) { 451s + cat(sprintf("%s()...\n", name)) 451s + fcn <- fcns[[name]] 451s + 451s + for (mode in c("integer", "double")) { 451s + cat("mode: ", mode, "", sep = "") 451s + for (n in 0:3) { 451s + x <- runif(n, min = -5, max = 5) 451s + storage.mode(x) <- mode 451s + str(x) 451s + 451s + y <- fcn(x) 451s + yt <- fcn(x, trim = 0.1) 451s + str(list("non-trimmed" = y, trimmed = yt)) 451s + } # for (mode ...) 451s + } 451s + 451s + cat(sprintf("%s()...DONE\n", name)) 451s + } # for (name ...) 451s varDiff()... 451s mode: integer int(0) 451s List of 2 451s $ non-trimmed: num NA 451s $ trimmed : num NA 451s int -4 451s List of 2 451s $ non-trimmed: num NA 451s $ trimmed : num NA 451s int [1:2] 3 2 451s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s int [1:3] 1 4 -1 452s List of 2 452s $ non-trimmed: num 16 452s $ trimmed : num 16 452s mode: double num(0) 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s num -0.794 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s num [1:2] 0.897 -3.728 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s num [1:3] 2.07 -1.13 1.94 452s List of 2 452s $ non-trimmed: num 9.83 452s $ trimmed : num 9.83 452s varDiff()...DONE 452s sdDiff()... 452s mode: integer int(0) 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s int 2 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s int [1:2] -4 1 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s int [1:3] -2 1 -1 452s List of 2 452s $ non-trimmed: num 2.5 452s $ trimmed : num 2.5 452s mode: double num(0) 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s num -3.78 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s num [1:2] -2.04 2.38 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s num [1:3] 1.42 -2.14 1.14 452s List of 2 452s $ non-trimmed: num 3.42 452s $ trimmed : num 3.42 452s sdDiff()...DONE 452s madDiff()... 452s mode: integer int(0) 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s int -1 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s int [1:2] -1 4 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s int [1:3] -1 0 -3 452s List of 2 452s $ non-trimmed: num 2.1 452s $ trimmed : num 2.1 452s mode: double num(0) 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s num -1.13 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s num [1:2] -1.7 -1.21 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s num [1:3] -2.39 -0.464 3.086 452s List of 2 452s $ non-trimmed: num 0.851 452s $ trimmed : num 0.851 452s madDiff()...DONE 452s iqrDiff()... 452s mode: integer int(0) 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s int 3 452s List of 2 452s $ non-trimmed: num 0 452s $ trimmed : num 0 452s int [1:2] -3 4 452s List of 2 452s $ non-trimmed: num 0 452s $ trimmed : num 0 452s int [1:3] 0 -2 -2 452s List of 2 452s $ non-trimmed: num 0.707 452s $ trimmed : num 0.707 452s mode: double num(0) 452s List of 2 452s $ non-trimmed: num NA 452s $ trimmed : num NA 452s num -4.46 452s List of 2 452s $ non-trimmed: num 0 452s $ trimmed : num 0 452s num [1:2] 3.67 1.02 452s List of 2 452s $ non-trimmed: num 0 452s $ trimmed : num 0 452s num [1:3] -0.537 -2.733 2.857 452s List of 2 452s $ non-trimmed: num 2.75 452s $ trimmed : num 2.75 452s iqrDiff()...DONE 452s > 452s 452s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 452s Copyright (C) 2025 The R Foundation for Statistical Computing 452s Platform: aarch64-unknown-linux-gnu 452s 452s R is free software and comes with ABSOLUTELY NO WARRANTY. 452s You are welcome to redistribute it under certain conditions. 452s Type 'license()' or 'licence()' for distribution details. 452s 452s R is a collaborative project with many contributors. 452s Type 'contributors()' for more information and 452s 'citation()' on how to cite R or R packages in publications. 452s 452s Type 'demo()' for some demos, 'help()' for on-line help, or 452s 'help.start()' for an HTML browser interface to help. 452s Type 'q()' to quit R. 452s 452s > library("matrixStats") 452s > 452s > fcns <- list( 452s + varDiff = varDiff, 452s + sdDiff = sdDiff, 452s + madDiff = madDiff, 452s + iqrDiff = iqrDiff 452s + ) 452s > 452s > 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > # Subsetted tests 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > source("utils/validateIndicesFramework.R") 452s > for (name in names(fcns)) { 452s + cat(sprintf("subsetted tests on %s()...\n", name)) 452s + fcn <- fcns[[name]] 452s + 452s + for (mode in c("numeric", "integer")) { 452s + x <- runif(6, min = -6, max = 6) 452s + storage.mode(x) <- mode 452s + trim <- runif(1, min = 0, max = 0.5) 452s + if (mode == "numeric") x[1] <- Inf 452s + 452s + for (diff in 1:2) { 452s + for (idxs in index_cases) { 452s + validateIndicesTestVector(x, idxs, 452s + ftest = fcn, fsure = fcn, 452s + na.rm = TRUE, diff = diff, trim = trim) 452s + validateIndicesTestVector(x, idxs, 452s + ftest = fcn, fsure = fcn, 452s + na.rm = FALSE, diff = diff, trim = trim) 452s + } 452s + } 452s + } 452s + cat(sprintf("%s()...DONE\n", name)) 452s + } 452s subsetted tests on varDiff()... 452s varDiff()...DONE 452s subsetted tests on sdDiff()... 452s sdDiff()...DONE 452s subsetted tests on madDiff()... 452s madDiff()...DONE 452s subsetted tests on iqrDiff()... 452s iqrDiff()...DONE 452s > 452s 452s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 452s Copyright (C) 2025 The R Foundation for Statistical Computing 452s Platform: aarch64-unknown-linux-gnu 452s 452s R is free software and comes with ABSOLUTELY NO WARRANTY. 452s You are welcome to redistribute it under certain conditions. 452s Type 'license()' or 'licence()' for distribution details. 452s 452s R is a collaborative project with many contributors. 452s Type 'contributors()' for more information and 452s 'citation()' on how to cite R or R packages in publications. 452s 452s Type 'demo()' for some demos, 'help()' for on-line help, or 452s 'help.start()' for an HTML browser interface to help. 452s Type 'q()' to quit R. 452s 452s > library("matrixStats") 452s > 452s > for (mode in c("logical", "integer", "double")) { 452s + cat("mode: ", mode, "", sep = "") 452s + n <- 2L 452s + x <- runif(n, min = -5, max = 5) 452s + if (mode == "logical") { 452s + x <- x > 0 452s + } 452s + storage.mode(x) <- mode 452s + str(x) 452s + 452s + cat("All weights are 1\n") 452s + w <- rep(1, times = n) 452s + m0 <- weighted.mean(x, w) 452s + m1 <- weightedMean(x, w) 452s + str(list(m0 = m0, m1 = m1)) 452s + stopifnot(identical(m1, m0)) 452s + 452s + cat("First weight is 5\n") 452s + # Pull the mean towards zero 452s + w[1] <- 5 452s + str(w) 452s + m0 <- weighted.mean(x, w) 452s + m1 <- weightedMean(x, w) 452s + str(list(m0 = m0, m1 = m1)) 452s + stopifnot(identical(m1, m0)) 452s + 452s + cat("All weights are 0\n") 452s + # All weights set to zero 452s + w <- rep(0, times = n) 452s + m0 <- weighted.mean(x, w) 452s + m1 <- weightedMean(x, w) 452s + str(list(m0 = m0, m1 = m1)) 452s + stopifnot(identical(m1, m0)) 452s + 452s + cat("First weight is 8.5\n") 452s + # Put even more weight on the zero 452s + w[1] <- 8.5 452s + m0 <- weighted.mean(x, w) 452s + m1 <- weightedMean(x, w) 452s + str(list(m0 = m0, m1 = m1)) 452s + stopifnot(identical(m1, m0)) 452s + 452s + cat("First weight is Inf\n") 452s + # All weight on the first value 452s + w[1] <- Inf 452s + m0 <- weighted.mean(x, w) 452s + m1 <- weightedMean(x, w) 452s + str(list(m0 = m0, m1 = m1)) 452s + stopifnot(identical(m1, m0)) 452s + 452s + cat("Last weight is Inf\n") 452s + # All weight on the last value 452s + w[1] <- 1 452s + w[n] <- Inf 452s + m0 <- weighted.mean(x, w) 452s + m1 <- weightedMean(x, w) 452s + str(list(m0 = m0, m1 = m1)) 452s + stopifnot(identical(m1, m0)) 452s + } # for (mode ...) 452s mode: logical logi [1:2] TRUE TRUE 452s All weights are 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s First weight is 5 452s num [1:2] 5 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s All weights are 0 452s List of 2 452s $ m0: num NaN 452s $ m1: num NaN 452s First weight is 8.5 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s First weight is Inf 452s List of 2 452s $ m0: num NaN 452s $ m1: num NaN 452s Last weight is Inf 452s List of 2 452s $ m0: num NaN 452s $ m1: num NaN 452s mode: integer int [1:2] -1 -4 452s All weights are 1 452s List of 2 452s $ m0: num -2.5 452s $ m1: num -2.5 452s First weight is 5 452s num [1:2] 5 1 452s List of 2 452s $ m0: num -1.5 452s $ m1: num -1.5 452s All weights are 0 452s List of 2 452s $ m0: num NaN 452s $ m1: num NaN 452s First weight is 8.5 452s List of 2 452s $ m0: num -1 452s $ m1: num -1 452s First weight is Inf 452s List of 2 452s $ m0: num NaN 452s $ m1: num NaN 452s Last weight is Inf 452s List of 2 452s $ m0: num NaN 452s $ m1: num NaN 452s mode: double num [1:2] 3.327 0.272 452s All weights are 1 452s List of 2 452s $ m0: num 1.8 452s $ m1: num 1.8 452s First weight is 5 452s num [1:2] 5 1 452s List of 2 452s $ m0: num 2.82 452s $ m1: num 2.82 452s All weights are 0 452s List of 2 452s $ m0: num NaN 452s $ m1: num NaN 452s First weight is 8.5 452s List of 2 452s $ m0: num 3.33 452s $ m1: num 3.33 452s First weight is Inf 452s List of 2 452s $ m0: num NaN 452s $ m1: num NaN 452s Last weight is Inf 452s List of 2 452s $ m0: num NaN 452s $ m1: num NaN 452s > 452s > 452s > message("*** Testing for missing values") 452s *** Testing for missing values 452s > # NA tests 452s > xs <- list(A = c(1, 2, 3), B = c(NA, 2, 3), C = c(NA, 2, 3)) 452s > ws <- list(A = c(1, 1, 1), B = c(NA, 1, 1), C = c(1, NA, 1)) 452s > ## NOTE: The (B, B) case with na.rm = TRUE is interesting because 452s > ## even if NAs in 'w' are not dropped by na.rm = TRUE, this one 452s > ## is because 'x' is dropped and therefore that first element 452s > ## is skipped in the computation. It basically does 452s > ## keep <- !is.na(x); x <- x[keep]; w <- w[keep] 452s > ## without looking at 'w'. 452s > for (x in xs) { 452s + for (mode in c("logical", "integer", "double")) { 452s + storage.mode(x) <- mode 452s + for (w in ws) { 452s + for (na.rm in c(FALSE, TRUE)) { 452s + cat(sprintf("mode: %s, na.rm = %s\n", mode, na.rm)) 452s + str(list(x = x, w = w)) 452s + m0 <- weighted.mean(x, w, na.rm = na.rm) 452s + m1 <- weightedMean(x, w, na.rm = na.rm) 452s + str(list(m0 = m0, m1 = m1)) 452s + stopifnot(all.equal(m1, m0)) 452s + } 452s + } 452s + } 452s + } 452s mode: logical, na.rm = FALSE 452s List of 2 452s $ x: logi [1:3] TRUE TRUE TRUE 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: logical, na.rm = TRUE 452s List of 2 452s $ x: logi [1:3] TRUE TRUE TRUE 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: logical, na.rm = FALSE 452s List of 2 452s $ x: logi [1:3] TRUE TRUE TRUE 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = TRUE 452s List of 2 452s $ x: logi [1:3] TRUE TRUE TRUE 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = FALSE 452s List of 2 452s $ x: logi [1:3] TRUE TRUE TRUE 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = TRUE 452s List of 2 452s $ x: logi [1:3] TRUE TRUE TRUE 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = FALSE 452s List of 2 452s $ x: int [1:3] 1 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: integer, na.rm = TRUE 452s List of 2 452s $ x: int [1:3] 1 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: integer, na.rm = FALSE 452s List of 2 452s $ x: int [1:3] 1 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = TRUE 452s List of 2 452s $ x: int [1:3] 1 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = FALSE 452s List of 2 452s $ x: int [1:3] 1 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = TRUE 452s List of 2 452s $ x: int [1:3] 1 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = FALSE 452s List of 2 452s $ x: num [1:3] 1 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: double, na.rm = TRUE 452s List of 2 452s $ x: num [1:3] 1 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: double, na.rm = FALSE 452s List of 2 452s $ x: num [1:3] 1 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = TRUE 452s List of 2 452s $ x: num [1:3] 1 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = FALSE 452s List of 2 452s $ x: num [1:3] 1 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = TRUE 452s List of 2 452s $ x: num [1:3] 1 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = FALSE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = TRUE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: logical, na.rm = FALSE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = TRUE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: logical, na.rm = FALSE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = TRUE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = FALSE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = TRUE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: integer, na.rm = FALSE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = TRUE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: integer, na.rm = FALSE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = TRUE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = FALSE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = TRUE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: double, na.rm = FALSE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = TRUE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: double, na.rm = FALSE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = TRUE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = FALSE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = TRUE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: logical, na.rm = FALSE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = TRUE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: logical, na.rm = FALSE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: logical, na.rm = TRUE 452s List of 2 452s $ x: logi [1:3] NA TRUE TRUE 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = FALSE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = TRUE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: integer, na.rm = FALSE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = TRUE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: integer, na.rm = FALSE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: integer, na.rm = TRUE 452s List of 2 452s $ x: int [1:3] NA 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = FALSE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = TRUE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] 1 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: double, na.rm = FALSE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = TRUE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] NA 1 1 452s List of 2 452s $ m0: num 1 452s $ m1: num 1 452s mode: double, na.rm = FALSE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s mode: double, na.rm = TRUE 452s List of 2 452s $ x: num [1:3] NA 1 1 452s $ w: num [1:3] 1 NA 1 452s List of 2 452s $ m0: num NA 452s $ m1: num NA 452s > 452s 452s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 452s Copyright (C) 2025 The R Foundation for Statistical Computing 452s Platform: aarch64-unknown-linux-gnu 452s 452s R is free software and comes with ABSOLUTELY NO WARRANTY. 452s You are welcome to redistribute it under certain conditions. 452s Type 'license()' or 'licence()' for distribution details. 452s 452s R is a collaborative project with many contributors. 452s Type 'contributors()' for more information and 452s 'citation()' on how to cite R or R packages in publications. 452s 452s Type 'demo()' for some demos, 'help()' for on-line help, or 452s 'help.start()' for an HTML browser interface to help. 452s Type 'q()' to quit R. 452s 453s > library("matrixStats") 453s > 453s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 453s > # Subsetted tests 453s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 453s > source("utils/validateIndicesFramework.R") 453s > for (mode in c("numeric", "integer")) { 453s + x <- runif(6, min = -6, max = 6) 453s + w <- runif(6, min = 0, max = 6) 453s + storage.mode(x) <- mode 453s + storage.mode(w) <- mode 453s + if (mode == "numeric") w[1] <- Inf 453s + 453s + for (idxs in index_cases) { 453s + validateIndicesTestVector_w(x, w, idxs, 453s + ftest = weightedMean, fsure = weighted.mean, 453s + na.rm = TRUE, refine = TRUE) 453s + validateIndicesTestVector_w(x, w, idxs, 453s + ftest = weightedMean, fsure = weighted.mean, 453s + na.rm = FALSE, refine = TRUE) 453s + } 453s + } 453s > 453s 453s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 453s Copyright (C) 2025 The R Foundation for Statistical Computing 453s Platform: aarch64-unknown-linux-gnu 453s 453s R is free software and comes with ABSOLUTELY NO WARRANTY. 453s You are welcome to redistribute it under certain conditions. 453s Type 'license()' or 'licence()' for distribution details. 453s 453s R is a collaborative project with many contributors. 453s Type 'contributors()' for more information and 453s 'citation()' on how to cite R or R packages in publications. 453s 453s Type 'demo()' for some demos, 'help()' for on-line help, or 453s 'help.start()' for an HTML browser interface to help. 453s Type 'q()' to quit R. 453s 453s > library("matrixStats") 453s > 453s > x <- 1:5 453s > y <- weightedMedian(x) 453s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = TRUE) 453s > print(y) 453s [1] 3 453s > 453s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = FALSE) 453s > print(y) 453s [1] NA 453s > stopifnot(is.na(y)) 453s > 453s > x <- 1:10 453s > n <- length(x) 453s > 453s > y1 <- median(x) # 5.5 453s > y2 <- weightedMedian(x) # 5.5 453s > stopifnot(all.equal(y1, y2)) 453s > 453s > 453s > w <- rep(1, times = n) 453s > y1 <- weightedMedian(x, w) # 5.5 (default) 453s > y2a <- weightedMedian(x, ties = "weighted") # 5.5 (default) 453s > y2b <- weightedMedian(x, ties = "min") # 5 453s > y2c <- weightedMedian(x, ties = "max") # 6 453s > stopifnot(all.equal(y2a, y1)) 453s > 453s > y3 <- weightedMedian(x, w) # 5.5 (default) 453s > 453s > 453s > # Pull the median towards zero 453s > w[1] <- 5 453s > y1 <- weightedMedian(x, w) # 3.5 453s > y <- c(rep(0, times = w[1]), x[-1]) # Only possible for integer weights 453s > y2 <- median(y) # 3.5 453s > stopifnot(all.equal(y1, y2)) 453s > 453s > # Put even more weight on the zero 453s > w[1] <- 8.5 453s > y <- weightedMedian(x, w) # 2 453s > 453s > # All weight on the first value 453s > w[1] <- Inf 453s > y <- weightedMedian(x, w) # 1 453s > 453s > # All weight on the last value 453s > w[1] <- 1 453s > w[n] <- Inf 453s > y <- weightedMedian(x, w) # 10 453s > 453s > # All weights set to zero 453s > w <- rep(0, times = n) 453s > y <- weightedMedian(x, w) # NA 453s > 453s > x <- 1:4 453s > w <- rep(1, times = 4) 453s > for (mode in c("integer", "double")) { 453s + storage.mode(x) <- mode 453s + for (ties in c("weighted", "mean", "min", "max")) { 453s + cat(sprintf("ties = %s\n", ties)) 453s + y <- weightedMedian(x, w, ties = ties) 453s + } 453s + } 453s ties = weighted 453s ties = mean 453s ties = min 453s ties = max 453s ties = weighted 453s ties = mean 453s ties = min 453s ties = max 453s > 453s > set.seed(0x42) 453s > 453s > y <- weightedMedian(x = double(0L)) 453s > print(y) 453s [1] NA 453s > stopifnot(length(y) == 1L) 453s > stopifnot(is.na(y)) 453s > 453s > y <- weightedMedian(x = x[1]) 453s > print(y) 453s [1] 1 453s > stopifnot(length(y) == 1L) 453s > stopifnot(all.equal(y, x[1])) 453s > 453s > 453s > n <- 1e3 453s > x <- runif(n) 453s > w <- runif(n, min = 0, max = 1) 453s > for (mode in c("integer", "double")) { 453s + storage.mode(x) <- mode 453s + for (ties in c("weighted", "mean", "min", "max")) { 453s + y <- weightedMedian(x, w, ties = ties) 453s + cat(sprintf("mode = %s, ties = %s, result = %g\n", mode, ties, y)) 453s + } 453s + } 453s mode = integer, ties = weighted, result = 0 453s mode = integer, ties = mean, result = 0 453s mode = integer, ties = min, result = 0 453s mode = integer, ties = max, result = 0 453s mode = double, ties = weighted, result = 0 453s mode = double, ties = mean, result = 0 453s mode = double, ties = min, result = 0 453s mode = double, ties = max, result = 0 453s > 453s > 453s > # A large vector 453s > n <- 1e5 453s > x <- runif(n) 453s > w <- runif(n, min = 0, max = 1) 453s > y <- weightedMedian(x, w) 453s > 453s > y <- weightedMedian(x, w, ties = "min") 453s > 453s > 453s > # Single Number 453s > xs <- c(1, NA_integer_) 453s > ws <- c(1, NA_integer_) 453s > for (x in xs) { 453s + for (w in ws) { 453s + y <- weightedMedian(x = x, w = w) 453s + if (is.na(w)) z <- NA_real_ 453s + else z <- x[1] 453s + stopifnot(all.equal(y, z)) 453s + } 453s + } 453s > 453s > ## Logical 453s > x1 <- c(TRUE, FALSE, TRUE) 453s > w0 <- c(0, 0, 0) 453s > stopifnot(!is.finite(weightedMedian(x1, w0)), 453s + !is.infinite(weightedMedian(x1, w0))) 453s > 453s > w1 <- c(1, 1, 1) 453s > stopifnot(weightedMedian(x1, w1) == 1) 453s > 453s > w2 <- c(1, 2, 3) 453s > stopifnot(weightedMedian(x1, w2) == 1) 453s > 453s > ### NA 453s > stopifnot(is.na(weightedMedian(c(TRUE, FALSE, NA), 453s + c(1, 2, 3))), 453s + all.equal(weightedMedian(c(TRUE, FALSE, NA), 453s + c(1, 2, 3), 453s + na.rm = TRUE), 453s + weightedMedian(c(TRUE, FALSE), 453s + c(1, 2)))) 453s > ### Identical to as.integer() 453s > x <- rcauchy(100) 453s > w <- abs(rcauchy(100)) 453s > stopifnot(all.equal(weightedMedian(x > 0, w), 453s + weightedMedian(as.integer(x > 0), w))) 453s > 453s > 453s > 453s 453s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 453s Copyright (C) 2025 The R Foundation for Statistical Computing 453s Platform: aarch64-unknown-linux-gnu 453s 453s R is free software and comes with ABSOLUTELY NO WARRANTY. 453s You are welcome to redistribute it under certain conditions. 453s Type 'license()' or 'licence()' for distribution details. 453s 453s R is a collaborative project with many contributors. 453s Type 'contributors()' for more information and 453s 'citation()' on how to cite R or R packages in publications. 453s 453s Type 'demo()' for some demos, 'help()' for on-line help, or 453s 'help.start()' for an HTML browser interface to help. 453s Type 'q()' to quit R. 453s 453s > library("matrixStats") 453s > 453s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 453s > # Subsetted tests 453s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 453s > source("utils/validateIndicesFramework.R") 453s > for (mode in c("numeric", "integer")) { 453s + x <- runif(6, min = -6, max = 6) 453s + w <- runif(6, min = 0, max = 6) 453s + storage.mode(x) <- mode 453s + storage.mode(w) <- mode 453s + if (mode == "numeric") w[1] <- Inf 453s + 453s + for (idxs in index_cases) { 453s + validateIndicesTestVector_w(x, w, idxs, 453s + ftest = weightedMedian, 453s + fsure = weightedMedian, 453s + na.rm = TRUE) 453s + validateIndicesTestVector_w(x, w, idxs, 453s + ftest = weightedMedian, 453s + fsure = weightedMedian, 453s + na.rm = FALSE) 453s + 453s + for (ties in c("weighted", "mean", "min", "max")) { 453s + validateIndicesTestVector_w(x, w, idxs, 453s + ftest = weightedMedian, 453s + fsure = weightedMedian, 453s + na.rm = TRUE, ties = ties) 453s + validateIndicesTestVector_w(x, w, idxs, 453s + ftest = weightedMedian, 453s + fsure = weightedMedian, 453s + na.rm = FALSE, ties = ties) 453s + } 453s + } 453s + } 453s > 453s 453s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 453s Copyright (C) 2025 The R Foundation for Statistical Computing 453s Platform: aarch64-unknown-linux-gnu 453s 453s R is free software and comes with ABSOLUTELY NO WARRANTY. 453s You are welcome to redistribute it under certain conditions. 453s Type 'license()' or 'licence()' for distribution details. 453s 453s R is a collaborative project with many contributors. 453s Type 'contributors()' for more information and 453s 'citation()' on how to cite R or R packages in publications. 453s 453s Type 'demo()' for some demos, 'help()' for on-line help, or 453s 'help.start()' for an HTML browser interface to help. 453s Type 'q()' to quit R. 453s 453s > library("matrixStats") 453s > 453s > weightedVar_R <- function(x, w) { 453s + mu <- weighted.mean(x, w = w) 453s + sum(w * (x - mu) ^ 2) / (sum(w) - 1) 453s + } 453s > 453s > 453s > n <- 10 453s > x <- as.double(1:n) 453s > 453s > message("*** weightedVar() ...") 453s *** weightedVar() ... 453s - Zero elements 453s > 453s > message("- Zero elements") 453s > m0 <- var(integer(0)) 453s > m1 <- weightedVar(integer(0), w = integer(0)) 453s > str(list(m0 = m0, m1 = m1)) 453s List of 2 453s $ m0: num NA 453s $ m1: int NA 453s > stopifnot(all.equal(m1, m0)) 453s > 453s > 453s > message("- One elements") 453s - One elements 453s > m0 <- var(1) 453s > m1 <- weightedVar(1) 453s > str(list(m0 = m0, m1 = m1)) 453s List of 2 453s $ m0: num NA 453s $ m1: num NA 453s > stopifnot(all.equal(m1, m0)) 453s > 453s > 453s > - Uniform weights (all w = 1) 453s message("- Uniform weights (all w = 1)") 453s > m0 <- var(x) 453s > w <- rep(1, times = n) 453s > m1 <- weightedVar(x, w = w) 453s > str(list(m0 = m0, m1 = m1)) 453s List of 2 453s $ m0: num 9.17 453s $ m1- Uniform weights (all w = 3) 453s : num 9.17 453s > stopifnot(all.equal(m1, m0)) 453s > 453s > 453s > message("- Uniform weights (all w = 3)") 453s > m0 <- var(rep(x, each = 3)) 453s > w <- rep(3, times = n) 453s > m1 <- weightedVar(x, w = w) 453s > str(list(m0 = m0, m1 = m1)) 453s List of 2 453s $ m0: num 8.53 453s $ m1: num 8.53 453s > stopifnot(all.equal(m1, m0)) 453s > 453s > 453s > message("- Uniform weights on the first five elements") 453s - Uniform weights on the first five elements 453s > idxs <- 1:5 453s > m0 <- var(x[1:5]) 453s > - Uniform weights on every second elements 453s w <- rep(0, times = n) 453s > w[idxs] <- 1 453s > m1 <- weightedVar(x, w = w) 453s > str(list(m0 = m0, m1 = m1)) 453s List of 2 453s $ m0: num 2.5 453s $ m1: num 2.5 453s > stopifnot(all.equal(m1, m0)) 453s > 453s > 453s > message("- Uniform weights on every second elements") 453s > idxs <- seq(from = 1, to = n, by = 2) 453s > m0 <- var(x[idxs]) 453s > w <- rep(0, times = n) 453s > w[idxs] <- 1 453s > m1 <- weightedVar(x, w = w) 453s > str(list(m0 = m0, m1 = m1)) 453s List of 2 453s $ m0: num 10 453s $ m1: num 10 453s > stopifnot(all.equal(m1, m0)) 453s > - All weights are zero 453s 453s > 453s > message("- All weights are zero") 453s > idxs <- integer(0L) 453s > m0 <- var(x[idxs]) 453s > w <- rep(0, times = n) 453s > w[idxs] <- 1 453s > m1 <- weightedVar(x, w = w) 453s > str(list(m0 = m0, m1 = m1)) 453s List of 2 453s $ m0: num NA 453s $ m1: num NA 453s > stopifnot(all.equal(m1, m0)) 453s > 453s > message("- Infinite weight on first element") 453s - Infinite weight on first element 453s > idxs <- 1L 453s > m0 <- var(x[idxs]) 453s > w <- rep(0, times = n) 453s > w[idxs] <- Inf 453s > m1 <- weightedVar(x, w = w) 453s > str(list(m0 = m0, m1 = m1)) 453s List of 2 453s $ m0: num NA 453s $ m1: num NA 453s > stopifnot(all.equal(m1, m0)) 453s > 453s > message("- Missing-value weight on first element") 453s - Missing-value weight on first element 453s > idxs <- 1L 453s > w <- rep(1, times = n) 453s > w[idxs] <- NA_real_ 453s > m1 <- weightedVar(x, w = w) 453s > str(list(m1 = m1)) 453s List of 1 453s $ m1: num NA 453s > stopifnot(identical(m1, NA_real_)) 453s > 453s > 453s > message("- Frequency weights") 453s - Frequency weights 453s > 453s > ## From https://en.wikipedia.org/wiki/Weighted_arithmetic_mean 453s > y <- c(2, 2, 4, 5, 5, 5) 453s > x <- unique(y) 453s > w <- table(y) 453s > stopifnot(names(w) == x) 453s > 453s > m0 <- weightedVar(x, w = w) 453s > m1 <- var(y) 453s > stopifnot(all.equal(m1, m0)) 453s > m2 <- weightedVar(x, w = w) 453s > str(list(m0 = m0, m1 = m1, m2 = m2)) 453s List of 3 453s $ m0: num 2.17 453s $ m1: num 2.17 453s $ m2: num 2.17 453s > stopifnot(all.equal(m2, m0)) 453s > 453s > ## From https://github.com/HenrikBengtsson/matrixStats/issues/72 453s > large <- c(21, 8, 26, 1, 15, 33, 12, 25, 0, 84) 453s > years <- c(41706, 9301, 33678, 3082, 27040, 44188, 10049, 30591, 2275, 109831) 453s > 453s > m0 <- weightedVar(large, w = years) 453s > m1 <- weightedVar(large, w = years) 453s > str(list(m0 = m0, m1 = m1)) 453s List of 2 453s $ m0: num 899 453s $ m1: num 899 453s > stopifnot(all.equal(m1, m0)) 453s > *** weightedVar() ... DONE 453s 453s > message("*** weightedVar() ... DONE") 453s > 453s 453s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 453s Copyright (C) 2025 The R Foundation for Statistical Computing 453s Platform: aarch64-unknown-linux-gnu 453s 453s R is free software and comes with ABSOLUTELY NO WARRANTY. 453s You are welcome to redistribute it under certain conditions. 453s Type 'license()' or 'licence()' for distribution details. 453s 453s R is a collaborative project with many contributors. 453s Type 'contributors()' for more information and 453s 'citation()' on how to cite R or R packages in publications. 453s 453s Type 'demo()' for some demos, 'help()' for on-line help, or 453s 'help.start()' for an HTML browser interface to help. 453s Type 'q()' to quit R. 453s 454s > library("matrixStats") 454s > 454s > fcns <- list( 454s + weightedVar = weightedVar, 454s + weightedSd = weightedSd, 454s + weightedMad = weightedMad 454s + ) 454s > 454s > for (name in names(fcns)) { 454s + cat(sprintf("%s()...\n", name)) 454s + fcn <- fcns[[name]] 454s + 454s + for (mode in c("integer", "double")) { 454s + cat("mode: ", mode, "\n", sep = "") 454s + n <- 15L 454s + x <- runif(n, min = -5, max = 5) 454s + storage.mode(x) <- mode 454s + str(x) 454s + 454s + for (add_na in c(FALSE, TRUE)) { 454s + cat("add_na: ", add_na, "\n", sep = "") 454s + if (add_na) { 454s + x[c(5, 7)] <- NA 454s + } 454s + str(x) 454s + 454s + for (na.rm in c(FALSE, TRUE)) { 454s + cat("na.rm: ", na.rm, "\n", sep = "") 454s + 454s + cat("Weights are not specified (all are 1)\n") 454s + m1 <- fcn(x, na.rm = na.rm) 454s + str(list(m1 = m1)) 454s + 454s + cat("All weights are 1\n") 454s + w <- rep(1, times = n) 454s + m1 <- fcn(x, w, na.rm = na.rm) 454s + str(list(m1 = m1)) 454s + 454s + cat("First weight is 5\n") 454s + # Pull the mean towards zero 454s + w[1] <- 5 454s + str(w) 454s + m1 <- fcn(x, w, na.rm = na.rm) 454s + str(list(m1 = m1)) 454s + 454s + cat("All weights are 0\n") 454s + # All weights set to zero 454s + w <- rep(0, times = n) 454s + m1 <- fcn(x, w, na.rm = na.rm) 454s + str(list(m1 = m1)) 454s + 454s + cat("First weight is 8.5\n") 454s + # Put even more weight on the zero 454s + w[1] <- 8.5 454s + m1 <- fcn(x, w, na.rm = na.rm) 454s + str(list(m1 = m1)) 454s + 454s + cat("First weight is Inf\n") 454s + # All weight on the first value 454s + w[1] <- Inf 454s + m1 <- fcn(x, w, na.rm = na.rm) 454s + str(list(m1 = m1)) 454s + 454s + cat("Last weight is Inf\n") 454s + # All weight on the last value 454s + w[1] <- 1 454s + w[n] <- Inf 454s + m1 <- fcn(x, w, na.rm = na.rm) 454s + str(list(m1 = m1)) 454s + 454s + cat("Last weight is NA\n") 454s + # All weight on the last value 454s + w[1] <- 1 454s + w[n] <- NA_real_ 454s + m1 <- fcn(x, w, na.rm = na.rm) 454s + str(list(m1 = m1)) 454s + } # for (na.rm ...) 454s + } # for (add_na ...) 454s + } # for (mode ...) 454s + 454s + cat(sprintf("%s()...DONE\n", name)) 454s + } # for (name ...) 454s weightedVar()... 454s mode: integer 454s int [1:15] -3 -3 3 -4 1 0 -1 2 -2 0 ... 454s add_na: FALSE 454s int [1:15] -3 -3 3 -4 1 0 -1 2 -2 0 ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 5.7 454s All weights are 1 454s List of 1 454s $ m1: num 5.7 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 5.5 454s All weights are 0 454s List of 1 454s $ m1: int NA 454s First weight is 8.5 454s List of 1 454s $ m1: int NA 454s First weight is Inf 454s List of 1 454s $ m1: int NA 454s Last weight is Inf 454s List of 1 454s $ m1: int NA 454s Last weight is NA 454s List of 1 454s $ m1: int NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 5.7 454s All weights are 1 454s List of 1 454s $ m1: num 5.7 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 5.5 454s All weights are 0 454s List of 1 454s $ m1: int NA 454s First weight is 8.5 454s List of 1 454s $ m1: int NA 454s First weight is Inf 454s List of 1 454s $ m1: int NA 454s Last weight is Inf 454s List of 1 454s $ m1: int NA 454s Last weight is NA 454s List of 1 454s $ m1: int NA 454s add_na: TRUE 454s int [1:15] -3 -3 3 -4 NA 0 NA 2 -2 0 ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: int NA 454s All weights are 1 454s List of 1 454s $ m1: int NA 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: int NA 454s All weights are 0 454s List of 1 454s $ m1: int NA 454s First weight is 8.5 454s List of 1 454s $ m1: int NA 454s First weight is Inf 454s List of 1 454s $ m1: int NA 454s Last weight is Inf 454s List of 1 454s $ m1: int NA 454s Last weight is NA 454s List of 1 454s $ m1: int NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 6.42 454s All weights are 1 454s List of 1 454s $ m1: num 6.42 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 5.9 454s All weights are 0 454s List of 1 454s $ m1: int NA 454s First weight is 8.5 454s List of 1 454s $ m1: int NA 454s First weight is Inf 454s List of 1 454s $ m1: int NA 454s Last weight is Inf 454s List of 1 454s $ m1: int NA 454s Last weight is NA 454s List of 1 454s $ m1: int NA 454s mode: double 454s num [1:15] 3.597 -1.858 2.615 -0.469 -3.857 ... 454s add_na: FALSE 454s num [1:15] 3.597 -1.858 2.615 -0.469 -3.857 ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 6.53 454s All weights are 1 454s List of 1 454s $ m1: num 6.53 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 6.84 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 6.53 454s All weights are 1 454s List of 1 454s $ m1: num 6.53 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 6.84 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s add_na: TRUE 454s num [1:15] 3.597 -1.858 2.615 -0.469 NA ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num NA 454s All weights are 1 454s List of 1 454s $ m1: num NA 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num NA 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 5.93 454s All weights are 1 454s List of 1 454s $ m1: num 5.93 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 6.07 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s weightedVar()...DONE 454s weightedSd()... 454s mode: integer 454s int [1:15] 1 3 0 -3 2 4 0 3 -2 -1 ... 454s add_na: FALSE 454s int [1:15] 1 3 0 -3 2 4 0 3 -2 -1 ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 2.16 454s All weights are 1 454s List of 1 454s $ m1: num 2.16 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 1.93 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 2.16 454s All weights are 1 454s List of 1 454s $ m1: num 2.16 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 1.93 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s add_na: TRUE 454s int [1:15] 1 3 0 -3 NA 4 NA 3 -2 -1 ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num NA 454s All weights are 1 454s List of 1 454s $ m1: num NA 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num NA 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 2.29 454s All weights are 1 454s List of 1 454s $ m1: num 2.29 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 2 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s mode: double 454s num [1:15] -1.49 2.59 -2.82 4.87 -4.23 ... 454s add_na: FALSE 454s num [1:15] -1.49 2.59 -2.82 4.87 -4.23 ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 3.44 454s All weights are 1 454s List of 1 454s $ m1: num 3.44 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 3.15 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 3.44 454s All weights are 1 454s List of 1 454s $ m1: num 3.44 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 3.15 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s add_na: TRUE 454s num [1:15] -1.49 2.59 -2.82 4.87 NA ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num NA 454s All weights are 1 454s List of 1 454s $ m1: num NA 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num NA 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 3.22 454s All weights are 1 454s List of 1 454s $ m1: num 3.22 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 2.93 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num NA 454s First weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is Inf 454s List of 1 454s $ m1: num NA 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s weightedSd()...DONE 454s weightedMad()... 454s mode: integer 454s int [1:15] 2 -2 2 0 2 3 -4 1 0 0 ... 454s add_na: FALSE 454s int [1:15] 2 -2 2 0 2 3 -4 1 0 0 ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 1.48 454s All weights are 1 454s List of 1 454s $ m1: num 1.48 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 1.48 454s All weights are 0 454s List of 1 454s $ m1: int NA 454s First weight is 8.5 454s List of 1 454s $ m1: int 0 454s First weight is Inf 454s List of 1 454s $ m1: int 0 454s Last weight is Inf 454s List of 1 454s $ m1: int 0 454s Last weight is NA 454s List of 1 454s $ m1: int NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 1.48 454s All weights are 1 454s List of 1 454s $ m1: num 1.48 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 1.48 454s All weights are 0 454s List of 1 454s $ m1: int NA 454s First weight is 8.5 454s List of 1 454s $ m1: int 0 454s First weight is Inf 454s List of 1 454s $ m1: int 0 454s Last weight is Inf 454s List of 1 454s $ m1: int 0 454s Last weight is NA 454s List of 1 454s $ m1: int NA 454s add_na: TRUE 454s int [1:15] 2 -2 2 0 NA 3 NA 1 0 0 ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num NA 454s All weights are 1 454s List of 1 454s $ m1: int NA 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: int NA 454s All weights are 0 454s List of 1 454s $ m1: int NA 454s First weight is 8.5 454s List of 1 454s $ m1: int 0 454s First weight is Inf 454s List of 1 454s $ m1: int 0 454s Last weight is Inf 454s List of 1 454s $ m1: int 0 454s Last weight is NA 454s List of 1 454s $ m1: int NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 1.48 454s All weights are 1 454s List of 1 454s $ m1: num 1.48 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 1.48 454s All weights are 0 454s List of 1 454s $ m1: int NA 454s First weight is 8.5 454s List of 1 454s $ m1: int 0 454s First weight is Inf 454s List of 1 454s $ m1: int 0 454s Last weight is Inf 454s List of 1 454s $ m1: int 0 454s Last weight is NA 454s List of 1 454s $ m1: int NA 454s mode: double 454s num [1:15] 2.045 4.491 -4.64 3.412 -0.398 ... 454s add_na: FALSE 454s num [1:15] 2.045 4.491 -4.64 3.412 -0.398 ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 4.62 454s All weights are 1 454s List of 1 454s $ m1: num 4.62 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 2.6 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num 0 454s First weight is Inf 454s List of 1 454s $ m1: num 0 454s Last weight is Inf 454s List of 1 454s $ m1: num 0 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 4.62 454s All weights are 1 454s List of 1 454s $ m1: num 4.62 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 2.6 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num 0 454s First weight is Inf 454s List of 1 454s $ m1: num 0 454s Last weight is Inf 454s List of 1 454s $ m1: num 0 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s add_na: TRUE 454s num [1:15] 2.05 4.49 -4.64 3.41 NA ... 454s na.rm: FALSE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num NA 454s All weights are 1 454s List of 1 454s $ m1: num NA 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num NA 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num 0 454s First weight is Inf 454s List of 1 454s $ m1: num 0 454s Last weight is Inf 454s List of 1 454s $ m1: num 0 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s na.rm: TRUE 454s Weights are not specified (all are 1) 454s List of 1 454s $ m1: num 4.62 454s All weights are 1 454s List of 1 454s $ m1: num 4.62 454s First weight is 5 454s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 454s List of 1 454s $ m1: num 2.6 454s All weights are 0 454s List of 1 454s $ m1: num NA 454s First weight is 8.5 454s List of 1 454s $ m1: num 0 454s First weight is Inf 454s List of 1 454s $ m1: num 0 454s Last weight is Inf 454s List of 1 454s $ m1: num 0 454s Last weight is NA 454s List of 1 454s $ m1: num NA 454s weightedMad()...DONE 454s > 454s 454s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 454s Copyright (C) 2025 The R Foundation for Statistical Computing 454s Platform: aarch64-unknown-linux-gnu 454s 454s R is free software and comes with ABSOLUTELY NO WARRANTY. 454s You are welcome to redistribute it under certain conditions. 454s Type 'license()' or 'licence()' for distribution details. 454s 454s R is a collaborative project with many contributors. 454s Type 'contributors()' for more information and 454s 'citation()' on how to cite R or R packages in publications. 454s 454s Type 'demo()' for some demos, 'help()' for on-line help, or 454s 'help.start()' for an HTML browser interface to help. 454s Type 'q()' to quit R. 454s 454s > library("matrixStats") 454s > 454s > fcns <- list( 454s + weightedVar = weightedVar, 454s + weightedSd = weightedSd, 454s + weightedMad = weightedMad 454s + ) 454s > 454s > 454s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 454s > # Subsetted tests 454s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 454s > source("utils/validateIndicesFramework.R") 454s > for (name in names(fcns)) { 454s + cat(sprintf("subsetted tests on %s()...\n", name)) 454s + fcn <- fcns[[name]] 454s + 454s + for (mode in c("numeric", "integer")) { 454s + x <- runif(6, min = -6, max = 6) 454s + w <- runif(6, min = 0, max = 6) 454s + storage.mode(x) <- mode 454s + storage.mode(w) <- mode 454s + if (mode == "numeric") w[1] <- Inf 454s + 454s + for (idxs in index_cases) { 454s + validateIndicesTestVector_w(x, w, idxs, 454s + ftest = fcn, fsure = fcn, 454s + na.rm = TRUE) 454s + validateIndicesTestVector_w(x, w, idxs, 454s + ftest = fcn, fsure = fcn, 454s + na.rm = FALSE) 454s + } 454s + } 454s + cat(sprintf("%s()...DONE\n", name)) 454s + } 454s subsetted tests on weightedVar()... 454s weightedVar()...DONE 454s subsetted tests on weightedSd()... 454s weightedSd()...DONE 454s subsetted tests on weightedMad()... 454s weightedMad()...DONE 454s > 454s 454s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 454s Copyright (C) 2025 The R Foundation for Statistical Computing 454s Platform: aarch64-unknown-linux-gnu 454s 454s R is free software and comes with ABSOLUTELY NO WARRANTY. 454s You are welcome to redistribute it under certain conditions. 454s Type 'license()' or 'licence()' for distribution details. 454s 454s R is a collaborative project with many contributors. 454s Type 'contributors()' for more information and 454s 'citation()' on how to cite R or R packages in publications. 454s 454s Type 'demo()' for some demos, 'help()' for on-line help, or 454s 'help.start()' for an HTML browser interface to help. 454s Type 'q()' to quit R. 454s 454s > library("matrixStats") 454s > 454s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 454s + if (na.rm) { 454s + xnok <- is.na(x) 454s + ynok <- is.na(y) 454s + anok <- xnok & ynok 454s + unit <- switch(OP, 454s + "+" = 0, 454s + "-" = NA_real_, 454s + "*" = 1, 454s + "/" = NA_real_, 454s + stop("Unknown 'OP' operator: ", OP) 454s + ) 454s + x[xnok] <- unit 454s + y[ynok] <- unit 454s + } 454s + 454s + ans <- switch(OP, 454s + "+" = x + y, 454s + "-" = x - y, 454s + "*" = x * y, 454s + "/" = x / y, 454s + stop("Unknown 'OP' operator: ", OP) 454s + ) 454s + 454s + if (na.rm) { 454s + ans[anok] <- NA_real_ 454s + } 454s + 454s + ans 454s + } # x_OP_y_R() 454s > 454s > 454s > 454s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 454s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 454s + } 454s > 454s > 454s > 454s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 454s > # No missing values 454s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 454s > x <- matrix(1:16, nrow = 4, ncol = 4) 454s > y <- 1:nrow(x) 454s > storage.mode(y) <- storage.mode(x) 454s > 454s > for (OP in c("+", "-", "*", "/")) { 454s + for (na.rm in c(FALSE, TRUE)) { 454s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 454s + 454s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 454s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 454s + str(a1) 454s + stopifnot(all.equal(a1, a0)) 454s + 454s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 454s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 454s + str(b1) 454s + stopifnot(all.equal(b1, b0)) 454s + } 454s + } 454s OP = '+', na.rm = FALSE 454s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 454s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 454s OP = '+', na.rm = TRUE 454s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 454s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 454s OP = '-', na.rm = FALSE 454s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 454s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 454s OP = '-', na.rm = TRUE 454s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 454s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 454s OP = '*', na.rm = FALSE 454s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 454s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 454s OP = '*', na.rm = TRUE 454s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 454s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 454s OP = '/', na.rm = FALSE 454s num [1:4, 1:4] 1 1 1 1 5 ... 454s num [1:4, 1:4] 1 2 3 4 2.5 ... 454s OP = '/', na.rm = TRUE 454s num [1:4, 1:4] 1 1 1 1 5 ... 454s num [1:4, 1:4] 1 2 3 4 2.5 ... 454s > 454s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 454s > # Missing values in x, y, or both. 454s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 454s > for (which in c("x", "y", "both")) { 454s + x <- matrix(1:16, nrow = 4, ncol = 4) 454s + y <- 1:nrow(x) 454s + storage.mode(y) <- storage.mode(x) 454s + 454s + if (which == "x") { 454s + x[3:6] <- NA_real_ 454s + } else if (which == "y") { 454s + y[c(1, 3)] <- NA_real_ 454s + } else if (which == "both") { 454s + x[3:6] <- NA_real_ 454s + y[c(1, 3)] <- NA_real_ 454s + } 454s + 454s + for (OP in c("+", "-", "*", "/")) { 454s + for (na.rm in c(FALSE, TRUE)) { 454s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 454s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 454s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 454s + str(a1) 454s + stopifnot(all.equal(a1, a0)) 454s + 454s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 454s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 454s + str(b1) 454s + stopifnot(all.equal(b1, b0)) 454s + } 454s + } 454s + } 454s OP = '+', na.rm = FALSE 454s num [1:4, 1:4] 2 4 NA NA NA NA 10 12 10 12 ... 454s num [1:4, 1:4] 2 3 NA NA NA NA 9 10 12 13 ... 454s OP = '+', na.rm = TRUE 454s num [1:4, 1:4] 2 4 3 4 1 2 10 12 10 12 ... 454s num [1:4, 1:4] 2 3 1 1 2 2 9 10 12 13 ... 454s OP = '-', na.rm = FALSE 454s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 454s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 454s OP = '-', na.rm = TRUE 454s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 454s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 454s OP = '*', na.rm = FALSE 454s num [1:4, 1:4] 1 4 NA NA NA NA 21 32 9 20 ... 454s num [1:4, 1:4] 1 2 NA NA NA NA 14 16 27 30 ... 454s OP = '*', na.rm = TRUE 454s num [1:4, 1:4] 1 4 3 4 1 2 21 32 9 20 ... 454s num [1:4, 1:4] 1 2 1 1 2 2 14 16 27 30 ... 454s OP = '/', na.rm = FALSE 454s num [1:4, 1:4] 1 1 NA NA NA ... 454s num [1:4, 1:4] 1 2 NA NA NA ... 454s OP = '/', na.rm = TRUE 454s num [1:4, 1:4] 1 1 NA NA NA ... 454s num [1:4, 1:4] 1 2 NA NA NA ... 454s OP = '+', na.rm = FALSE 454s num [1:4, 1:4] NA 4 NA 8 NA 8 NA 12 NA 12 ... 454s num [1:4, 1:4] NA NA NA NA 7 8 9 10 NA NA ... 454s OP = '+', na.rm = TRUE 454s num [1:4, 1:4] 1 4 3 8 5 8 7 12 9 12 ... 454s num [1:4, 1:4] 1 2 3 4 7 8 9 10 9 10 ... 454s OP = '-', na.rm = FALSE 454s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 454s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 454s OP = '-', na.rm = TRUE 454s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 454s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 454s OP = '*', na.rm = FALSE 454s num [1:4, 1:4] NA 4 NA 16 NA 12 NA 32 NA 20 ... 454s num [1:4, 1:4] NA NA NA NA 10 12 14 16 NA NA ... 454s OP = '*', na.rm = TRUE 454s num [1:4, 1:4] 1 4 3 16 5 12 7 32 9 20 ... 454s num [1:4, 1:4] 1 2 3 4 10 12 14 16 9 10 ... 454s OP = '/', na.rm = FALSE 454s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 454s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 454s OP = '/', na.rm = TRUE 454s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 454s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 454s OP = '+', na.rm = FALSE 454s num [1:4, 1:4] NA 4 NA NA NA NA NA 12 NA 12 ... 454s num [1:4, 1:4] NA NA NA NA NA NA 9 10 NA NA ... 454s OP = '+', na.rm = TRUE 454s num [1:4, 1:4] 1 4 NA 4 NA 2 7 12 9 12 ... 454s num [1:4, 1:4] 1 2 NA NA 2 2 9 10 9 10 ... 454s OP = '-', na.rm = FALSE 454s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 454s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 454s OP = '-', na.rm = TRUE 454s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 454s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 454s OP = '*', na.rm = FALSE 454s num [1:4, 1:4] NA 4 NA NA NA NA NA 32 NA 20 ... 454s num [1:4, 1:4] NA NA NA NA NA NA 14 16 NA NA ... 454s OP = '*', na.rm = TRUE 454s num [1:4, 1:4] 1 4 NA 4 NA 2 7 32 9 20 ... 454s num [1:4, 1:4] 1 2 NA NA 2 2 14 16 9 10 ... 454s OP = '/', na.rm = FALSE 454s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 454s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 454s OP = '/', na.rm = TRUE 454s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 454s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 454s > 454s > 454s > 454s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 454s > # Length differences 454s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 454s > x <- matrix(1:8, nrow = 2, ncol = 4) 454s > y <- 1:ncol(x) 454s > storage.mode(y) <- storage.mode(x) 454s > 454s > for (OP in c("+", "-", "*", "/")) { 454s + for (na.rm in c(FALSE, TRUE)) { 454s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 454s + 454s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 454s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 454s + str(a1) 454s + stopifnot(all.equal(a1, a0)) 454s + 454s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 454s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 454s + str(b1) 454s + stopifnot(all.equal(b1, b0)) 454s + } 454s + } 454s OP = '+', na.rm = FALSE 454s int [1:2, 1:4] 2 4 6 8 6 8 10 12 454s int [1:2, 1:4] 2 3 5 6 8 9 11 12 454s OP = '+', na.rm = TRUE 454s int [1:2, 1:4] 2 4 6 8 6 8 10 12 454s int [1:2, 1:4] 2 3 5 6 8 9 11 12 454s OP = '-', na.rm = FALSE 454s int [1:2, 1:4] 0 0 0 0 4 4 4 4 454s int [1:2, 1:4] 0 1 1 2 2 3 3 4 454s OP = '-', na.rm = TRUE 454s int [1:2, 1:4] 0 0 0 0 4 4 4 4 454s int [1:2, 1:4] 0 1 1 2 2 3 3 4 454s OP = '*', na.rm = FALSE 454s int [1:2, 1:4] 1 4 9 16 5 12 21 32 454s int [1:2, 1:4] 1 2 6 8 15 18 28 32 454s OP = '*', na.rm = TRUE 454s int [1:2, 1:4] 1 4 9 16 5 12 21 32 454s int [1:2, 1:4] 1 2 6 8 15 18 28 32 454s OP = '/', na.rm = FALSE 454s num [1:2, 1:4] 1 1 1 1 5 ... 454s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 454s OP = '/', na.rm = TRUE 454s num [1:2, 1:4] 1 1 1 1 5 ... 454s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 454s > 454s > 454s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 454s > # All missing values 454s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 454s > xs <- list( 454s + A = matrix(1:2, nrow = 2, ncol = 2), 454s + B = matrix(NA_integer_, nrow = 2, ncol = 2) 454s + ) 454s > ys <- list( 454s + A = 1L, 454s + B = NA_integer_ 454s + ) 454s > 454s > for (x in xs) { 454s + for (y in ys) { 454s + for (mode in c("logical", "integer", "double")) { 454s + storage.mode(x) <- mode 454s + storage.mode(y) <- mode 454s + str(list(x = x, y = y)) 454s + 454s + for (OP in c("+", "-", "*", "/")) { 454s + for (na.rm in c(FALSE, TRUE)) { 454s + cat(sprintf("mode = '%s', OP = '%s', na.rm = %s\n", mode, OP, na.rm)) 454s + suppressWarnings({ 454s + z0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 454s + z <- x_OP_y(x, y, OP, na.rm = na.rm) 454s + }) 454s + str(z) 454s + stopifnot(all.equal(z, z0)) 454s + } 454s + } 454s + } # for (mode ...) 454s + } # for (y ...) 454s + } # for (x ...) 454s List of 2 454s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 454s $ y: logi TRUE 454s mode = 'logical', OP = '+', na.rm = FALSE 454s int [1:2, 1:2] 2 2 2 2 454s mode = 'logical', OP = '+', na.rm = TRUE 454s int [1:2, 1:2] 2 2 2 2 454s mode = 'logical', OP = '-', na.rm = FALSE 454s int [1:2, 1:2] 0 0 0 0 454s mode = 'logical', OP = '-', na.rm = TRUE 454s int [1:2, 1:2] 0 0 0 0 454s mode = 'logical', OP = '*', na.rm = FALSE 454s int [1:2, 1:2] 1 1 1 1 454s mode = 'logical', OP = '*', na.rm = TRUE 454s int [1:2, 1:2] 1 1 1 1 454s mode = 'logical', OP = '/', na.rm = FALSE 454s num [1:2, 1:2] 1 1 1 1 454s mode = 'logical', OP = '/', na.rm = TRUE 454s num [1:2, 1:2] 1 1 1 1 454s List of 2 454s $ x: int [1:2, 1:2] 1 1 1 1 454s $ y: int 1 454s mode = 'integer', OP = '+', na.rm = FALSE 454s int [1:2, 1:2] 2 2 2 2 454s mode = 'integer', OP = '+', na.rm = TRUE 454s int [1:2, 1:2] 2 2 2 2 454s mode = 'integer', OP = '-', na.rm = FALSE 454s int [1:2, 1:2] 0 0 0 0 454s mode = 'integer', OP = '-', na.rm = TRUE 454s int [1:2, 1:2] 0 0 0 0 454s mode = 'integer', OP = '*', na.rm = FALSE 454s int [1:2, 1:2] 1 1 1 1 454s mode = 'integer', OP = '*', na.rm = TRUE 454s int [1:2, 1:2] 1 1 1 1 454s mode = 'integer', OP = '/', na.rm = FALSE 454s num [1:2, 1:2] 1 1 1 1 454s mode = 'integer', OP = '/', na.rm = TRUE 454s num [1:2, 1:2] 1 1 1 1 454s List of 2 454s $ x: num [1:2, 1:2] 1 1 1 1 454s $ y: num 1 454s mode = 'double', OP = '+', na.rm = FALSE 454s num [1:2, 1:2] 2 2 2 2 454s mode = 'double', OP = '+', na.rm = TRUE 454s num [1:2, 1:2] 2 2 2 2 454s mode = 'double', OP = '-', na.rm = FALSE 454s num [1:2, 1:2] 0 0 0 0 454s mode = 'double', OP = '-', na.rm = TRUE 454s num [1:2, 1:2] 0 0 0 0 454s mode = 'double', OP = '*', na.rm = FALSE 454s num [1:2, 1:2] 1 1 1 1 454s mode = 'double', OP = '*', na.rm = TRUE 454s num [1:2, 1:2] 1 1 1 1 454s mode = 'double', OP = '/', na.rm = FALSE 454s num [1:2, 1:2] 1 1 1 1 454s mode = 'double', OP = '/', na.rm = TRUE 455s num [1:2, 1:2] 1 1 1 1 455s List of 2 455s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 455s $ y: logi NA 455s mode = 'logical', OP = '+', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '+', na.rm = TRUE 455s int [1:2, 1:2] 1 1 1 1 455s mode = 'logical', OP = '-', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '-', na.rm = TRUE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '*', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '*', na.rm = TRUE 455s int [1:2, 1:2] 1 1 1 1 455s mode = 'logical', OP = '/', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '/', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s List of 2 455s $ x: int [1:2, 1:2] 1 1 1 1 455s $ y: int NA 455s mode = 'integer', OP = '+', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '+', na.rm = TRUE 455s int [1:2, 1:2] 1 1 1 1 455s mode = 'integer', OP = '-', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '-', na.rm = TRUE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '*', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '*', na.rm = TRUE 455s int [1:2, 1:2] 1 1 1 1 455s mode = 'integer', OP = '/', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '/', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s List of 2 455s $ x: num [1:2, 1:2] 1 1 1 1 455s $ y: num NA 455s mode = 'double', OP = '+', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '+', na.rm = TRUE 455s num [1:2, 1:2] 1 1 1 1 455s mode = 'double', OP = '-', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '-', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '*', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '*', na.rm = TRUE 455s num [1:2, 1:2] 1 1 1 1 455s mode = 'double', OP = '/', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '/', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s List of 2 455s $ x: logi [1:2, 1:2] NA NA NA NA 455s $ y: logi TRUE 455s mode = 'logical', OP = '+', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '+', na.rm = TRUE 455s int [1:2, 1:2] 1 1 1 1 455s mode = 'logical', OP = '-', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '-', na.rm = TRUE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '*', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '*', na.rm = TRUE 455s int [1:2, 1:2] 1 1 1 1 455s mode = 'logical', OP = '/', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '/', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s List of 2 455s $ x: int [1:2, 1:2] NA NA NA NA 455s $ y: int 1 455s mode = 'integer', OP = '+', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '+', na.rm = TRUE 455s int [1:2, 1:2] 1 1 1 1 455s mode = 'integer', OP = '-', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '-', na.rm = TRUE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '*', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '*', na.rm = TRUE 455s int [1:2, 1:2] 1 1 1 1 455s mode = 'integer', OP = '/', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '/', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s List of 2 455s $ x: num [1:2, 1:2] NA NA NA NA 455s $ y: num 1 455s mode = 'double', OP = '+', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '+', na.rm = TRUE 455s num [1:2, 1:2] 1 1 1 1 455s mode = 'double', OP = '-', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '-', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '*', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '*', na.rm = TRUE 455s num [1:2, 1:2] 1 1 1 1 455s mode = 'double', OP = '/', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '/', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s List of 2 455s $ x: logi [1:2, 1:2] NA NA NA NA 455s $ y: logi NA 455s mode = 'logical', OP = '+', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '+', na.rm = TRUE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '-', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '-', na.rm = TRUE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '*', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '*', na.rm = TRUE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '/', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'logical', OP = '/', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s List of 2 455s $ x: int [1:2, 1:2] NA NA NA NA 455s $ y: int NA 455s mode = 'integer', OP = '+', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '+', na.rm = TRUE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '-', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '-', na.rm = TRUE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '*', na.rm = FALSE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '*', na.rm = TRUE 455s int [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '/', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'integer', OP = '/', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s List of 2 455s $ x: num [1:2, 1:2] NA NA NA NA 455s $ y: num NA 455s mode = 'double', OP = '+', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '+', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '-', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '-', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '*', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '*', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '/', na.rm = FALSE 455s num [1:2, 1:2] NA NA NA NA 455s mode = 'double', OP = '/', na.rm = TRUE 455s num [1:2, 1:2] NA NA NA NA 455s > 455s 455s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 455s Copyright (C) 2025 The R Foundation for Statistical Computing 455s Platform: aarch64-unknown-linux-gnu 455s 455s R is free software and comes with ABSOLUTELY NO WARRANTY. 455s You are welcome to redistribute it under certain conditions. 455s Type 'license()' or 'licence()' for distribution details. 455s 455s R is a collaborative project with many contributors. 455s Type 'contributors()' for more information and 455s 'citation()' on how to cite R or R packages in publications. 455s 455s Type 'demo()' for some demos, 'help()' for on-line help, or 455s 'help.start()' for an HTML browser interface to help. 455s Type 'q()' to quit R. 455s 455s > library("matrixStats") 455s > 455s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 455s + if (na.rm) { 455s + xnok <- is.na(x) 455s + ynok <- is.na(y) 455s + anok <- xnok & ynok 455s + unit <- switch(OP, 455s + "+" = 0, 455s + "-" = NA_real_, 455s + "*" = 1, 455s + "/" = NA_real_, 455s + stop("Unknown 'OP' operator: ", OP) 455s + ) 455s + x[xnok] <- unit 455s + y[ynok] <- unit 455s + } 455s + 455s + ans <- switch(OP, 455s + "+" = x + y, 455s + "-" = x - y, 455s + "*" = x * y, 455s + "/" = x / y, 455s + stop("Unknown 'OP' operator: ", OP) 455s + ) 455s + 455s + if (na.rm) { 455s + ans[anok] <- NA_real_ 455s + } 455s + 455s + ans 455s + } # x_OP_y_R() 455s > 455s > 455s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 455s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 455s + } 455s > 455s > 455s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 455s > # Subsetted tests 455s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 455s > source("utils/validateIndicesFramework.R") 455s > for (OP in c("+", "-", "*", "/")) { 455s + for (mode in c("numeric", "integer", "logical")) { 455s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 455s + y <- runif(6, min = 0, max = 6) 455s + storage.mode(x) <- mode 455s + storage.mode(y) <- mode 455s + if (mode == "numeric") y[1] <- Inf 455s + 455s + for (xrows in index_cases) { 455s + for (xcols in index_cases) { 455s + if (is.null(xrows)) xrows <- seq_len(nrow(x)) 455s + if (is.null(xcols)) xcols <- seq_len(ncol(x)) 455s + 455s + for (yidxs in list(xrows, xcols)) { 455s + for (na.rm in c(TRUE, FALSE)) { 455s + 455s + suppressWarnings({ 455s + actual <- tryCatch( 455s + x_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 455s + na.rm = na.rm), 455s + error = function(c) "error" 455s + ) 455s + 455s + expect <- tryCatch( 455s + x_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 455s + na.rm = na.rm), 455s + error = function(c) "error" 455s + ) 455s + }) 455s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 455s + 455s + suppressWarnings({ 455s + actual <- tryCatch( 455s + t_tx_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 455s + na.rm = na.rm), 455s + error = function(c) "error" 455s + ) 455s + 455s + expect <- tryCatch( 455s + t_tx_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 455s + na.rm = na.rm), 455s + error = function(c) "error" 455s + ) 455s + }) 455s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 455s + } 455s + } 455s + } 455s + } 455s + } 455s + } 458s > 458s 458s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 458s Copyright (C) 2025 The R Foundation for Statistical Computing 458s Platform: aarch64-unknown-linux-gnu 458s 458s R is free software and comes with ABSOLUTELY NO WARRANTY. 458s You are welcome to redistribute it under certain conditions. 458s Type 'license()' or 'licence()' for distribution details. 458s 458s R is a collaborative project with many contributors. 458s Type 'contributors()' for more information and 458s 'citation()' on how to cite R or R packages in publications. 458s 458s Type 'demo()' for some demos, 'help()' for on-line help, or 458s 'help.start()' for an HTML browser interface to help. 458s Type 'q()' to quit R. 458s 458s > ## These tests need to be last of all tests, otherwise 458s > ## covr::package_coverage() gives an error. 458s > cat("1. Loading package\n") 458s 1. Loading package 458s > loadNamespace("matrixStats") 458s 458s > stopifnot("matrixStats" %in% loadedNamespaces()) 458s > 458s > cat("2. Unloading package\n") 458s 2. Unloading package 458s > unloadNamespace("matrixStats") 458s > stopifnot(!"matrixStats" %in% loadedNamespaces()) 458s > 458s > if (FALSE) { 458s + ## 'covr' gives "Error in library("matrixStats") : 458s + ## there is no package called 'matrixStats'" here, cf. 458s + ## https://travis-ci.org/HenrikBengtsson/matrixStats/builds/48015577 458s + 458s + cat("3. Attaching package\n") 458s + library("matrixStats") 458s + stopifnot("package:matrixStats" %in% search()) 458s + 458s + cat("4. Detaching package\n") 458s + detach("package:matrixStats") 458s + stopifnot(!"package:matrixStats" %in% search()) 458s + stopifnot("matrixStats" %in% loadedNamespaces()) 458s + 458s + cat("5. Unloading package\n") 458s + unloadNamespace("matrixStats") 458s + stopifnot(!"matrixStats" %in% loadedNamespaces()) 458s + 458s + cat("6. Attaching package (again)\n") 458s + library("matrixStats") 458s + stopifnot("package:matrixStats" %in% search()) 458s + 458s + cat("7. Detaching package (again)\n") 458s + detach("package:matrixStats") 458s + stopifnot(!"package:matrixStats" %in% search()) 458s + stopifnot("matrixStats" %in% loadedNamespaces()) 458s + } 458s > 458s > cat("7. DONE\n") 458s 7. DONE 458s > 459s autopkgtest [00:01:04]: test run-unit-test: -----------------------] 459s run-unit-test PASS 459s autopkgtest [00:01:04]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - 460s autopkgtest [00:01:05]: test pkg-r-autopkgtest: preparing testbed 479s Creating nova instance adt-resolute-arm64-r-cran-matrixstats-20260209-235325-juju-7f2275-prod-proposed-migration-environment-20-41e3997e-2454-4969-95cf-1ab1be4b135f from image adt/ubuntu-resolute-arm64-server-20260209.img (UUID 793037ca-75af-461b-82de-f8081300b2e3)... 606s autopkgtest [00:03:31]: testbed dpkg architecture: arm64 606s autopkgtest [00:03:31]: testbed apt version: 3.1.15 606s autopkgtest [00:03:31]: @@@@@@@@@@@@@@@@@@@@ test bed setup 606s autopkgtest [00:03:31]: testbed release detected to be: resolute 607s autopkgtest [00:03:32]: updating testbed package index (apt update) 607s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [124 kB] 608s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 608s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 608s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 608s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [1645 kB] 611s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [29.4 kB] 611s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [176 kB] 611s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 Packages [246 kB] 611s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/main arm64 c-n-f Metadata [6216 B] 611s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/restricted arm64 c-n-f Metadata [304 B] 611s Get:11 http://ftpmaster.internal/ubuntu resolute-proposed/universe arm64 Packages [1580 kB] 614s Get:12 http://ftpmaster.internal/ubuntu resolute-proposed/universe arm64 c-n-f Metadata [32.0 kB] 614s Get:13 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse arm64 Packages [21.7 kB] 614s Get:14 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse arm64 c-n-f Metadata [688 B] 616s Fetched 3862 kB in 7s (559 kB/s) 616s Reading package lists... 617s Hit:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease 617s Hit:2 http://ftpmaster.internal/ubuntu resolute InRelease 617s Hit:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease 617s Hit:4 http://ftpmaster.internal/ubuntu resolute-security InRelease 618s Reading package lists... 618s Reading package lists... 618s Building dependency tree... 618s Reading state information... 619s Calculating upgrade... 619s The following packages will be upgraded: 619s cryptsetup-bin dracut-install iproute2 iptables libcryptsetup12 libip4tc2 619s libip6tc2 libxtables12 wget 619s 9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 619s Need to get 2534 kB of archives. 619s After this operation, 18.4 kB of additional disk space will be used. 619s Get:1 http://ftpmaster.internal/ubuntu resolute/main arm64 iptables arm64 1.8.11-2ubuntu3 [386 kB] 619s Get:2 http://ftpmaster.internal/ubuntu resolute/main arm64 libip4tc2 arm64 1.8.11-2ubuntu3 [24.3 kB] 619s Get:3 http://ftpmaster.internal/ubuntu resolute/main arm64 libip6tc2 arm64 1.8.11-2ubuntu3 [24.7 kB] 619s Get:4 http://ftpmaster.internal/ubuntu resolute/main arm64 libxtables12 arm64 1.8.11-2ubuntu3 [36.7 kB] 619s Get:5 http://ftpmaster.internal/ubuntu resolute/main arm64 iproute2 arm64 6.18.0-1ubuntu1 [1171 kB] 621s Get:6 http://ftpmaster.internal/ubuntu resolute/main arm64 libcryptsetup12 arm64 2:2.8.0-1ubuntu3 [274 kB] 621s Get:7 http://ftpmaster.internal/ubuntu resolute/main arm64 wget arm64 1.25.0-2ubuntu4 [344 kB] 621s Get:8 http://ftpmaster.internal/ubuntu resolute/main arm64 cryptsetup-bin arm64 2:2.8.0-1ubuntu3 [227 kB] 621s Get:9 http://ftpmaster.internal/ubuntu resolute/main arm64 dracut-install arm64 109-11ubuntu1 [45.3 kB] 621s dpkg-preconfigure: unable to re-open stdin: No such file or directory 621s Fetched 2534 kB in 2s (1138 kB/s) 622s (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 ... 136597 files and directories currently installed.) 622s Preparing to unpack .../0-iptables_1.8.11-2ubuntu3_arm64.deb ... 622s Unpacking iptables (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 622s Preparing to unpack .../1-libip4tc2_1.8.11-2ubuntu3_arm64.deb ... 622s Unpacking libip4tc2:arm64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 622s Preparing to unpack .../2-libip6tc2_1.8.11-2ubuntu3_arm64.deb ... 622s Unpacking libip6tc2:arm64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 622s Preparing to unpack .../3-libxtables12_1.8.11-2ubuntu3_arm64.deb ... 622s Unpacking libxtables12:arm64 (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 622s Preparing to unpack .../4-iproute2_6.18.0-1ubuntu1_arm64.deb ... 622s Unpacking iproute2 (6.18.0-1ubuntu1) over (6.16.0-1ubuntu3) ... 622s Preparing to unpack .../5-libcryptsetup12_2%3a2.8.0-1ubuntu3_arm64.deb ... 622s Unpacking libcryptsetup12:arm64 (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 622s Preparing to unpack .../6-wget_1.25.0-2ubuntu4_arm64.deb ... 622s Unpacking wget (1.25.0-2ubuntu4) over (1.25.0-2ubuntu3) ... 623s Preparing to unpack .../7-cryptsetup-bin_2%3a2.8.0-1ubuntu3_arm64.deb ... 623s Unpacking cryptsetup-bin (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 623s Preparing to unpack .../8-dracut-install_109-11ubuntu1_arm64.deb ... 623s Unpacking dracut-install (109-11ubuntu1) over (109-9ubuntu1) ... 623s Setting up libip4tc2:arm64 (1.8.11-2ubuntu3) ... 623s Setting up wget (1.25.0-2ubuntu4) ... 623s Setting up libip6tc2:arm64 (1.8.11-2ubuntu3) ... 623s Setting up libxtables12:arm64 (1.8.11-2ubuntu3) ... 623s Setting up dracut-install (109-11ubuntu1) ... 623s Setting up libcryptsetup12:arm64 (2:2.8.0-1ubuntu3) ... 623s Setting up cryptsetup-bin (2:2.8.0-1ubuntu3) ... 623s Setting up iptables (1.8.11-2ubuntu3) ... 623s Setting up iproute2 (6.18.0-1ubuntu1) ... 623s Processing triggers for man-db (2.13.1-1build1) ... 624s Processing triggers for install-info (7.2-5) ... 624s Processing triggers for libc-bin (2.42-2ubuntu4) ... 624s autopkgtest [00:03:49]: upgrading testbed (apt dist-upgrade and autopurge) 624s Reading package lists... 625s Building dependency tree... 625s Reading state information... 625s Calculating upgrade... 625s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 625s Reading package lists... 626s Building dependency tree... 626s Reading state information... 626s Solving dependencies... 626s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 629s Reading package lists... 629s Building dependency tree... 629s Reading state information... 629s Solving dependencies... 629s The following NEW packages will be installed: 629s build-essential cpp cpp-15 cpp-15-aarch64-linux-gnu cpp-aarch64-linux-gnu 629s dctrl-tools fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono 629s fonts-glyphicons-halflings fonts-mathjax g++ g++-15 g++-15-aarch64-linux-gnu 629s g++-aarch64-linux-gnu gcc gcc-15 gcc-15-aarch64-linux-gnu 629s gcc-aarch64-linux-gnu gfortran gfortran-15 gfortran-15-aarch64-linux-gnu 629s gfortran-aarch64-linux-gnu icu-devtools libasan8 libblas-dev libblas3 629s libbz2-dev libc-dev-bin libc6-dev libcairo2 libcc1-0 libcrypt-dev libdatrie1 629s libdeflate-dev libdeflate0 libfontconfig1 libgcc-15-dev libgfortran-15-dev 629s libgfortran5 libgomp1 libgraphite2-3 libharfbuzz0b libhwasan0 libice6 629s libicu-dev libisl23 libitm1 libjbig0 libjpeg-dev libjpeg-turbo8 629s libjpeg-turbo8-dev libjpeg8 libjpeg8-dev libjs-bootstrap libjs-highlight.js 629s libjs-jquery libjs-jquery-datatables libjs-mathjax liblapack-dev liblapack3 629s liblerc4 liblsan0 liblzma-dev libmpc3 libncurses-dev libpango-1.0-0 629s libpangocairo-1.0-0 libpangoft2-1.0-0 libpaper-utils libpaper2 libpcre2-16-0 629s libpcre2-32-0 libpcre2-dev libpcre2-posix3 libpixman-1-0 libpkgconf3 629s libpng-dev libreadline-dev libsharpyuv0 libsm6 libstdc++-15-dev libtcl8.6 629s libthai-data libthai0 libtiff6 libtirpc-dev libtk8.6 libtsan2 libubsan1 629s libwebp7 libxcb-render0 libxcb-shm0 libxft2 libxrender1 libxss1 libxt6t64 629s libzstd-dev linux-libc-dev node-normalize.css pkg-r-autopkgtest pkgconf 629s pkgconf-bin r-base-core r-base-dev r-cran-base64enc r-cran-cli 629s r-cran-commonmark r-cran-evaluate r-cran-farver r-cran-ggplot2 r-cran-glue 629s r-cran-gtable r-cran-highr r-cran-isoband r-cran-knitr r-cran-labeling 629s r-cran-lifecycle r-cran-markdown r-cran-matrixstats r-cran-r6 629s r-cran-rcolorbrewer r-cran-rlang r-cran-s7 r-cran-scales r-cran-vctrs 629s r-cran-viridislite r-cran-withr r-cran-xfun r-cran-yaml rpcsvc-proto unzip 629s x11-common xdg-utils zip zlib1g-dev 629s 0 upgraded, 137 newly installed, 0 to remove and 0 not upgraded. 629s Need to get 168 MB of archives. 629s After this operation, 539 MB of additional disk space will be used. 629s Get:1 http://ftpmaster.internal/ubuntu resolute/main arm64 libc-dev-bin arm64 2.42-2ubuntu4 [22.5 kB] 630s Get:2 http://ftpmaster.internal/ubuntu resolute/main arm64 linux-libc-dev arm64 6.19.0-3.3 [1819 kB] 633s Get:3 http://ftpmaster.internal/ubuntu resolute/main arm64 libcrypt-dev arm64 1:4.5.1-1 [123 kB] 633s Get:4 http://ftpmaster.internal/ubuntu resolute/main arm64 rpcsvc-proto arm64 1.4.3-1build1 [65.6 kB] 633s Get:5 http://ftpmaster.internal/ubuntu resolute/main arm64 libc6-dev arm64 2.42-2ubuntu4 [1765 kB] 638s Get:6 http://ftpmaster.internal/ubuntu resolute/main arm64 libisl23 arm64 0.27-1build1 [676 kB] 640s Get:7 http://ftpmaster.internal/ubuntu resolute/main arm64 libmpc3 arm64 1.3.1-2 [55.6 kB] 640s Get:8 http://ftpmaster.internal/ubuntu resolute/main arm64 cpp-15-aarch64-linux-gnu arm64 15.2.0-12ubuntu1 [11.7 MB] 678s Get:9 http://ftpmaster.internal/ubuntu resolute/main arm64 cpp-15 arm64 15.2.0-12ubuntu1 [1030 B] 678s Get:10 http://ftpmaster.internal/ubuntu resolute/main arm64 cpp-aarch64-linux-gnu arm64 4:15.2.0-4ubuntu1 [5736 B] 678s Get:11 http://ftpmaster.internal/ubuntu resolute/main arm64 cpp arm64 4:15.2.0-4ubuntu1 [22.4 kB] 678s Get:12 http://ftpmaster.internal/ubuntu resolute/main arm64 libcc1-0 arm64 15.2.0-12ubuntu1 [49.0 kB] 678s Get:13 http://ftpmaster.internal/ubuntu resolute/main arm64 libgomp1 arm64 15.2.0-12ubuntu1 [147 kB] 678s Get:14 http://ftpmaster.internal/ubuntu resolute/main arm64 libitm1 arm64 15.2.0-12ubuntu1 [27.8 kB] 678s Get:15 http://ftpmaster.internal/ubuntu resolute/main arm64 libasan8 arm64 15.2.0-12ubuntu1 [2920 kB] 683s Get:16 http://ftpmaster.internal/ubuntu resolute/main arm64 liblsan0 arm64 15.2.0-12ubuntu1 [1316 kB] 685s Get:17 http://ftpmaster.internal/ubuntu resolute/main arm64 libtsan2 arm64 15.2.0-12ubuntu1 [2688 kB] 690s Get:18 http://ftpmaster.internal/ubuntu resolute/main arm64 libubsan1 arm64 15.2.0-12ubuntu1 [1175 kB] 692s Get:19 http://ftpmaster.internal/ubuntu resolute/main arm64 libhwasan0 arm64 15.2.0-12ubuntu1 [1638 kB] 695s Get:20 http://ftpmaster.internal/ubuntu resolute/main arm64 libgcc-15-dev arm64 15.2.0-12ubuntu1 [2600 kB] 699s Get:21 http://ftpmaster.internal/ubuntu resolute/main arm64 gcc-15-aarch64-linux-gnu arm64 15.2.0-12ubuntu1 [23.1 MB] 740s Get:22 http://ftpmaster.internal/ubuntu resolute/main arm64 gcc-15 arm64 15.2.0-12ubuntu1 [519 kB] 740s Get:23 http://ftpmaster.internal/ubuntu resolute/main arm64 gcc-aarch64-linux-gnu arm64 4:15.2.0-4ubuntu1 [1206 B] 740s Get:24 http://ftpmaster.internal/ubuntu resolute/main arm64 gcc arm64 4:15.2.0-4ubuntu1 [5016 B] 740s Get:25 http://ftpmaster.internal/ubuntu resolute/main arm64 libstdc++-15-dev arm64 15.2.0-12ubuntu1 [2549 kB] 744s Get:26 http://ftpmaster.internal/ubuntu resolute/main arm64 g++-15-aarch64-linux-gnu arm64 15.2.0-12ubuntu1 [13.2 MB] 769s Get:27 http://ftpmaster.internal/ubuntu resolute/main arm64 g++-15 arm64 15.2.0-12ubuntu1 [25.3 kB] 769s Get:28 http://ftpmaster.internal/ubuntu resolute/main arm64 g++-aarch64-linux-gnu arm64 4:15.2.0-4ubuntu1 [956 B] 769s Get:29 http://ftpmaster.internal/ubuntu resolute/main arm64 g++ arm64 4:15.2.0-4ubuntu1 [1080 B] 769s Get:30 http://ftpmaster.internal/ubuntu resolute/main arm64 build-essential arm64 12.12ubuntu2 [5254 B] 769s Get:31 http://ftpmaster.internal/ubuntu resolute/main arm64 dctrl-tools arm64 2.24-3build4 [102 kB] 769s Get:32 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-dejavu-mono all 2.37-8build1 [502 kB] 769s Get:33 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-dejavu-core all 2.37-8build1 [834 kB] 771s Get:34 http://ftpmaster.internal/ubuntu resolute/main arm64 fontconfig-config arm64 2.17.1-3ubuntu1 [38.5 kB] 771s Get:35 http://ftpmaster.internal/ubuntu resolute/main arm64 libfontconfig1 arm64 2.17.1-3ubuntu1 [144 kB] 771s Get:36 http://ftpmaster.internal/ubuntu resolute/main arm64 fontconfig arm64 2.17.1-3ubuntu1 [181 kB] 771s Get:37 http://ftpmaster.internal/ubuntu resolute/universe arm64 fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-6 [119 kB] 771s Get:38 http://ftpmaster.internal/ubuntu resolute/main arm64 fonts-mathjax all 2.7.9+dfsg-1build1 [2283 kB] 774s Get:39 http://ftpmaster.internal/ubuntu resolute/main arm64 libgfortran5 arm64 15.2.0-12ubuntu1 [451 kB] 774s Get:40 http://ftpmaster.internal/ubuntu resolute/main arm64 libgfortran-15-dev arm64 15.2.0-12ubuntu1 [490 kB] 774s Get:41 http://ftpmaster.internal/ubuntu resolute/main arm64 gfortran-15-aarch64-linux-gnu arm64 15.2.0-12ubuntu1 [12.5 MB] 795s Get:42 http://ftpmaster.internal/ubuntu resolute/main arm64 gfortran-15 arm64 15.2.0-12ubuntu1 [18.1 kB] 795s Get:43 http://ftpmaster.internal/ubuntu resolute/main arm64 gfortran-aarch64-linux-gnu arm64 4:15.2.0-4ubuntu1 [1022 B] 795s Get:44 http://ftpmaster.internal/ubuntu resolute/main arm64 gfortran arm64 4:15.2.0-4ubuntu1 [1160 B] 795s Get:45 http://ftpmaster.internal/ubuntu resolute/main arm64 icu-devtools arm64 78.2-1ubuntu1 [207 kB] 795s Get:46 http://ftpmaster.internal/ubuntu resolute/main arm64 libblas3 arm64 3.12.1-7ubuntu1 [181 kB] 795s Get:47 http://ftpmaster.internal/ubuntu resolute/main arm64 libblas-dev arm64 3.12.1-7ubuntu1 [160 kB] 795s Get:48 http://ftpmaster.internal/ubuntu resolute/main arm64 libbz2-dev arm64 1.0.8-6build2 [34.9 kB] 795s Get:49 http://ftpmaster.internal/ubuntu resolute/main arm64 libpixman-1-0 arm64 0.46.4-1 [204 kB] 795s Get:50 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-render0 arm64 1.17.0-2ubuntu1 [16.4 kB] 795s Get:51 http://ftpmaster.internal/ubuntu resolute/main arm64 libxcb-shm0 arm64 1.17.0-2ubuntu1 [5938 B] 795s Get:52 http://ftpmaster.internal/ubuntu resolute/main arm64 libxrender1 arm64 1:0.9.12-1 [19.5 kB] 795s Get:53 http://ftpmaster.internal/ubuntu resolute/main arm64 libcairo2 arm64 1.18.4-3 [556 kB] 796s Get:54 http://ftpmaster.internal/ubuntu resolute/main arm64 libdatrie1 arm64 0.2.14-1 [19.6 kB] 796s Get:55 http://ftpmaster.internal/ubuntu resolute/main arm64 libdeflate0 arm64 1.23-2build1 [46.8 kB] 796s Get:56 http://ftpmaster.internal/ubuntu resolute/main arm64 libdeflate-dev arm64 1.23-2build1 [54.3 kB] 796s Get:57 http://ftpmaster.internal/ubuntu resolute/main arm64 libgraphite2-3 arm64 1.3.14-11ubuntu1 [72.1 kB] 796s Get:58 http://ftpmaster.internal/ubuntu resolute/main arm64 libharfbuzz0b arm64 12.3.2-1 [510 kB] 796s Get:59 http://ftpmaster.internal/ubuntu resolute/main arm64 x11-common all 1:7.7+24ubuntu1 [22.4 kB] 796s Get:60 http://ftpmaster.internal/ubuntu resolute/main arm64 libice6 arm64 2:1.1.1-1build1 [43.0 kB] 796s Get:61 http://ftpmaster.internal/ubuntu resolute/main arm64 libicu-dev arm64 78.2-1ubuntu1 [12.5 MB] 817s Get:62 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg-turbo8 arm64 2.1.5-4ubuntu3 [161 kB] 817s Get:63 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg-turbo8-dev arm64 2.1.5-4ubuntu3 [301 kB] 817s Get:64 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg8 arm64 8c-2ubuntu11 [2148 B] 817s Get:65 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg8-dev arm64 8c-2ubuntu11 [1484 B] 817s Get:66 http://ftpmaster.internal/ubuntu resolute/main arm64 libjpeg-dev arm64 8c-2ubuntu11 [1482 B] 817s Get:67 http://ftpmaster.internal/ubuntu resolute/universe arm64 libjs-bootstrap all 3.4.1+dfsg-6 [129 kB] 817s Get:68 http://ftpmaster.internal/ubuntu resolute/universe arm64 libjs-highlight.js all 10.7.3+dfsg-2 [144 kB] 817s Get:69 http://ftpmaster.internal/ubuntu resolute/main arm64 libjs-jquery all 3.7.1+dfsg+~3.5.33-1build1 [321 kB] 817s Get:70 http://ftpmaster.internal/ubuntu resolute/universe arm64 libjs-jquery-datatables all 1.11.5+dfsg-2build1 [145 kB] 817s Get:71 http://ftpmaster.internal/ubuntu resolute/main arm64 liblapack3 arm64 3.12.1-7ubuntu1 [2299 kB] 821s Get:72 http://ftpmaster.internal/ubuntu resolute/main arm64 liblapack-dev arm64 3.12.1-7ubuntu1 [4456 kB] 828s Get:73 http://ftpmaster.internal/ubuntu resolute/main arm64 liblerc4 arm64 4.0.0+ds-5ubuntu2 [174 kB] 828s Get:74 http://ftpmaster.internal/ubuntu resolute/main arm64 libncurses-dev arm64 6.6+20251231-1 [391 kB] 828s Get:75 http://ftpmaster.internal/ubuntu resolute/main arm64 libthai-data all 0.1.30-1 [155 kB] 828s Get:76 http://ftpmaster.internal/ubuntu resolute/main arm64 libthai0 arm64 0.1.30-1 [18.3 kB] 828s Get:77 http://ftpmaster.internal/ubuntu resolute/main arm64 libpango-1.0-0 arm64 1.57.0-1 [238 kB] 828s Get:78 http://ftpmaster.internal/ubuntu resolute/main arm64 libpangoft2-1.0-0 arm64 1.57.0-1 [51.5 kB] 828s Get:79 http://ftpmaster.internal/ubuntu resolute/main arm64 libpangocairo-1.0-0 arm64 1.57.0-1 [27.9 kB] 828s Get:80 http://ftpmaster.internal/ubuntu resolute/main arm64 libpaper2 arm64 2.2.5-0.3build1 [17.3 kB] 828s Get:81 http://ftpmaster.internal/ubuntu resolute/main arm64 libpaper-utils arm64 2.2.5-0.3build1 [15.4 kB] 828s Get:82 http://ftpmaster.internal/ubuntu resolute/main arm64 libpcre2-16-0 arm64 10.46-1 [225 kB] 828s Get:83 http://ftpmaster.internal/ubuntu resolute/main arm64 libpcre2-32-0 arm64 10.46-1 [213 kB] 828s Get:84 http://ftpmaster.internal/ubuntu resolute/main arm64 libpcre2-posix3 arm64 10.46-1 [7300 B] 828s Get:85 http://ftpmaster.internal/ubuntu resolute/main arm64 libpcre2-dev arm64 10.46-1 [772 kB] 830s Get:86 http://ftpmaster.internal/ubuntu resolute/main arm64 libpkgconf3 arm64 1.8.1-4build1 [33.7 kB] 830s Get:87 http://ftpmaster.internal/ubuntu resolute/main arm64 zlib1g-dev arm64 1:1.3.dfsg+really1.3.1-1ubuntu2 [899 kB] 831s Get:88 http://ftpmaster.internal/ubuntu resolute/main arm64 libpng-dev arm64 1.6.54-1 [268 kB] 831s Get:89 http://ftpmaster.internal/ubuntu resolute/main arm64 libreadline-dev arm64 8.3-3 [199 kB] 831s Get:90 http://ftpmaster.internal/ubuntu resolute/main arm64 libsharpyuv0 arm64 1.5.0-0.1build1 [16.7 kB] 831s Get:91 http://ftpmaster.internal/ubuntu resolute/main arm64 libsm6 arm64 2:1.2.6-1build1 [16.8 kB] 831s Get:92 http://ftpmaster.internal/ubuntu resolute/main arm64 libtcl8.6 arm64 8.6.17+dfsg-1build1 [983 kB] 832s Get:93 http://ftpmaster.internal/ubuntu resolute/main arm64 libjbig0 arm64 2.1-6.1ubuntu3 [29.2 kB] 832s Get:94 http://ftpmaster.internal/ubuntu resolute/main arm64 libwebp7 arm64 1.5.0-0.1build1 [205 kB] 832s Get:95 http://ftpmaster.internal/ubuntu resolute/main arm64 libtiff6 arm64 4.7.0-3ubuntu3 [196 kB] 832s Get:96 http://ftpmaster.internal/ubuntu resolute/main arm64 libxft2 arm64 2.3.6-1build2 [43.2 kB] 832s Get:97 http://ftpmaster.internal/ubuntu resolute/main arm64 libxss1 arm64 1:1.2.3-1build4 [7102 B] 832s Get:98 http://ftpmaster.internal/ubuntu resolute/main arm64 libtk8.6 arm64 8.6.17-1 [811 kB] 834s Get:99 http://ftpmaster.internal/ubuntu resolute/main arm64 libxt6t64 arm64 1:1.2.1-1.3 [168 kB] 834s Get:100 http://ftpmaster.internal/ubuntu resolute/main arm64 libzstd-dev arm64 1.5.7+dfsg-3 [349 kB] 834s Get:101 http://ftpmaster.internal/ubuntu resolute/universe arm64 node-normalize.css all 8.0.1-5.1 [10.4 kB] 834s Get:102 http://ftpmaster.internal/ubuntu resolute/main arm64 zip arm64 3.0-15ubuntu3 [170 kB] 834s Get:103 http://ftpmaster.internal/ubuntu resolute/main arm64 unzip arm64 6.0-29ubuntu1 [176 kB] 834s Get:104 http://ftpmaster.internal/ubuntu resolute/main arm64 xdg-utils all 1.2.1-2ubuntu2 [66.1 kB] 834s Get:105 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-base-core arm64 4.5.2-1ubuntu2 [28.6 MB] 894s Get:106 http://ftpmaster.internal/ubuntu resolute/main arm64 liblzma-dev arm64 5.8.2-2 [180 kB] 894s Get:107 http://ftpmaster.internal/ubuntu resolute/main arm64 pkgconf-bin arm64 1.8.1-4build1 [21.7 kB] 894s Get:108 http://ftpmaster.internal/ubuntu resolute/main arm64 pkgconf arm64 1.8.1-4build1 [16.8 kB] 894s Get:109 http://ftpmaster.internal/ubuntu resolute/main arm64 libtirpc-dev arm64 1.3.6+ds-1 [202 kB] 894s Get:110 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-base-dev all 4.5.2-1ubuntu2 [1880 B] 894s Get:111 http://ftpmaster.internal/ubuntu resolute/universe arm64 pkg-r-autopkgtest all 20250812 [6158 B] 894s Get:112 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-base64enc arm64 0.1-3-3build1 [28.5 kB] 895s Get:113 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-cli arm64 3.6.4-1 [1374 kB] 897s Get:114 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-commonmark arm64 1.9.5-1 [130 kB] 897s Get:115 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-evaluate all 1.0.5-1 [117 kB] 897s Get:116 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-farver arm64 2.1.2-1 [1344 kB] 899s Get:117 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-glue arm64 1.8.0-1 [163 kB] 899s Get:118 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-rlang arm64 1.1.5-3 [1706 kB] 902s Get:119 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-lifecycle all 1.0.5+dfsg-1 [120 kB] 902s Get:120 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-gtable all 0.3.6+dfsg-1 [199 kB] 902s Get:121 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-isoband arm64 0.2.7-1 [1481 kB] 904s Get:122 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-s7 arm64 0.2.0-1 [329 kB] 904s Get:123 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-labeling all 0.4.3-1 [62.1 kB] 904s Get:124 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-r6 all 2.6.1-1 [101 kB] 904s Get:125 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-rcolorbrewer all 1.1-3-1build2 [54.0 kB] 904s Get:126 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-viridislite all 0.4.3-1 [1088 kB] 906s Get:127 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-scales all 1.4.0-1 [725 kB] 907s Get:128 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-vctrs arm64 0.6.5-1 [1327 kB] 909s Get:129 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-withr all 3.0.2+dfsg-1 [214 kB] 909s Get:130 http://ftpmaster.internal/ubuntu resolute-proposed/universe arm64 r-cran-ggplot2 all 4.0.2+dfsg-1 [4941 kB] 917s Get:131 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-xfun arm64 0.55+dfsg-1 [587 kB] 918s Get:132 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-highr all 0.11+dfsg-1 [38.5 kB] 918s Get:133 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-yaml arm64 2.3.10-1 [108 kB] 918s Get:134 http://ftpmaster.internal/ubuntu resolute/main arm64 libjs-mathjax all 2.7.9+dfsg-1build1 [6017 kB] 928s Get:135 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-knitr all 1.51+dfsg-1 [847 kB] 930s Get:136 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-markdown all 1.13-1 [162 kB] 930s Get:137 http://ftpmaster.internal/ubuntu resolute/universe arm64 r-cran-matrixstats arm64 1.5.0-1 [496 kB] 930s Preconfiguring packages ... 930s Fetched 168 MB in 5min 0s (561 kB/s) 930s Selecting previously unselected package libc-dev-bin. 930s (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 ... 136600 files and directories currently installed.) 930s Preparing to unpack .../000-libc-dev-bin_2.42-2ubuntu4_arm64.deb ... 930s Unpacking libc-dev-bin (2.42-2ubuntu4) ... 930s Selecting previously unselected package linux-libc-dev:arm64. 930s Preparing to unpack .../001-linux-libc-dev_6.19.0-3.3_arm64.deb ... 930s Unpacking linux-libc-dev:arm64 (6.19.0-3.3) ... 930s Selecting previously unselected package libcrypt-dev:arm64. 930s Preparing to unpack .../002-libcrypt-dev_1%3a4.5.1-1_arm64.deb ... 930s Unpacking libcrypt-dev:arm64 (1:4.5.1-1) ... 930s Selecting previously unselected package rpcsvc-proto. 930s Preparing to unpack .../003-rpcsvc-proto_1.4.3-1build1_arm64.deb ... 930s Unpacking rpcsvc-proto (1.4.3-1build1) ... 930s Selecting previously unselected package libc6-dev:arm64. 930s Preparing to unpack .../004-libc6-dev_2.42-2ubuntu4_arm64.deb ... 930s Unpacking libc6-dev:arm64 (2.42-2ubuntu4) ... 931s Selecting previously unselected package libisl23:arm64. 931s Preparing to unpack .../005-libisl23_0.27-1build1_arm64.deb ... 931s Unpacking libisl23:arm64 (0.27-1build1) ... 931s Selecting previously unselected package libmpc3:arm64. 931s Preparing to unpack .../006-libmpc3_1.3.1-2_arm64.deb ... 931s Unpacking libmpc3:arm64 (1.3.1-2) ... 931s Selecting previously unselected package cpp-15-aarch64-linux-gnu. 931s Preparing to unpack .../007-cpp-15-aarch64-linux-gnu_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking cpp-15-aarch64-linux-gnu (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package cpp-15. 931s Preparing to unpack .../008-cpp-15_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking cpp-15 (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package cpp-aarch64-linux-gnu. 931s Preparing to unpack .../009-cpp-aarch64-linux-gnu_4%3a15.2.0-4ubuntu1_arm64.deb ... 931s Unpacking cpp-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 931s Selecting previously unselected package cpp. 931s Preparing to unpack .../010-cpp_4%3a15.2.0-4ubuntu1_arm64.deb ... 931s Unpacking cpp (4:15.2.0-4ubuntu1) ... 931s Selecting previously unselected package libcc1-0:arm64. 931s Preparing to unpack .../011-libcc1-0_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking libcc1-0:arm64 (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package libgomp1:arm64. 931s Preparing to unpack .../012-libgomp1_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking libgomp1:arm64 (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package libitm1:arm64. 931s Preparing to unpack .../013-libitm1_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking libitm1:arm64 (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package libasan8:arm64. 931s Preparing to unpack .../014-libasan8_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking libasan8:arm64 (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package liblsan0:arm64. 931s Preparing to unpack .../015-liblsan0_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking liblsan0:arm64 (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package libtsan2:arm64. 931s Preparing to unpack .../016-libtsan2_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking libtsan2:arm64 (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package libubsan1:arm64. 931s Preparing to unpack .../017-libubsan1_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking libubsan1:arm64 (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package libhwasan0:arm64. 931s Preparing to unpack .../018-libhwasan0_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking libhwasan0:arm64 (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package libgcc-15-dev:arm64. 931s Preparing to unpack .../019-libgcc-15-dev_15.2.0-12ubuntu1_arm64.deb ... 931s Unpacking libgcc-15-dev:arm64 (15.2.0-12ubuntu1) ... 931s Selecting previously unselected package gcc-15-aarch64-linux-gnu. 932s Preparing to unpack .../020-gcc-15-aarch64-linux-gnu_15.2.0-12ubuntu1_arm64.deb ... 932s Unpacking gcc-15-aarch64-linux-gnu (15.2.0-12ubuntu1) ... 932s Selecting previously unselected package gcc-15. 932s Preparing to unpack .../021-gcc-15_15.2.0-12ubuntu1_arm64.deb ... 932s Unpacking gcc-15 (15.2.0-12ubuntu1) ... 932s Selecting previously unselected package gcc-aarch64-linux-gnu. 932s Preparing to unpack .../022-gcc-aarch64-linux-gnu_4%3a15.2.0-4ubuntu1_arm64.deb ... 932s Unpacking gcc-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 932s Selecting previously unselected package gcc. 932s Preparing to unpack .../023-gcc_4%3a15.2.0-4ubuntu1_arm64.deb ... 932s Unpacking gcc (4:15.2.0-4ubuntu1) ... 932s Selecting previously unselected package libstdc++-15-dev:arm64. 932s Preparing to unpack .../024-libstdc++-15-dev_15.2.0-12ubuntu1_arm64.deb ... 932s Unpacking libstdc++-15-dev:arm64 (15.2.0-12ubuntu1) ... 932s Selecting previously unselected package g++-15-aarch64-linux-gnu. 932s Preparing to unpack .../025-g++-15-aarch64-linux-gnu_15.2.0-12ubuntu1_arm64.deb ... 932s Unpacking g++-15-aarch64-linux-gnu (15.2.0-12ubuntu1) ... 932s Selecting previously unselected package g++-15. 932s Preparing to unpack .../026-g++-15_15.2.0-12ubuntu1_arm64.deb ... 932s Unpacking g++-15 (15.2.0-12ubuntu1) ... 932s Selecting previously unselected package g++-aarch64-linux-gnu. 932s Preparing to unpack .../027-g++-aarch64-linux-gnu_4%3a15.2.0-4ubuntu1_arm64.deb ... 932s Unpacking g++-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 932s Selecting previously unselected package g++. 933s Preparing to unpack .../028-g++_4%3a15.2.0-4ubuntu1_arm64.deb ... 933s Unpacking g++ (4:15.2.0-4ubuntu1) ... 933s Selecting previously unselected package build-essential. 933s Preparing to unpack .../029-build-essential_12.12ubuntu2_arm64.deb ... 933s Unpacking build-essential (12.12ubuntu2) ... 933s Selecting previously unselected package dctrl-tools. 933s Preparing to unpack .../030-dctrl-tools_2.24-3build4_arm64.deb ... 933s Unpacking dctrl-tools (2.24-3build4) ... 933s Selecting previously unselected package fonts-dejavu-mono. 933s Preparing to unpack .../031-fonts-dejavu-mono_2.37-8build1_all.deb ... 933s Unpacking fonts-dejavu-mono (2.37-8build1) ... 933s Selecting previously unselected package fonts-dejavu-core. 933s Preparing to unpack .../032-fonts-dejavu-core_2.37-8build1_all.deb ... 933s Unpacking fonts-dejavu-core (2.37-8build1) ... 933s Selecting previously unselected package fontconfig-config. 933s Preparing to unpack .../033-fontconfig-config_2.17.1-3ubuntu1_arm64.deb ... 933s Unpacking fontconfig-config (2.17.1-3ubuntu1) ... 933s Selecting previously unselected package libfontconfig1:arm64. 933s Preparing to unpack .../034-libfontconfig1_2.17.1-3ubuntu1_arm64.deb ... 933s Unpacking libfontconfig1:arm64 (2.17.1-3ubuntu1) ... 933s Selecting previously unselected package fontconfig. 933s Preparing to unpack .../035-fontconfig_2.17.1-3ubuntu1_arm64.deb ... 933s Unpacking fontconfig (2.17.1-3ubuntu1) ... 933s Selecting previously unselected package fonts-glyphicons-halflings. 933s Preparing to unpack .../036-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-6_all.deb ... 933s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 933s Selecting previously unselected package fonts-mathjax. 933s Preparing to unpack .../037-fonts-mathjax_2.7.9+dfsg-1build1_all.deb ... 933s Unpacking fonts-mathjax (2.7.9+dfsg-1build1) ... 933s Selecting previously unselected package libgfortran5:arm64. 933s Preparing to unpack .../038-libgfortran5_15.2.0-12ubuntu1_arm64.deb ... 933s Unpacking libgfortran5:arm64 (15.2.0-12ubuntu1) ... 933s Selecting previously unselected package libgfortran-15-dev:arm64. 933s Preparing to unpack .../039-libgfortran-15-dev_15.2.0-12ubuntu1_arm64.deb ... 933s Unpacking libgfortran-15-dev:arm64 (15.2.0-12ubuntu1) ... 933s Selecting previously unselected package gfortran-15-aarch64-linux-gnu. 933s Preparing to unpack .../040-gfortran-15-aarch64-linux-gnu_15.2.0-12ubuntu1_arm64.deb ... 933s Unpacking gfortran-15-aarch64-linux-gnu (15.2.0-12ubuntu1) ... 934s Selecting previously unselected package gfortran-15. 934s Preparing to unpack .../041-gfortran-15_15.2.0-12ubuntu1_arm64.deb ... 934s Unpacking gfortran-15 (15.2.0-12ubuntu1) ... 934s Selecting previously unselected package gfortran-aarch64-linux-gnu. 934s Preparing to unpack .../042-gfortran-aarch64-linux-gnu_4%3a15.2.0-4ubuntu1_arm64.deb ... 934s Unpacking gfortran-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 934s Selecting previously unselected package gfortran. 934s Preparing to unpack .../043-gfortran_4%3a15.2.0-4ubuntu1_arm64.deb ... 934s Unpacking gfortran (4:15.2.0-4ubuntu1) ... 934s Selecting previously unselected package icu-devtools. 934s Preparing to unpack .../044-icu-devtools_78.2-1ubuntu1_arm64.deb ... 934s Unpacking icu-devtools (78.2-1ubuntu1) ... 934s Selecting previously unselected package libblas3:arm64. 934s Preparing to unpack .../045-libblas3_3.12.1-7ubuntu1_arm64.deb ... 934s Unpacking libblas3:arm64 (3.12.1-7ubuntu1) ... 934s Selecting previously unselected package libblas-dev:arm64. 934s Preparing to unpack .../046-libblas-dev_3.12.1-7ubuntu1_arm64.deb ... 934s Unpacking libblas-dev:arm64 (3.12.1-7ubuntu1) ... 934s Selecting previously unselected package libbz2-dev:arm64. 934s Preparing to unpack .../047-libbz2-dev_1.0.8-6build2_arm64.deb ... 934s Unpacking libbz2-dev:arm64 (1.0.8-6build2) ... 934s Selecting previously unselected package libpixman-1-0:arm64. 934s Preparing to unpack .../048-libpixman-1-0_0.46.4-1_arm64.deb ... 934s Unpacking libpixman-1-0:arm64 (0.46.4-1) ... 934s Selecting previously unselected package libxcb-render0:arm64. 934s Preparing to unpack .../049-libxcb-render0_1.17.0-2ubuntu1_arm64.deb ... 934s Unpacking libxcb-render0:arm64 (1.17.0-2ubuntu1) ... 934s Selecting previously unselected package libxcb-shm0:arm64. 934s Preparing to unpack .../050-libxcb-shm0_1.17.0-2ubuntu1_arm64.deb ... 934s Unpacking libxcb-shm0:arm64 (1.17.0-2ubuntu1) ... 934s Selecting previously unselected package libxrender1:arm64. 934s Preparing to unpack .../051-libxrender1_1%3a0.9.12-1_arm64.deb ... 934s Unpacking libxrender1:arm64 (1:0.9.12-1) ... 934s Selecting previously unselected package libcairo2:arm64. 934s Preparing to unpack .../052-libcairo2_1.18.4-3_arm64.deb ... 934s Unpacking libcairo2:arm64 (1.18.4-3) ... 934s Selecting previously unselected package libdatrie1:arm64. 934s Preparing to unpack .../053-libdatrie1_0.2.14-1_arm64.deb ... 934s Unpacking libdatrie1:arm64 (0.2.14-1) ... 934s Selecting previously unselected package libdeflate0:arm64. 934s Preparing to unpack .../054-libdeflate0_1.23-2build1_arm64.deb ... 934s Unpacking libdeflate0:arm64 (1.23-2build1) ... 934s Selecting previously unselected package libdeflate-dev:arm64. 934s Preparing to unpack .../055-libdeflate-dev_1.23-2build1_arm64.deb ... 934s Unpacking libdeflate-dev:arm64 (1.23-2build1) ... 934s Selecting previously unselected package libgraphite2-3:arm64. 934s Preparing to unpack .../056-libgraphite2-3_1.3.14-11ubuntu1_arm64.deb ... 934s Unpacking libgraphite2-3:arm64 (1.3.14-11ubuntu1) ... 934s Selecting previously unselected package libharfbuzz0b:arm64. 934s Preparing to unpack .../057-libharfbuzz0b_12.3.2-1_arm64.deb ... 934s Unpacking libharfbuzz0b:arm64 (12.3.2-1) ... 934s Selecting previously unselected package x11-common. 934s Preparing to unpack .../058-x11-common_1%3a7.7+24ubuntu1_all.deb ... 934s Unpacking x11-common (1:7.7+24ubuntu1) ... 934s Selecting previously unselected package libice6:arm64. 934s Preparing to unpack .../059-libice6_2%3a1.1.1-1build1_arm64.deb ... 934s Unpacking libice6:arm64 (2:1.1.1-1build1) ... 934s Selecting previously unselected package libicu-dev:arm64. 934s Preparing to unpack .../060-libicu-dev_78.2-1ubuntu1_arm64.deb ... 934s Unpacking libicu-dev:arm64 (78.2-1ubuntu1) ... 935s Selecting previously unselected package libjpeg-turbo8:arm64. 935s Preparing to unpack .../061-libjpeg-turbo8_2.1.5-4ubuntu3_arm64.deb ... 935s Unpacking libjpeg-turbo8:arm64 (2.1.5-4ubuntu3) ... 935s Selecting previously unselected package libjpeg-turbo8-dev:arm64. 935s Preparing to unpack .../062-libjpeg-turbo8-dev_2.1.5-4ubuntu3_arm64.deb ... 935s Unpacking libjpeg-turbo8-dev:arm64 (2.1.5-4ubuntu3) ... 935s Selecting previously unselected package libjpeg8:arm64. 935s Preparing to unpack .../063-libjpeg8_8c-2ubuntu11_arm64.deb ... 935s Unpacking libjpeg8:arm64 (8c-2ubuntu11) ... 935s Selecting previously unselected package libjpeg8-dev:arm64. 935s Preparing to unpack .../064-libjpeg8-dev_8c-2ubuntu11_arm64.deb ... 935s Unpacking libjpeg8-dev:arm64 (8c-2ubuntu11) ... 935s Selecting previously unselected package libjpeg-dev:arm64. 935s Preparing to unpack .../065-libjpeg-dev_8c-2ubuntu11_arm64.deb ... 935s Unpacking libjpeg-dev:arm64 (8c-2ubuntu11) ... 935s Selecting previously unselected package libjs-bootstrap. 935s Preparing to unpack .../066-libjs-bootstrap_3.4.1+dfsg-6_all.deb ... 935s Unpacking libjs-bootstrap (3.4.1+dfsg-6) ... 935s Selecting previously unselected package libjs-highlight.js. 935s Preparing to unpack .../067-libjs-highlight.js_10.7.3+dfsg-2_all.deb ... 935s Unpacking libjs-highlight.js (10.7.3+dfsg-2) ... 935s Selecting previously unselected package libjs-jquery. 935s Preparing to unpack .../068-libjs-jquery_3.7.1+dfsg+~3.5.33-1build1_all.deb ... 935s Unpacking libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 935s Selecting previously unselected package libjs-jquery-datatables. 935s Preparing to unpack .../069-libjs-jquery-datatables_1.11.5+dfsg-2build1_all.deb ... 935s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 935s Selecting previously unselected package liblapack3:arm64. 935s Preparing to unpack .../070-liblapack3_3.12.1-7ubuntu1_arm64.deb ... 935s Unpacking liblapack3:arm64 (3.12.1-7ubuntu1) ... 935s Selecting previously unselected package liblapack-dev:arm64. 935s Preparing to unpack .../071-liblapack-dev_3.12.1-7ubuntu1_arm64.deb ... 935s Unpacking liblapack-dev:arm64 (3.12.1-7ubuntu1) ... 935s Selecting previously unselected package liblerc4:arm64. 935s Preparing to unpack .../072-liblerc4_4.0.0+ds-5ubuntu2_arm64.deb ... 935s Unpacking liblerc4:arm64 (4.0.0+ds-5ubuntu2) ... 935s Selecting previously unselected package libncurses-dev:arm64. 935s Preparing to unpack .../073-libncurses-dev_6.6+20251231-1_arm64.deb ... 935s Unpacking libncurses-dev:arm64 (6.6+20251231-1) ... 935s Selecting previously unselected package libthai-data. 935s Preparing to unpack .../074-libthai-data_0.1.30-1_all.deb ... 935s Unpacking libthai-data (0.1.30-1) ... 935s Selecting previously unselected package libthai0:arm64. 935s Preparing to unpack .../075-libthai0_0.1.30-1_arm64.deb ... 935s Unpacking libthai0:arm64 (0.1.30-1) ... 935s Selecting previously unselected package libpango-1.0-0:arm64. 935s Preparing to unpack .../076-libpango-1.0-0_1.57.0-1_arm64.deb ... 935s Unpacking libpango-1.0-0:arm64 (1.57.0-1) ... 935s Selecting previously unselected package libpangoft2-1.0-0:arm64. 936s Preparing to unpack .../077-libpangoft2-1.0-0_1.57.0-1_arm64.deb ... 936s Unpacking libpangoft2-1.0-0:arm64 (1.57.0-1) ... 936s Selecting previously unselected package libpangocairo-1.0-0:arm64. 936s Preparing to unpack .../078-libpangocairo-1.0-0_1.57.0-1_arm64.deb ... 936s Unpacking libpangocairo-1.0-0:arm64 (1.57.0-1) ... 936s Selecting previously unselected package libpaper2:arm64. 936s Preparing to unpack .../079-libpaper2_2.2.5-0.3build1_arm64.deb ... 936s Unpacking libpaper2:arm64 (2.2.5-0.3build1) ... 936s Selecting previously unselected package libpaper-utils. 936s Preparing to unpack .../080-libpaper-utils_2.2.5-0.3build1_arm64.deb ... 936s Unpacking libpaper-utils (2.2.5-0.3build1) ... 936s Selecting previously unselected package libpcre2-16-0:arm64. 936s Preparing to unpack .../081-libpcre2-16-0_10.46-1_arm64.deb ... 936s Unpacking libpcre2-16-0:arm64 (10.46-1) ... 936s Selecting previously unselected package libpcre2-32-0:arm64. 936s Preparing to unpack .../082-libpcre2-32-0_10.46-1_arm64.deb ... 936s Unpacking libpcre2-32-0:arm64 (10.46-1) ... 936s Selecting previously unselected package libpcre2-posix3:arm64. 936s Preparing to unpack .../083-libpcre2-posix3_10.46-1_arm64.deb ... 936s Unpacking libpcre2-posix3:arm64 (10.46-1) ... 936s Selecting previously unselected package libpcre2-dev:arm64. 936s Preparing to unpack .../084-libpcre2-dev_10.46-1_arm64.deb ... 936s Unpacking libpcre2-dev:arm64 (10.46-1) ... 936s Selecting previously unselected package libpkgconf3:arm64. 936s Preparing to unpack .../085-libpkgconf3_1.8.1-4build1_arm64.deb ... 936s Unpacking libpkgconf3:arm64 (1.8.1-4build1) ... 936s Selecting previously unselected package zlib1g-dev:arm64. 936s Preparing to unpack .../086-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu2_arm64.deb ... 936s Unpacking zlib1g-dev:arm64 (1:1.3.dfsg+really1.3.1-1ubuntu2) ... 936s Selecting previously unselected package libpng-dev:arm64. 936s Preparing to unpack .../087-libpng-dev_1.6.54-1_arm64.deb ... 936s Unpacking libpng-dev:arm64 (1.6.54-1) ... 936s Selecting previously unselected package libreadline-dev:arm64. 936s Preparing to unpack .../088-libreadline-dev_8.3-3_arm64.deb ... 936s Unpacking libreadline-dev:arm64 (8.3-3) ... 936s Selecting previously unselected package libsharpyuv0:arm64. 936s Preparing to unpack .../089-libsharpyuv0_1.5.0-0.1build1_arm64.deb ... 936s Unpacking libsharpyuv0:arm64 (1.5.0-0.1build1) ... 936s Selecting previously unselected package libsm6:arm64. 936s Preparing to unpack .../090-libsm6_2%3a1.2.6-1build1_arm64.deb ... 936s Unpacking libsm6:arm64 (2:1.2.6-1build1) ... 936s Selecting previously unselected package libtcl8.6:arm64. 936s Preparing to unpack .../091-libtcl8.6_8.6.17+dfsg-1build1_arm64.deb ... 936s Unpacking libtcl8.6:arm64 (8.6.17+dfsg-1build1) ... 936s Selecting previously unselected package libjbig0:arm64. 936s Preparing to unpack .../092-libjbig0_2.1-6.1ubuntu3_arm64.deb ... 936s Unpacking libjbig0:arm64 (2.1-6.1ubuntu3) ... 936s Selecting previously unselected package libwebp7:arm64. 936s Preparing to unpack .../093-libwebp7_1.5.0-0.1build1_arm64.deb ... 936s Unpacking libwebp7:arm64 (1.5.0-0.1build1) ... 936s Selecting previously unselected package libtiff6:arm64. 936s Preparing to unpack .../094-libtiff6_4.7.0-3ubuntu3_arm64.deb ... 936s Unpacking libtiff6:arm64 (4.7.0-3ubuntu3) ... 936s Selecting previously unselected package libxft2:arm64. 936s Preparing to unpack .../095-libxft2_2.3.6-1build2_arm64.deb ... 936s Unpacking libxft2:arm64 (2.3.6-1build2) ... 936s Selecting previously unselected package libxss1:arm64. 936s Preparing to unpack .../096-libxss1_1%3a1.2.3-1build4_arm64.deb ... 936s Unpacking libxss1:arm64 (1:1.2.3-1build4) ... 936s Selecting previously unselected package libtk8.6:arm64. 936s Preparing to unpack .../097-libtk8.6_8.6.17-1_arm64.deb ... 936s Unpacking libtk8.6:arm64 (8.6.17-1) ... 936s Selecting previously unselected package libxt6t64:arm64. 936s Preparing to unpack .../098-libxt6t64_1%3a1.2.1-1.3_arm64.deb ... 936s Unpacking libxt6t64:arm64 (1:1.2.1-1.3) ... 936s Selecting previously unselected package libzstd-dev:arm64. 936s Preparing to unpack .../099-libzstd-dev_1.5.7+dfsg-3_arm64.deb ... 936s Unpacking libzstd-dev:arm64 (1.5.7+dfsg-3) ... 937s Selecting previously unselected package node-normalize.css. 937s Preparing to unpack .../100-node-normalize.css_8.0.1-5.1_all.deb ... 937s Unpacking node-normalize.css (8.0.1-5.1) ... 937s Selecting previously unselected package zip. 937s Preparing to unpack .../101-zip_3.0-15ubuntu3_arm64.deb ... 937s Unpacking zip (3.0-15ubuntu3) ... 937s Selecting previously unselected package unzip. 937s Preparing to unpack .../102-unzip_6.0-29ubuntu1_arm64.deb ... 937s Unpacking unzip (6.0-29ubuntu1) ... 937s Selecting previously unselected package xdg-utils. 937s Preparing to unpack .../103-xdg-utils_1.2.1-2ubuntu2_all.deb ... 937s Unpacking xdg-utils (1.2.1-2ubuntu2) ... 937s Selecting previously unselected package r-base-core. 937s Preparing to unpack .../104-r-base-core_4.5.2-1ubuntu2_arm64.deb ... 937s Unpacking r-base-core (4.5.2-1ubuntu2) ... 937s Selecting previously unselected package liblzma-dev:arm64. 937s Preparing to unpack .../105-liblzma-dev_5.8.2-2_arm64.deb ... 937s Unpacking liblzma-dev:arm64 (5.8.2-2) ... 937s Selecting previously unselected package pkgconf-bin. 937s Preparing to unpack .../106-pkgconf-bin_1.8.1-4build1_arm64.deb ... 937s Unpacking pkgconf-bin (1.8.1-4build1) ... 937s Selecting previously unselected package pkgconf:arm64. 937s Preparing to unpack .../107-pkgconf_1.8.1-4build1_arm64.deb ... 937s Unpacking pkgconf:arm64 (1.8.1-4build1) ... 937s Selecting previously unselected package libtirpc-dev:arm64. 937s Preparing to unpack .../108-libtirpc-dev_1.3.6+ds-1_arm64.deb ... 937s Unpacking libtirpc-dev:arm64 (1.3.6+ds-1) ... 937s Selecting previously unselected package r-base-dev. 937s Preparing to unpack .../109-r-base-dev_4.5.2-1ubuntu2_all.deb ... 937s Unpacking r-base-dev (4.5.2-1ubuntu2) ... 937s Selecting previously unselected package pkg-r-autopkgtest. 937s Preparing to unpack .../110-pkg-r-autopkgtest_20250812_all.deb ... 937s Unpacking pkg-r-autopkgtest (20250812) ... 937s Selecting previously unselected package r-cran-base64enc. 937s Preparing to unpack .../111-r-cran-base64enc_0.1-3-3build1_arm64.deb ... 937s Unpacking r-cran-base64enc (0.1-3-3build1) ... 937s Selecting previously unselected package r-cran-cli. 937s Preparing to unpack .../112-r-cran-cli_3.6.4-1_arm64.deb ... 937s Unpacking r-cran-cli (3.6.4-1) ... 937s Selecting previously unselected package r-cran-commonmark. 937s Preparing to unpack .../113-r-cran-commonmark_1.9.5-1_arm64.deb ... 937s Unpacking r-cran-commonmark (1.9.5-1) ... 937s Selecting previously unselected package r-cran-evaluate. 937s Preparing to unpack .../114-r-cran-evaluate_1.0.5-1_all.deb ... 937s Unpacking r-cran-evaluate (1.0.5-1) ... 937s Selecting previously unselected package r-cran-farver. 937s Preparing to unpack .../115-r-cran-farver_2.1.2-1_arm64.deb ... 937s Unpacking r-cran-farver (2.1.2-1) ... 937s Selecting previously unselected package r-cran-glue. 938s Preparing to unpack .../116-r-cran-glue_1.8.0-1_arm64.deb ... 938s Unpacking r-cran-glue (1.8.0-1) ... 938s Selecting previously unselected package r-cran-rlang. 938s Preparing to unpack .../117-r-cran-rlang_1.1.5-3_arm64.deb ... 938s Unpacking r-cran-rlang (1.1.5-3) ... 938s Selecting previously unselected package r-cran-lifecycle. 938s Preparing to unpack .../118-r-cran-lifecycle_1.0.5+dfsg-1_all.deb ... 938s Unpacking r-cran-lifecycle (1.0.5+dfsg-1) ... 938s Selecting previously unselected package r-cran-gtable. 938s Preparing to unpack .../119-r-cran-gtable_0.3.6+dfsg-1_all.deb ... 938s Unpacking r-cran-gtable (0.3.6+dfsg-1) ... 938s Selecting previously unselected package r-cran-isoband. 938s Preparing to unpack .../120-r-cran-isoband_0.2.7-1_arm64.deb ... 938s Unpacking r-cran-isoband (0.2.7-1) ... 938s Selecting previously unselected package r-cran-s7. 938s Preparing to unpack .../121-r-cran-s7_0.2.0-1_arm64.deb ... 938s Unpacking r-cran-s7 (0.2.0-1) ... 938s Selecting previously unselected package r-cran-labeling. 938s Preparing to unpack .../122-r-cran-labeling_0.4.3-1_all.deb ... 938s Unpacking r-cran-labeling (0.4.3-1) ... 938s Selecting previously unselected package r-cran-r6. 938s Preparing to unpack .../123-r-cran-r6_2.6.1-1_all.deb ... 938s Unpacking r-cran-r6 (2.6.1-1) ... 938s Selecting previously unselected package r-cran-rcolorbrewer. 938s Preparing to unpack .../124-r-cran-rcolorbrewer_1.1-3-1build2_all.deb ... 938s Unpacking r-cran-rcolorbrewer (1.1-3-1build2) ... 938s Selecting previously unselected package r-cran-viridislite. 938s Preparing to unpack .../125-r-cran-viridislite_0.4.3-1_all.deb ... 938s Unpacking r-cran-viridislite (0.4.3-1) ... 938s Selecting previously unselected package r-cran-scales. 938s Preparing to unpack .../126-r-cran-scales_1.4.0-1_all.deb ... 938s Unpacking r-cran-scales (1.4.0-1) ... 938s Selecting previously unselected package r-cran-vctrs. 938s Preparing to unpack .../127-r-cran-vctrs_0.6.5-1_arm64.deb ... 938s Unpacking r-cran-vctrs (0.6.5-1) ... 938s Selecting previously unselected package r-cran-withr. 938s Preparing to unpack .../128-r-cran-withr_3.0.2+dfsg-1_all.deb ... 938s Unpacking r-cran-withr (3.0.2+dfsg-1) ... 938s Selecting previously unselected package r-cran-ggplot2. 938s Preparing to unpack .../129-r-cran-ggplot2_4.0.2+dfsg-1_all.deb ... 938s Unpacking r-cran-ggplot2 (4.0.2+dfsg-1) ... 938s Selecting previously unselected package r-cran-xfun. 938s Preparing to unpack .../130-r-cran-xfun_0.55+dfsg-1_arm64.deb ... 938s Unpacking r-cran-xfun (0.55+dfsg-1) ... 938s Selecting previously unselected package r-cran-highr. 938s Preparing to unpack .../131-r-cran-highr_0.11+dfsg-1_all.deb ... 938s Unpacking r-cran-highr (0.11+dfsg-1) ... 938s Selecting previously unselected package r-cran-yaml. 938s Preparing to unpack .../132-r-cran-yaml_2.3.10-1_arm64.deb ... 938s Unpacking r-cran-yaml (2.3.10-1) ... 938s Selecting previously unselected package libjs-mathjax. 938s Preparing to unpack .../133-libjs-mathjax_2.7.9+dfsg-1build1_all.deb ... 938s Unpacking libjs-mathjax (2.7.9+dfsg-1build1) ... 939s Selecting previously unselected package r-cran-knitr. 939s Preparing to unpack .../134-r-cran-knitr_1.51+dfsg-1_all.deb ... 939s Unpacking r-cran-knitr (1.51+dfsg-1) ... 939s Selecting previously unselected package r-cran-markdown. 939s Preparing to unpack .../135-r-cran-markdown_1.13-1_all.deb ... 939s Unpacking r-cran-markdown (1.13-1) ... 939s Selecting previously unselected package r-cran-matrixstats. 939s Preparing to unpack .../136-r-cran-matrixstats_1.5.0-1_arm64.deb ... 939s Unpacking r-cran-matrixstats (1.5.0-1) ... 939s Setting up libgraphite2-3:arm64 (1.3.14-11ubuntu1) ... 939s Setting up libpixman-1-0:arm64 (0.46.4-1) ... 939s Setting up libsharpyuv0:arm64 (1.5.0-0.1build1) ... 939s Setting up fonts-mathjax (2.7.9+dfsg-1build1) ... 939s Setting up liblerc4:arm64 (4.0.0+ds-5ubuntu2) ... 939s Setting up libzstd-dev:arm64 (1.5.7+dfsg-3) ... 939s Setting up libjs-mathjax (2.7.9+dfsg-1build1) ... 939s Setting up libxrender1:arm64 (1:0.9.12-1) ... 939s Setting up libdatrie1:arm64 (0.2.14-1) ... 939s Setting up libxcb-render0:arm64 (1.17.0-2ubuntu1) ... 939s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 939s Setting up unzip (6.0-29ubuntu1) ... 939s Setting up x11-common (1:7.7+24ubuntu1) ... 939s Setting up libdeflate0:arm64 (1.23-2build1) ... 939s Setting up linux-libc-dev:arm64 (6.19.0-3.3) ... 939s Setting up libxcb-shm0:arm64 (1.17.0-2ubuntu1) ... 939s Setting up libgomp1:arm64 (15.2.0-12ubuntu1) ... 939s Setting up libjbig0:arm64 (2.1-6.1ubuntu3) ... 939s Setting up libpcre2-16-0:arm64 (10.46-1) ... 939s Setting up zip (3.0-15ubuntu3) ... 939s Setting up libpcre2-32-0:arm64 (10.46-1) ... 939s Setting up libblas3:arm64 (3.12.1-7ubuntu1) ... 939s 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 939s Setting up libtirpc-dev:arm64 (1.3.6+ds-1) ... 939s Setting up libpkgconf3:arm64 (1.8.1-4build1) ... 939s Setting up rpcsvc-proto (1.4.3-1build1) ... 939s Setting up fonts-dejavu-mono (2.37-8build1) ... 939s Setting up libmpc3:arm64 (1.3.1-2) ... 939s Setting up libtcl8.6:arm64 (8.6.17+dfsg-1build1) ... 939s Setting up icu-devtools (78.2-1ubuntu1) ... 939s Setting up fonts-dejavu-core (2.37-8build1) ... 939s Setting up pkgconf-bin (1.8.1-4build1) ... 939s Setting up libjpeg-turbo8:arm64 (2.1.5-4ubuntu3) ... 939s Setting up libgfortran5:arm64 (15.2.0-12ubuntu1) ... 939s Setting up libwebp7:arm64 (1.5.0-0.1build1) ... 939s Setting up liblzma-dev:arm64 (5.8.2-2) ... 939s Setting up libubsan1:arm64 (15.2.0-12ubuntu1) ... 939s Setting up libpcre2-posix3:arm64 (10.46-1) ... 939s Setting up libjs-highlight.js (10.7.3+dfsg-2) ... 939s Setting up libhwasan0:arm64 (15.2.0-12ubuntu1) ... 939s Setting up libcrypt-dev:arm64 (1:4.5.1-1) ... 939s Setting up libasan8:arm64 (15.2.0-12ubuntu1) ... 939s Setting up libharfbuzz0b:arm64 (12.3.2-1) ... 939s Setting up libthai-data (0.1.30-1) ... 939s Setting up libxss1:arm64 (1:1.2.3-1build4) ... 939s Setting up libpaper2:arm64 (2.2.5-0.3build1) ... 939s Setting up libtsan2:arm64 (15.2.0-12ubuntu1) ... 939s Setting up libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 939s Setting up libisl23:arm64 (0.27-1build1) ... 939s Setting up libc-dev-bin (2.42-2ubuntu4) ... 939s Setting up libdeflate-dev:arm64 (1.23-2build1) ... 939s Setting up node-normalize.css (8.0.1-5.1) ... 939s Setting up xdg-utils (1.2.1-2ubuntu2) ... 939s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 939s Setting up libcc1-0:arm64 (15.2.0-12ubuntu1) ... 939s Setting up liblsan0:arm64 (15.2.0-12ubuntu1) ... 939s Setting up libblas-dev:arm64 (3.12.1-7ubuntu1) ... 939s 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 939s Setting up dctrl-tools (2.24-3build4) ... 940s Setting up libjs-bootstrap (3.4.1+dfsg-6) ... 940s Setting up libitm1:arm64 (15.2.0-12ubuntu1) ... 940s Setting up libjpeg8:arm64 (8c-2ubuntu11) ... 940s Setting up cpp-15-aarch64-linux-gnu (15.2.0-12ubuntu1) ... 940s Setting up libice6:arm64 (2:1.1.1-1build1) ... 940s Setting up liblapack3:arm64 (3.12.1-7ubuntu1) ... 940s 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 940s Setting up libgcc-15-dev:arm64 (15.2.0-12ubuntu1) ... 940s Setting up fontconfig-config (2.17.1-3ubuntu1) ... 940s Setting up libpaper-utils (2.2.5-0.3build1) ... 940s Setting up libgfortran-15-dev:arm64 (15.2.0-12ubuntu1) ... 940s Setting up libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 940s Setting up pkgconf:arm64 (1.8.1-4build1) ... 940s Setting up libthai0:arm64 (0.1.30-1) ... 940s Setting up cpp-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 940s Setting up liblapack-dev:arm64 (3.12.1-7ubuntu1) ... 940s 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 940s Setting up cpp-15 (15.2.0-12ubuntu1) ... 940s Setting up libtiff6:arm64 (4.7.0-3ubuntu3) ... 940s Setting up cpp (4:15.2.0-4ubuntu1) ... 940s Setting up libc6-dev:arm64 (2.42-2ubuntu4) ... 940s Setting up libfontconfig1:arm64 (2.17.1-3ubuntu1) ... 940s Setting up libsm6:arm64 (2:1.2.6-1build1) ... 940s Setting up libicu-dev:arm64 (78.2-1ubuntu1) ... 940s Setting up libbz2-dev:arm64 (1.0.8-6build2) ... 940s Setting up fontconfig (2.17.1-3ubuntu1) ... 942s Regenerating fonts cache... done. 942s Setting up libjpeg-turbo8-dev:arm64 (2.1.5-4ubuntu3) ... 942s Setting up libxft2:arm64 (2.3.6-1build2) ... 942s Setting up libncurses-dev:arm64 (6.6+20251231-1) ... 942s Setting up gcc-15-aarch64-linux-gnu (15.2.0-12ubuntu1) ... 942s Setting up libpcre2-dev:arm64 (10.46-1) ... 942s Setting up libtk8.6:arm64 (8.6.17-1) ... 942s Setting up libpango-1.0-0:arm64 (1.57.0-1) ... 942s Setting up libreadline-dev:arm64 (8.3-3) ... 942s Setting up libcairo2:arm64 (1.18.4-3) ... 942s Setting up gcc-15 (15.2.0-12ubuntu1) ... 942s Setting up libstdc++-15-dev:arm64 (15.2.0-12ubuntu1) ... 942s Setting up gfortran-15-aarch64-linux-gnu (15.2.0-12ubuntu1) ... 942s Setting up g++-15-aarch64-linux-gnu (15.2.0-12ubuntu1) ... 942s Setting up libxt6t64:arm64 (1:1.2.1-1.3) ... 942s Setting up zlib1g-dev:arm64 (1:1.3.dfsg+really1.3.1-1ubuntu2) ... 942s Setting up libpangoft2-1.0-0:arm64 (1.57.0-1) ... 942s Setting up libjpeg8-dev:arm64 (8c-2ubuntu11) ... 942s Setting up g++-15 (15.2.0-12ubuntu1) ... 942s Setting up gfortran-15 (15.2.0-12ubuntu1) ... 942s Setting up libpangocairo-1.0-0:arm64 (1.57.0-1) ... 942s Setting up gcc-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 942s Setting up libpng-dev:arm64 (1.6.54-1) ... 942s Setting up libjpeg-dev:arm64 (8c-2ubuntu11) ... 942s Setting up gcc (4:15.2.0-4ubuntu1) ... 942s Setting up r-base-core (4.5.2-1ubuntu2) ... 942s Creating config file /etc/R/Renviron with new version 942s Setting up r-cran-labeling (0.4.3-1) ... 942s Setting up r-cran-farver (2.1.2-1) ... 942s Setting up r-cran-viridislite (0.4.3-1) ... 942s Setting up g++-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 942s Setting up gfortran-aarch64-linux-gnu (4:15.2.0-4ubuntu1) ... 942s Setting up r-cran-commonmark (1.9.5-1) ... 942s Setting up r-cran-r6 (2.6.1-1) ... 942s Setting up r-cran-rlang (1.1.5-3) ... 942s Setting up r-cran-matrixstats (1.5.0-1) ... 942s Setting up r-cran-xfun (0.55+dfsg-1) ... 942s Setting up r-cran-withr (3.0.2+dfsg-1) ... 942s Setting up r-cran-base64enc (0.1-3-3build1) ... 942s Setting up r-cran-yaml (2.3.10-1) ... 942s Setting up r-cran-evaluate (1.0.5-1) ... 942s Setting up r-cran-highr (0.11+dfsg-1) ... 942s Setting up r-cran-glue (1.8.0-1) ... 942s Setting up r-cran-cli (3.6.4-1) ... 942s Setting up gfortran (4:15.2.0-4ubuntu1) ... 942s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode 942s 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 942s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode 942s 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 942s Setting up r-cran-lifecycle (1.0.5+dfsg-1) ... 942s Setting up r-cran-markdown (1.13-1) ... 942s Setting up r-cran-s7 (0.2.0-1) ... 942s Setting up r-cran-rcolorbrewer (1.1-3-1build2) ... 942s Setting up r-cran-isoband (0.2.7-1) ... 942s Setting up r-cran-scales (1.4.0-1) ... 942s Setting up r-cran-gtable (0.3.6+dfsg-1) ... 942s Setting up r-cran-knitr (1.51+dfsg-1) ... 942s Setting up g++ (4:15.2.0-4ubuntu1) ... 942s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 942s Setting up build-essential (12.12ubuntu2) ... 942s Setting up r-cran-vctrs (0.6.5-1) ... 942s Setting up r-base-dev (4.5.2-1ubuntu2) ... 942s Setting up r-cran-ggplot2 (4.0.2+dfsg-1) ... 942s Setting up pkg-r-autopkgtest (20250812) ... 942s Processing triggers for libc-bin (2.42-2ubuntu4) ... 942s Processing triggers for man-db (2.13.1-1build1) ... 943s Processing triggers for install-info (7.2-5) ... 946s autopkgtest [00:09:11]: test pkg-r-autopkgtest: /usr/share/dh-r/pkg-r-autopkgtest 946s autopkgtest [00:09:11]: test pkg-r-autopkgtest: [----------------------- 946s Test: Try to load the R library matrixStats 946s 946s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 946s Copyright (C) 2025 The R Foundation for Statistical Computing 946s Platform: aarch64-unknown-linux-gnu 946s 946s R is free software and comes with ABSOLUTELY NO WARRANTY. 946s You are welcome to redistribute it under certain conditions. 946s Type 'license()' or 'licence()' for distribution details. 946s 946s R is a collaborative project with many contributors. 946s Type 'contributors()' for more information and 946s 'citation()' on how to cite R or R packages in publications. 946s 946s Type 'demo()' for some demos, 'help()' for on-line help, or 946s 'help.start()' for an HTML browser interface to help. 946s Type 'q()' to quit R. 946s 946s > library('matrixStats') 946s > 947s autopkgtest [00:09:12]: test pkg-r-autopkgtest: -----------------------] 947s pkg-r-autopkgtest PASS 947s autopkgtest [00:09:12]: test pkg-r-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 947s autopkgtest [00:09:12]: @@@@@@@@@@@@@@@@@@@@ summary 947s run-unit-test PASS 947s pkg-r-autopkgtest PASS