0s autopkgtest [23:33:30]: starting date and time: 2026-02-09 23:33:30+0000 0s autopkgtest [23:33:30]: git checkout: 508d4a25 a-v-ssh wait_for_ssh: demote "ssh connection failed" to a debug message 0s autopkgtest [23:33:30]: host juju-7f2275-prod-proposed-migration-environment-9; command line: /home/ubuntu/autopkgtest/runner/autopkgtest --output-dir /tmp/autopkgtest-work.50bya96g/out --timeout-copy=6000 --setup-commands 'ln -s /dev/null /etc/systemd/system/bluetooth.service; printf "http_proxy=http://squid.internal:3128\nhttps_proxy=http://squid.internal:3128\nno_proxy=127.0.0.1,127.0.1.1,localhost,localdomain,internal,login.ubuntu.com,archive.ubuntu.com,ports.ubuntu.com,security.ubuntu.com,ddebs.ubuntu.com,changelogs.ubuntu.com,keyserver.ubuntu.com,launchpadlibrarian.net,launchpadcontent.net,launchpad.net,keystone.ps5.canonical.com,objectstorage.prodstack5.canonical.com,radosgw.ps5.canonical.com\n" >> /etc/environment' --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 -- lxd -r lxd-armhf-10.145.243.46 lxd-armhf-10.145.243.46:autopkgtest/ubuntu/resolute/armhf 30s autopkgtest [23:34:00]: testbed dpkg architecture: armhf 32s autopkgtest [23:34:02]: testbed apt version: 3.1.15 36s autopkgtest [23:34:06]: @@@@@@@@@@@@@@@@@@@@ test bed setup 38s autopkgtest [23:34:08]: testbed release detected to be: None 45s autopkgtest [23:34:15]: updating testbed package index (apt update) 47s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [124 kB] 48s Get:2 http://ftpmaster.internal/ubuntu resolute InRelease [124 kB] 48s Get:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease [124 kB] 48s Get:4 http://ftpmaster.internal/ubuntu resolute-security InRelease [124 kB] 49s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [1645 kB] 52s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [29.4 kB] 52s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [176 kB] 52s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/main armhf Packages [246 kB] 53s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/universe armhf Packages [1405 kB] 55s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse armhf Packages [7452 B] 55s Get:11 http://ftpmaster.internal/ubuntu resolute/main Sources [1398 kB] 58s Get:12 http://ftpmaster.internal/ubuntu resolute/restricted Sources [15.1 kB] 58s Get:13 http://ftpmaster.internal/ubuntu resolute/universe Sources [21.4 MB] 95s Get:14 http://ftpmaster.internal/ubuntu resolute/main armhf Packages [1374 kB] 98s Get:15 http://ftpmaster.internal/ubuntu resolute/universe armhf Packages [15.3 MB] 129s Fetched 43.5 MB in 1min 22s (533 kB/s) 130s Reading package lists... 136s autopkgtest [23:35:46]: upgrading testbed (apt dist-upgrade and autopurge) 137s Reading package lists... 138s Building dependency tree... 138s Reading state information... 138s Calculating upgrade... 138s The following packages will be upgraded: 138s cryptsetup-bin dracut-install iproute2 iptables libcryptsetup12 libip4tc2 138s libip6tc2 libxtables12 wget 139s 9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 139s Need to get 2407 kB of archives. 139s After this operation, 152 kB of additional disk space will be used. 139s Get:1 http://ftpmaster.internal/ubuntu resolute/main armhf iptables armhf 1.8.11-2ubuntu3 [345 kB] 139s Get:2 http://ftpmaster.internal/ubuntu resolute/main armhf libip4tc2 armhf 1.8.11-2ubuntu3 [22.0 kB] 139s Get:3 http://ftpmaster.internal/ubuntu resolute/main armhf libip6tc2 armhf 1.8.11-2ubuntu3 [22.3 kB] 139s Get:4 http://ftpmaster.internal/ubuntu resolute/main armhf libxtables12 armhf 1.8.11-2ubuntu3 [33.5 kB] 140s Get:5 http://ftpmaster.internal/ubuntu resolute/main armhf iproute2 armhf 6.18.0-1ubuntu1 [1123 kB] 143s Get:6 http://ftpmaster.internal/ubuntu resolute/main armhf libcryptsetup12 armhf 2:2.8.0-1ubuntu3 [254 kB] 143s Get:7 http://ftpmaster.internal/ubuntu resolute/main armhf wget armhf 1.25.0-2ubuntu4 [327 kB] 144s Get:8 http://ftpmaster.internal/ubuntu resolute/main armhf cryptsetup-bin armhf 2:2.8.0-1ubuntu3 [232 kB] 145s Get:9 http://ftpmaster.internal/ubuntu resolute/main armhf dracut-install armhf 109-11ubuntu1 [47.9 kB] 145s Preconfiguring packages ... 145s Fetched 2407 kB in 6s (370 kB/s) 146s (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 ... 68683 files and directories currently installed.) 146s Preparing to unpack .../0-iptables_1.8.11-2ubuntu3_armhf.deb ... 146s Unpacking iptables (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 146s Preparing to unpack .../1-libip4tc2_1.8.11-2ubuntu3_armhf.deb ... 146s Unpacking libip4tc2:armhf (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 146s Preparing to unpack .../2-libip6tc2_1.8.11-2ubuntu3_armhf.deb ... 146s Unpacking libip6tc2:armhf (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 146s Preparing to unpack .../3-libxtables12_1.8.11-2ubuntu3_armhf.deb ... 146s Unpacking libxtables12:armhf (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 146s Preparing to unpack .../4-iproute2_6.18.0-1ubuntu1_armhf.deb ... 146s Unpacking iproute2 (6.18.0-1ubuntu1) over (6.16.0-1ubuntu3) ... 146s Preparing to unpack .../5-libcryptsetup12_2%3a2.8.0-1ubuntu3_armhf.deb ... 146s Unpacking libcryptsetup12:armhf (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 146s Preparing to unpack .../6-wget_1.25.0-2ubuntu4_armhf.deb ... 146s Unpacking wget (1.25.0-2ubuntu4) over (1.25.0-2ubuntu3) ... 146s Preparing to unpack .../7-cryptsetup-bin_2%3a2.8.0-1ubuntu3_armhf.deb ... 146s Unpacking cryptsetup-bin (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 146s Preparing to unpack .../8-dracut-install_109-11ubuntu1_armhf.deb ... 146s Unpacking dracut-install (109-11ubuntu1) over (109-9ubuntu1) ... 146s Setting up libip4tc2:armhf (1.8.11-2ubuntu3) ... 146s Setting up wget (1.25.0-2ubuntu4) ... 146s Setting up libip6tc2:armhf (1.8.11-2ubuntu3) ... 146s Setting up libxtables12:armhf (1.8.11-2ubuntu3) ... 146s Setting up dracut-install (109-11ubuntu1) ... 146s Setting up libcryptsetup12:armhf (2:2.8.0-1ubuntu3) ... 146s Setting up cryptsetup-bin (2:2.8.0-1ubuntu3) ... 146s Setting up iptables (1.8.11-2ubuntu3) ... 146s Setting up iproute2 (6.18.0-1ubuntu1) ... 146s Processing triggers for man-db (2.13.1-1build1) ... 147s Processing triggers for install-info (7.2-5) ... 148s Processing triggers for libc-bin (2.42-2ubuntu4) ... 150s Reading package lists... 150s Building dependency tree... 150s Reading state information... 150s Solving dependencies... 151s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 153s autopkgtest [23:36:03]: rebooting testbed after setup commands that affected boot 196s autopkgtest [23:36:46]: testbed running kernel: Linux 6.8.0-87-generic #88~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue Oct 14 14:00:09 UTC 2 222s autopkgtest [23:37:12]: @@@@@@@@@@@@@@@@@@@@ apt-source r-cran-matrixstats 234s Get:1 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (dsc) [2228 B] 234s Get:2 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (tar) [212 kB] 234s Get:3 http://ftpmaster.internal/ubuntu resolute/universe r-cran-matrixstats 1.5.0-1 (diff) [4864 B] 234s gpgv: Signature made Sat Jan 18 11:46:01 2025 UTC 234s gpgv: using RSA key 724D609337113C710550D7473C26763F6C67E6E2 234s gpgv: Can't check signature: No public key 234s dpkg-source: warning: cannot verify inline signature for ./r-cran-matrixstats_1.5.0-1.dsc: no acceptable signature found 234s autopkgtest [23:37:24]: testing package r-cran-matrixstats version 1.5.0-1 237s autopkgtest [23:37:27]: build not needed 240s autopkgtest [23:37:30]: test run-unit-test: preparing testbed 242s Reading package lists... 242s Building dependency tree... 242s Reading state information... 242s Solving dependencies... 243s The following NEW packages will be installed: 243s fontconfig fontconfig-config fonts-dejavu-core fonts-dejavu-mono 243s fonts-glyphicons-halflings fonts-mathjax libblas3 libcairo2 libdatrie1 243s libdeflate0 libfontconfig1 libfreetype6 libgfortran5 libgomp1 libgraphite2-3 243s libharfbuzz0b libice6 libjbig0 libjpeg-turbo8 libjpeg8 libjs-bootstrap 243s libjs-highlight.js libjs-jquery libjs-jquery-datatables libjs-mathjax 243s liblapack3 liblerc4 libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 243s libpaper-utils libpaper2 libpixman-1-0 libsharpyuv0 libsm6 libtcl8.6 243s libthai-data libthai0 libtiff6 libtk8.6 libwebp7 libxcb-render0 libxcb-shm0 243s libxft2 libxrender1 libxss1 libxt6t64 node-normalize.css r-base-core 243s r-cran-base64enc r-cran-cli r-cran-commonmark r-cran-digest r-cran-evaluate 243s r-cran-farver r-cran-ggplot2 r-cran-glue r-cran-gtable r-cran-highr 243s r-cran-isoband r-cran-knitr r-cran-labeling r-cran-lifecycle r-cran-markdown 243s r-cran-matrixstats r-cran-microbenchmark r-cran-r.cache r-cran-r.devices 243s r-cran-r.methodss3 r-cran-r.oo r-cran-r.rsp r-cran-r.utils r-cran-r6 243s r-cran-rcolorbrewer r-cran-rlang r-cran-s7 r-cran-scales r-cran-vctrs 243s r-cran-viridislite r-cran-withr r-cran-xfun r-cran-yaml tcl tcl8.6 unzip 243s x11-common xdg-utils zip 243s 0 upgraded, 88 newly installed, 0 to remove and 0 not upgraded. 243s Need to get 69.6 MB of archives. 243s After this operation, 159 MB of additional disk space will be used. 243s Get:1 http://ftpmaster.internal/ubuntu resolute/main armhf libfreetype6 armhf 2.14.1+dfsg-2 [345 kB] 244s Get:2 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-dejavu-mono all 2.37-8build1 [502 kB] 245s Get:3 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-dejavu-core all 2.37-8build1 [834 kB] 246s Get:4 http://ftpmaster.internal/ubuntu resolute/main armhf fontconfig-config armhf 2.17.1-3ubuntu1 [38.5 kB] 246s Get:5 http://ftpmaster.internal/ubuntu resolute/main armhf libfontconfig1 armhf 2.17.1-3ubuntu1 [117 kB] 246s Get:6 http://ftpmaster.internal/ubuntu resolute/main armhf fontconfig armhf 2.17.1-3ubuntu1 [180 kB] 247s Get:7 http://ftpmaster.internal/ubuntu resolute/universe armhf fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-6 [119 kB] 247s Get:8 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-mathjax all 2.7.9+dfsg-1build1 [2283 kB] 252s Get:9 http://ftpmaster.internal/ubuntu resolute/main armhf libblas3 armhf 3.12.1-7ubuntu1 [133 kB] 252s Get:10 http://ftpmaster.internal/ubuntu resolute/main armhf libpixman-1-0 armhf 0.46.4-1 [196 kB] 253s Get:11 http://ftpmaster.internal/ubuntu resolute/main armhf libxcb-render0 armhf 1.17.0-2ubuntu1 [15.5 kB] 253s Get:12 http://ftpmaster.internal/ubuntu resolute/main armhf libxcb-shm0 armhf 1.17.0-2ubuntu1 [5956 B] 253s Get:13 http://ftpmaster.internal/ubuntu resolute/main armhf libxrender1 armhf 1:0.9.12-1 [16.6 kB] 253s Get:14 http://ftpmaster.internal/ubuntu resolute/main armhf libcairo2 armhf 1.18.4-3 [489 kB] 254s Get:15 http://ftpmaster.internal/ubuntu resolute/main armhf libdatrie1 armhf 0.2.14-1 [16.4 kB] 254s Get:16 http://ftpmaster.internal/ubuntu resolute/main armhf libdeflate0 armhf 1.23-2build1 [38.8 kB] 254s Get:17 http://ftpmaster.internal/ubuntu resolute/main armhf libgfortran5 armhf 15.2.0-12ubuntu1 [334 kB] 255s Get:18 http://ftpmaster.internal/ubuntu resolute/main armhf libgomp1 armhf 15.2.0-12ubuntu1 [129 kB] 255s Get:19 http://ftpmaster.internal/ubuntu resolute/main armhf libgraphite2-3 armhf 1.3.14-11ubuntu1 [65.2 kB] 255s Get:20 http://ftpmaster.internal/ubuntu resolute/main armhf libharfbuzz0b armhf 12.3.2-1 [501 kB] 256s Get:21 http://ftpmaster.internal/ubuntu resolute/main armhf x11-common all 1:7.7+24ubuntu1 [22.4 kB] 256s Get:22 http://ftpmaster.internal/ubuntu resolute/main armhf libice6 armhf 2:1.1.1-1build1 [37.5 kB] 256s Get:23 http://ftpmaster.internal/ubuntu resolute/main armhf libjpeg-turbo8 armhf 2.1.5-4ubuntu3 [129 kB] 256s Get:24 http://ftpmaster.internal/ubuntu resolute/main armhf libjpeg8 armhf 8c-2ubuntu11 [2148 B] 256s Get:25 http://ftpmaster.internal/ubuntu resolute/universe armhf libjs-bootstrap all 3.4.1+dfsg-6 [129 kB] 256s Get:26 http://ftpmaster.internal/ubuntu resolute/universe armhf libjs-highlight.js all 10.7.3+dfsg-2 [144 kB] 257s Get:27 http://ftpmaster.internal/ubuntu resolute/main armhf libjs-jquery all 3.7.1+dfsg+~3.5.33-1build1 [321 kB] 257s Get:28 http://ftpmaster.internal/ubuntu resolute/universe armhf libjs-jquery-datatables all 1.11.5+dfsg-2build1 [145 kB] 257s Get:29 http://ftpmaster.internal/ubuntu resolute/main armhf liblapack3 armhf 3.12.1-7ubuntu1 [2090 kB] 261s Get:30 http://ftpmaster.internal/ubuntu resolute/main armhf liblerc4 armhf 4.0.0+ds-5ubuntu2 [162 kB] 261s Get:31 http://ftpmaster.internal/ubuntu resolute/main armhf libthai-data all 0.1.30-1 [155 kB] 261s Get:32 http://ftpmaster.internal/ubuntu resolute/main armhf libthai0 armhf 0.1.30-1 [15.4 kB] 261s Get:33 http://ftpmaster.internal/ubuntu resolute/main armhf libpango-1.0-0 armhf 1.57.0-1 [218 kB] 262s Get:34 http://ftpmaster.internal/ubuntu resolute/main armhf libpangoft2-1.0-0 armhf 1.57.0-1 [45.2 kB] 262s Get:35 http://ftpmaster.internal/ubuntu resolute/main armhf libpangocairo-1.0-0 armhf 1.57.0-1 [25.3 kB] 262s Get:36 http://ftpmaster.internal/ubuntu resolute/main armhf libpaper2 armhf 2.2.5-0.3build1 [16.3 kB] 262s Get:37 http://ftpmaster.internal/ubuntu resolute/main armhf libpaper-utils armhf 2.2.5-0.3build1 [14.2 kB] 262s Get:38 http://ftpmaster.internal/ubuntu resolute/main armhf libsharpyuv0 armhf 1.5.0-0.1build1 [16.3 kB] 262s Get:39 http://ftpmaster.internal/ubuntu resolute/main armhf libsm6 armhf 2:1.2.6-1build1 [15.3 kB] 262s Get:40 http://ftpmaster.internal/ubuntu resolute/main armhf libtcl8.6 armhf 8.6.17+dfsg-1build1 [918 kB] 264s Get:41 http://ftpmaster.internal/ubuntu resolute/main armhf libjbig0 armhf 2.1-6.1ubuntu3 [25.3 kB] 264s Get:42 http://ftpmaster.internal/ubuntu resolute/main armhf libwebp7 armhf 1.5.0-0.1build1 [189 kB] 264s Get:43 http://ftpmaster.internal/ubuntu resolute/main armhf libtiff6 armhf 4.7.0-3ubuntu3 [188 kB] 264s Get:44 http://ftpmaster.internal/ubuntu resolute/main armhf libxft2 armhf 2.3.6-1build2 [37.2 kB] 264s Get:45 http://ftpmaster.internal/ubuntu resolute/main armhf libxss1 armhf 1:1.2.3-1build4 [6328 B] 264s Get:46 http://ftpmaster.internal/ubuntu resolute/main armhf libtk8.6 armhf 8.6.17-1 [694 kB] 265s Get:47 http://ftpmaster.internal/ubuntu resolute/main armhf libxt6t64 armhf 1:1.2.1-1.3 [145 kB] 266s Get:48 http://ftpmaster.internal/ubuntu resolute/universe armhf node-normalize.css all 8.0.1-5.1 [10.4 kB] 266s Get:49 http://ftpmaster.internal/ubuntu resolute/main armhf zip armhf 3.0-15ubuntu3 [164 kB] 266s Get:50 http://ftpmaster.internal/ubuntu resolute/main armhf unzip armhf 6.0-29ubuntu1 [167 kB] 266s Get:51 http://ftpmaster.internal/ubuntu resolute/main armhf xdg-utils all 1.2.1-2ubuntu2 [66.1 kB] 266s Get:52 http://ftpmaster.internal/ubuntu resolute/universe armhf r-base-core armhf 4.5.2-1ubuntu2 [28.5 MB] 314s Get:53 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-base64enc armhf 0.1-3-3build1 [28.2 kB] 314s Get:54 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-cli armhf 3.6.4-1 [1377 kB] 316s Get:55 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-commonmark armhf 1.9.5-1 [112 kB] 316s Get:56 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-digest armhf 0.6.39-1 [211 kB] 317s Get:57 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-evaluate all 1.0.5-1 [117 kB] 317s Get:58 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-farver armhf 2.1.2-1 [1355 kB] 319s Get:59 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-glue armhf 1.8.0-1 [162 kB] 319s Get:60 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-rlang armhf 1.1.5-3 [1700 kB] 322s Get:61 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-lifecycle all 1.0.5+dfsg-1 [120 kB] 322s Get:62 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-gtable all 0.3.6+dfsg-1 [199 kB] 323s Get:63 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-isoband armhf 0.2.7-1 [1477 kB] 325s Get:64 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-s7 armhf 0.2.0-1 [328 kB] 326s Get:65 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-labeling all 0.4.3-1 [62.1 kB] 326s Get:66 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-r6 all 2.6.1-1 [101 kB] 326s Get:67 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-rcolorbrewer all 1.1-3-1build2 [54.0 kB] 326s Get:68 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-viridislite all 0.4.3-1 [1088 kB] 328s Get:69 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-scales all 1.4.0-1 [725 kB] 329s Get:70 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-vctrs armhf 0.6.5-1 [1310 kB] 333s Get:71 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-withr all 3.0.2+dfsg-1 [214 kB] 333s Get:72 http://ftpmaster.internal/ubuntu resolute-proposed/universe armhf r-cran-ggplot2 all 4.0.2+dfsg-1 [4941 kB] 343s Get:73 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-xfun armhf 0.55+dfsg-1 [589 kB] 344s Get:74 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-highr all 0.11+dfsg-1 [38.5 kB] 344s Get:75 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-yaml armhf 2.3.10-1 [101 kB] 346s Get:76 http://ftpmaster.internal/ubuntu resolute/main armhf libjs-mathjax all 2.7.9+dfsg-1build1 [6017 kB] 355s Get:77 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-knitr all 1.51+dfsg-1 [847 kB] 356s Get:78 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-markdown all 1.13-1 [162 kB] 357s Get:79 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-matrixstats armhf 1.5.0-1 [495 kB] 357s Get:80 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-microbenchmark armhf 1.5.0-1 [67.8 kB] 357s Get:81 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-r.methodss3 all 1.8.2-1 [84.0 kB] 357s Get:82 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-r.oo all 1.27.1-1 [978 kB] 359s Get:83 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-r.utils all 2.13.0-1 [1423 kB] 362s Get:84 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-r.cache all 0.17.0-1 [117 kB] 362s Get:85 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-r.devices all 2.17.3+ds-1 [400 kB] 363s Get:86 http://ftpmaster.internal/ubuntu resolute/main armhf tcl8.6 armhf 8.6.17+dfsg-1build1 [14.6 kB] 363s Get:87 http://ftpmaster.internal/ubuntu resolute/main armhf tcl armhf 8.6.16build1 [4200 B] 363s Get:88 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-r.rsp all 0.46.0+ds-1 [1412 kB] 366s Preconfiguring packages ... 366s Fetched 69.6 MB in 2min 2s (569 kB/s) 366s Selecting previously unselected package libfreetype6:armhf. 367s (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 ... 68686 files and directories currently installed.) 367s Preparing to unpack .../00-libfreetype6_2.14.1+dfsg-2_armhf.deb ... 367s Unpacking libfreetype6:armhf (2.14.1+dfsg-2) ... 367s Selecting previously unselected package fonts-dejavu-mono. 367s Preparing to unpack .../01-fonts-dejavu-mono_2.37-8build1_all.deb ... 367s Unpacking fonts-dejavu-mono (2.37-8build1) ... 367s Selecting previously unselected package fonts-dejavu-core. 367s Preparing to unpack .../02-fonts-dejavu-core_2.37-8build1_all.deb ... 367s Unpacking fonts-dejavu-core (2.37-8build1) ... 367s Selecting previously unselected package fontconfig-config. 367s Preparing to unpack .../03-fontconfig-config_2.17.1-3ubuntu1_armhf.deb ... 367s Unpacking fontconfig-config (2.17.1-3ubuntu1) ... 367s Selecting previously unselected package libfontconfig1:armhf. 367s Preparing to unpack .../04-libfontconfig1_2.17.1-3ubuntu1_armhf.deb ... 367s Unpacking libfontconfig1:armhf (2.17.1-3ubuntu1) ... 367s Selecting previously unselected package fontconfig. 367s Preparing to unpack .../05-fontconfig_2.17.1-3ubuntu1_armhf.deb ... 367s Unpacking fontconfig (2.17.1-3ubuntu1) ... 367s Selecting previously unselected package fonts-glyphicons-halflings. 367s Preparing to unpack .../06-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-6_all.deb ... 367s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 367s Selecting previously unselected package fonts-mathjax. 367s Preparing to unpack .../07-fonts-mathjax_2.7.9+dfsg-1build1_all.deb ... 367s Unpacking fonts-mathjax (2.7.9+dfsg-1build1) ... 367s Selecting previously unselected package libblas3:armhf. 367s Preparing to unpack .../08-libblas3_3.12.1-7ubuntu1_armhf.deb ... 367s Unpacking libblas3:armhf (3.12.1-7ubuntu1) ... 367s Selecting previously unselected package libpixman-1-0:armhf. 367s Preparing to unpack .../09-libpixman-1-0_0.46.4-1_armhf.deb ... 367s Unpacking libpixman-1-0:armhf (0.46.4-1) ... 367s Selecting previously unselected package libxcb-render0:armhf. 367s Preparing to unpack .../10-libxcb-render0_1.17.0-2ubuntu1_armhf.deb ... 367s Unpacking libxcb-render0:armhf (1.17.0-2ubuntu1) ... 367s Selecting previously unselected package libxcb-shm0:armhf. 367s Preparing to unpack .../11-libxcb-shm0_1.17.0-2ubuntu1_armhf.deb ... 367s Unpacking libxcb-shm0:armhf (1.17.0-2ubuntu1) ... 367s Selecting previously unselected package libxrender1:armhf. 367s Preparing to unpack .../12-libxrender1_1%3a0.9.12-1_armhf.deb ... 367s Unpacking libxrender1:armhf (1:0.9.12-1) ... 367s Selecting previously unselected package libcairo2:armhf. 367s Preparing to unpack .../13-libcairo2_1.18.4-3_armhf.deb ... 367s Unpacking libcairo2:armhf (1.18.4-3) ... 367s Selecting previously unselected package libdatrie1:armhf. 367s Preparing to unpack .../14-libdatrie1_0.2.14-1_armhf.deb ... 367s Unpacking libdatrie1:armhf (0.2.14-1) ... 367s Selecting previously unselected package libdeflate0:armhf. 367s Preparing to unpack .../15-libdeflate0_1.23-2build1_armhf.deb ... 367s Unpacking libdeflate0:armhf (1.23-2build1) ... 367s Selecting previously unselected package libgfortran5:armhf. 367s Preparing to unpack .../16-libgfortran5_15.2.0-12ubuntu1_armhf.deb ... 367s Unpacking libgfortran5:armhf (15.2.0-12ubuntu1) ... 367s Selecting previously unselected package libgomp1:armhf. 367s Preparing to unpack .../17-libgomp1_15.2.0-12ubuntu1_armhf.deb ... 369s Unpacking libgomp1:armhf (15.2.0-12ubuntu1) ... 369s Selecting previously unselected package libgraphite2-3:armhf. 369s Preparing to unpack .../18-libgraphite2-3_1.3.14-11ubuntu1_armhf.deb ... 369s Unpacking libgraphite2-3:armhf (1.3.14-11ubuntu1) ... 369s Selecting previously unselected package libharfbuzz0b:armhf. 369s Preparing to unpack .../19-libharfbuzz0b_12.3.2-1_armhf.deb ... 369s Unpacking libharfbuzz0b:armhf (12.3.2-1) ... 369s Selecting previously unselected package x11-common. 369s Preparing to unpack .../20-x11-common_1%3a7.7+24ubuntu1_all.deb ... 369s Unpacking x11-common (1:7.7+24ubuntu1) ... 369s Selecting previously unselected package libice6:armhf. 369s Preparing to unpack .../21-libice6_2%3a1.1.1-1build1_armhf.deb ... 369s Unpacking libice6:armhf (2:1.1.1-1build1) ... 369s Selecting previously unselected package libjpeg-turbo8:armhf. 369s Preparing to unpack .../22-libjpeg-turbo8_2.1.5-4ubuntu3_armhf.deb ... 369s Unpacking libjpeg-turbo8:armhf (2.1.5-4ubuntu3) ... 369s Selecting previously unselected package libjpeg8:armhf. 369s Preparing to unpack .../23-libjpeg8_8c-2ubuntu11_armhf.deb ... 369s Unpacking libjpeg8:armhf (8c-2ubuntu11) ... 369s Selecting previously unselected package libjs-bootstrap. 369s Preparing to unpack .../24-libjs-bootstrap_3.4.1+dfsg-6_all.deb ... 369s Unpacking libjs-bootstrap (3.4.1+dfsg-6) ... 369s Selecting previously unselected package libjs-highlight.js. 369s Preparing to unpack .../25-libjs-highlight.js_10.7.3+dfsg-2_all.deb ... 369s Unpacking libjs-highlight.js (10.7.3+dfsg-2) ... 369s Selecting previously unselected package libjs-jquery. 369s Preparing to unpack .../26-libjs-jquery_3.7.1+dfsg+~3.5.33-1build1_all.deb ... 369s Unpacking libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 369s Selecting previously unselected package libjs-jquery-datatables. 369s Preparing to unpack .../27-libjs-jquery-datatables_1.11.5+dfsg-2build1_all.deb ... 369s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 369s Selecting previously unselected package liblapack3:armhf. 369s Preparing to unpack .../28-liblapack3_3.12.1-7ubuntu1_armhf.deb ... 369s Unpacking liblapack3:armhf (3.12.1-7ubuntu1) ... 369s Selecting previously unselected package liblerc4:armhf. 369s Preparing to unpack .../29-liblerc4_4.0.0+ds-5ubuntu2_armhf.deb ... 369s Unpacking liblerc4:armhf (4.0.0+ds-5ubuntu2) ... 369s Selecting previously unselected package libthai-data. 369s Preparing to unpack .../30-libthai-data_0.1.30-1_all.deb ... 369s Unpacking libthai-data (0.1.30-1) ... 369s Selecting previously unselected package libthai0:armhf. 369s Preparing to unpack .../31-libthai0_0.1.30-1_armhf.deb ... 369s Unpacking libthai0:armhf (0.1.30-1) ... 369s Selecting previously unselected package libpango-1.0-0:armhf. 369s Preparing to unpack .../32-libpango-1.0-0_1.57.0-1_armhf.deb ... 369s Unpacking libpango-1.0-0:armhf (1.57.0-1) ... 369s Selecting previously unselected package libpangoft2-1.0-0:armhf. 369s Preparing to unpack .../33-libpangoft2-1.0-0_1.57.0-1_armhf.deb ... 369s Unpacking libpangoft2-1.0-0:armhf (1.57.0-1) ... 369s Selecting previously unselected package libpangocairo-1.0-0:armhf. 369s Preparing to unpack .../34-libpangocairo-1.0-0_1.57.0-1_armhf.deb ... 369s Unpacking libpangocairo-1.0-0:armhf (1.57.0-1) ... 369s Selecting previously unselected package libpaper2:armhf. 369s Preparing to unpack .../35-libpaper2_2.2.5-0.3build1_armhf.deb ... 369s Unpacking libpaper2:armhf (2.2.5-0.3build1) ... 369s Selecting previously unselected package libpaper-utils. 369s Preparing to unpack .../36-libpaper-utils_2.2.5-0.3build1_armhf.deb ... 369s Unpacking libpaper-utils (2.2.5-0.3build1) ... 369s Selecting previously unselected package libsharpyuv0:armhf. 369s Preparing to unpack .../37-libsharpyuv0_1.5.0-0.1build1_armhf.deb ... 369s Unpacking libsharpyuv0:armhf (1.5.0-0.1build1) ... 369s Selecting previously unselected package libsm6:armhf. 369s Preparing to unpack .../38-libsm6_2%3a1.2.6-1build1_armhf.deb ... 369s Unpacking libsm6:armhf (2:1.2.6-1build1) ... 369s Selecting previously unselected package libtcl8.6:armhf. 369s Preparing to unpack .../39-libtcl8.6_8.6.17+dfsg-1build1_armhf.deb ... 369s Unpacking libtcl8.6:armhf (8.6.17+dfsg-1build1) ... 369s Selecting previously unselected package libjbig0:armhf. 369s Preparing to unpack .../40-libjbig0_2.1-6.1ubuntu3_armhf.deb ... 369s Unpacking libjbig0:armhf (2.1-6.1ubuntu3) ... 369s Selecting previously unselected package libwebp7:armhf. 369s Preparing to unpack .../41-libwebp7_1.5.0-0.1build1_armhf.deb ... 369s Unpacking libwebp7:armhf (1.5.0-0.1build1) ... 369s Selecting previously unselected package libtiff6:armhf. 369s Preparing to unpack .../42-libtiff6_4.7.0-3ubuntu3_armhf.deb ... 369s Unpacking libtiff6:armhf (4.7.0-3ubuntu3) ... 369s Selecting previously unselected package libxft2:armhf. 369s Preparing to unpack .../43-libxft2_2.3.6-1build2_armhf.deb ... 369s Unpacking libxft2:armhf (2.3.6-1build2) ... 369s Selecting previously unselected package libxss1:armhf. 369s Preparing to unpack .../44-libxss1_1%3a1.2.3-1build4_armhf.deb ... 369s Unpacking libxss1:armhf (1:1.2.3-1build4) ... 369s Selecting previously unselected package libtk8.6:armhf. 369s Preparing to unpack .../45-libtk8.6_8.6.17-1_armhf.deb ... 369s Unpacking libtk8.6:armhf (8.6.17-1) ... 369s Selecting previously unselected package libxt6t64:armhf. 369s Preparing to unpack .../46-libxt6t64_1%3a1.2.1-1.3_armhf.deb ... 369s Unpacking libxt6t64:armhf (1:1.2.1-1.3) ... 369s Selecting previously unselected package node-normalize.css. 369s Preparing to unpack .../47-node-normalize.css_8.0.1-5.1_all.deb ... 369s Unpacking node-normalize.css (8.0.1-5.1) ... 369s Selecting previously unselected package zip. 369s Preparing to unpack .../48-zip_3.0-15ubuntu3_armhf.deb ... 369s Unpacking zip (3.0-15ubuntu3) ... 369s Selecting previously unselected package unzip. 369s Preparing to unpack .../49-unzip_6.0-29ubuntu1_armhf.deb ... 369s Unpacking unzip (6.0-29ubuntu1) ... 369s Selecting previously unselected package xdg-utils. 369s Preparing to unpack .../50-xdg-utils_1.2.1-2ubuntu2_all.deb ... 369s Unpacking xdg-utils (1.2.1-2ubuntu2) ... 369s Selecting previously unselected package r-base-core. 369s Preparing to unpack .../51-r-base-core_4.5.2-1ubuntu2_armhf.deb ... 369s Unpacking r-base-core (4.5.2-1ubuntu2) ... 369s Selecting previously unselected package r-cran-base64enc. 369s Preparing to unpack .../52-r-cran-base64enc_0.1-3-3build1_armhf.deb ... 369s Unpacking r-cran-base64enc (0.1-3-3build1) ... 369s Selecting previously unselected package r-cran-cli. 369s Preparing to unpack .../53-r-cran-cli_3.6.4-1_armhf.deb ... 369s Unpacking r-cran-cli (3.6.4-1) ... 369s Selecting previously unselected package r-cran-commonmark. 369s Preparing to unpack .../54-r-cran-commonmark_1.9.5-1_armhf.deb ... 369s Unpacking r-cran-commonmark (1.9.5-1) ... 369s Selecting previously unselected package r-cran-digest. 369s Preparing to unpack .../55-r-cran-digest_0.6.39-1_armhf.deb ... 369s Unpacking r-cran-digest (0.6.39-1) ... 369s Selecting previously unselected package r-cran-evaluate. 369s Preparing to unpack .../56-r-cran-evaluate_1.0.5-1_all.deb ... 369s Unpacking r-cran-evaluate (1.0.5-1) ... 369s Selecting previously unselected package r-cran-farver. 369s Preparing to unpack .../57-r-cran-farver_2.1.2-1_armhf.deb ... 369s Unpacking r-cran-farver (2.1.2-1) ... 369s Selecting previously unselected package r-cran-glue. 369s Preparing to unpack .../58-r-cran-glue_1.8.0-1_armhf.deb ... 369s Unpacking r-cran-glue (1.8.0-1) ... 370s Selecting previously unselected package r-cran-rlang. 370s Preparing to unpack .../59-r-cran-rlang_1.1.5-3_armhf.deb ... 370s Unpacking r-cran-rlang (1.1.5-3) ... 370s Selecting previously unselected package r-cran-lifecycle. 370s Preparing to unpack .../60-r-cran-lifecycle_1.0.5+dfsg-1_all.deb ... 370s Unpacking r-cran-lifecycle (1.0.5+dfsg-1) ... 370s Selecting previously unselected package r-cran-gtable. 370s Preparing to unpack .../61-r-cran-gtable_0.3.6+dfsg-1_all.deb ... 370s Unpacking r-cran-gtable (0.3.6+dfsg-1) ... 370s Selecting previously unselected package r-cran-isoband. 370s Preparing to unpack .../62-r-cran-isoband_0.2.7-1_armhf.deb ... 370s Unpacking r-cran-isoband (0.2.7-1) ... 370s Selecting previously unselected package r-cran-s7. 370s Preparing to unpack .../63-r-cran-s7_0.2.0-1_armhf.deb ... 370s Unpacking r-cran-s7 (0.2.0-1) ... 370s Selecting previously unselected package r-cran-labeling. 370s Preparing to unpack .../64-r-cran-labeling_0.4.3-1_all.deb ... 370s Unpacking r-cran-labeling (0.4.3-1) ... 370s Selecting previously unselected package r-cran-r6. 370s Preparing to unpack .../65-r-cran-r6_2.6.1-1_all.deb ... 370s Unpacking r-cran-r6 (2.6.1-1) ... 370s Selecting previously unselected package r-cran-rcolorbrewer. 370s Preparing to unpack .../66-r-cran-rcolorbrewer_1.1-3-1build2_all.deb ... 370s Unpacking r-cran-rcolorbrewer (1.1-3-1build2) ... 370s Selecting previously unselected package r-cran-viridislite. 370s Preparing to unpack .../67-r-cran-viridislite_0.4.3-1_all.deb ... 370s Unpacking r-cran-viridislite (0.4.3-1) ... 370s Selecting previously unselected package r-cran-scales. 370s Preparing to unpack .../68-r-cran-scales_1.4.0-1_all.deb ... 370s Unpacking r-cran-scales (1.4.0-1) ... 370s Selecting previously unselected package r-cran-vctrs. 370s Preparing to unpack .../69-r-cran-vctrs_0.6.5-1_armhf.deb ... 370s Unpacking r-cran-vctrs (0.6.5-1) ... 370s Selecting previously unselected package r-cran-withr. 370s Preparing to unpack .../70-r-cran-withr_3.0.2+dfsg-1_all.deb ... 370s Unpacking r-cran-withr (3.0.2+dfsg-1) ... 370s Selecting previously unselected package r-cran-ggplot2. 370s Preparing to unpack .../71-r-cran-ggplot2_4.0.2+dfsg-1_all.deb ... 370s Unpacking r-cran-ggplot2 (4.0.2+dfsg-1) ... 370s Selecting previously unselected package r-cran-xfun. 370s Preparing to unpack .../72-r-cran-xfun_0.55+dfsg-1_armhf.deb ... 370s Unpacking r-cran-xfun (0.55+dfsg-1) ... 370s Selecting previously unselected package r-cran-highr. 370s Preparing to unpack .../73-r-cran-highr_0.11+dfsg-1_all.deb ... 370s Unpacking r-cran-highr (0.11+dfsg-1) ... 370s Selecting previously unselected package r-cran-yaml. 370s Preparing to unpack .../74-r-cran-yaml_2.3.10-1_armhf.deb ... 370s Unpacking r-cran-yaml (2.3.10-1) ... 370s Selecting previously unselected package libjs-mathjax. 370s Preparing to unpack .../75-libjs-mathjax_2.7.9+dfsg-1build1_all.deb ... 370s Unpacking libjs-mathjax (2.7.9+dfsg-1build1) ... 370s Selecting previously unselected package r-cran-knitr. 370s Preparing to unpack .../76-r-cran-knitr_1.51+dfsg-1_all.deb ... 370s Unpacking r-cran-knitr (1.51+dfsg-1) ... 370s Selecting previously unselected package r-cran-markdown. 370s Preparing to unpack .../77-r-cran-markdown_1.13-1_all.deb ... 370s Unpacking r-cran-markdown (1.13-1) ... 371s Selecting previously unselected package r-cran-matrixstats. 371s Preparing to unpack .../78-r-cran-matrixstats_1.5.0-1_armhf.deb ... 371s Unpacking r-cran-matrixstats (1.5.0-1) ... 371s Selecting previously unselected package r-cran-microbenchmark. 371s Preparing to unpack .../79-r-cran-microbenchmark_1.5.0-1_armhf.deb ... 371s Unpacking r-cran-microbenchmark (1.5.0-1) ... 371s Selecting previously unselected package r-cran-r.methodss3. 371s Preparing to unpack .../80-r-cran-r.methodss3_1.8.2-1_all.deb ... 371s Unpacking r-cran-r.methodss3 (1.8.2-1) ... 371s Selecting previously unselected package r-cran-r.oo. 371s Preparing to unpack .../81-r-cran-r.oo_1.27.1-1_all.deb ... 371s Unpacking r-cran-r.oo (1.27.1-1) ... 371s Selecting previously unselected package r-cran-r.utils. 371s Preparing to unpack .../82-r-cran-r.utils_2.13.0-1_all.deb ... 371s Unpacking r-cran-r.utils (2.13.0-1) ... 371s Selecting previously unselected package r-cran-r.cache. 371s Preparing to unpack .../83-r-cran-r.cache_0.17.0-1_all.deb ... 371s Unpacking r-cran-r.cache (0.17.0-1) ... 371s Selecting previously unselected package r-cran-r.devices. 371s Preparing to unpack .../84-r-cran-r.devices_2.17.3+ds-1_all.deb ... 371s Unpacking r-cran-r.devices (2.17.3+ds-1) ... 371s Selecting previously unselected package tcl8.6. 371s Preparing to unpack .../85-tcl8.6_8.6.17+dfsg-1build1_armhf.deb ... 371s Unpacking tcl8.6 (8.6.17+dfsg-1build1) ... 371s Selecting previously unselected package tcl. 371s Preparing to unpack .../86-tcl_8.6.16build1_armhf.deb ... 371s Unpacking tcl (8.6.16build1) ... 371s Selecting previously unselected package r-cran-r.rsp. 371s Preparing to unpack .../87-r-cran-r.rsp_0.46.0+ds-1_all.deb ... 371s Unpacking r-cran-r.rsp (0.46.0+ds-1) ... 371s Setting up libgraphite2-3:armhf (1.3.14-11ubuntu1) ... 371s Setting up libpixman-1-0:armhf (0.46.4-1) ... 371s Setting up libsharpyuv0:armhf (1.5.0-0.1build1) ... 371s Setting up fonts-mathjax (2.7.9+dfsg-1build1) ... 371s Setting up liblerc4:armhf (4.0.0+ds-5ubuntu2) ... 371s Setting up libjs-mathjax (2.7.9+dfsg-1build1) ... 371s Setting up libxrender1:armhf (1:0.9.12-1) ... 371s Setting up libdatrie1:armhf (0.2.14-1) ... 371s Setting up libxcb-render0:armhf (1.17.0-2ubuntu1) ... 371s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 371s Setting up unzip (6.0-29ubuntu1) ... 371s Setting up x11-common (1:7.7+24ubuntu1) ... 371s Setting up libdeflate0:armhf (1.23-2build1) ... 371s Setting up libxcb-shm0:armhf (1.17.0-2ubuntu1) ... 371s Setting up libgomp1:armhf (15.2.0-12ubuntu1) ... 371s Setting up libjbig0:armhf (2.1-6.1ubuntu3) ... 371s Setting up zip (3.0-15ubuntu3) ... 371s Setting up libblas3:armhf (3.12.1-7ubuntu1) ... 371s update-alternatives: using /usr/lib/arm-linux-gnueabihf/blas/libblas.so.3 to provide /usr/lib/arm-linux-gnueabihf/libblas.so.3 (libblas.so.3-arm-linux-gnueabihf) in auto mode 371s Setting up libfreetype6:armhf (2.14.1+dfsg-2) ... 371s Setting up fonts-dejavu-mono (2.37-8build1) ... 371s Setting up libtcl8.6:armhf (8.6.17+dfsg-1build1) ... 371s Setting up fonts-dejavu-core (2.37-8build1) ... 371s Setting up libjpeg-turbo8:armhf (2.1.5-4ubuntu3) ... 371s Setting up libgfortran5:armhf (15.2.0-12ubuntu1) ... 371s Setting up libwebp7:armhf (1.5.0-0.1build1) ... 371s Setting up libjs-highlight.js (10.7.3+dfsg-2) ... 371s Setting up libharfbuzz0b:armhf (12.3.2-1) ... 371s Setting up libthai-data (0.1.30-1) ... 371s Setting up libxss1:armhf (1:1.2.3-1build4) ... 371s Setting up libpaper2:armhf (2.2.5-0.3build1) ... 372s Setting up libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 372s Setting up node-normalize.css (8.0.1-5.1) ... 372s Setting up xdg-utils (1.2.1-2ubuntu2) ... 372s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 372s Setting up libjs-bootstrap (3.4.1+dfsg-6) ... 372s Setting up libjpeg8:armhf (8c-2ubuntu11) ... 372s Setting up libice6:armhf (2:1.1.1-1build1) ... 372s Setting up tcl8.6 (8.6.17+dfsg-1build1) ... 372s Setting up liblapack3:armhf (3.12.1-7ubuntu1) ... 372s update-alternatives: using /usr/lib/arm-linux-gnueabihf/lapack/liblapack.so.3 to provide /usr/lib/arm-linux-gnueabihf/liblapack.so.3 (liblapack.so.3-arm-linux-gnueabihf) in auto mode 372s Setting up fontconfig-config (2.17.1-3ubuntu1) ... 372s Setting up libpaper-utils (2.2.5-0.3build1) ... 372s Setting up libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 372s Setting up libthai0:armhf (0.1.30-1) ... 372s Setting up libtiff6:armhf (4.7.0-3ubuntu3) ... 372s Setting up tcl (8.6.16build1) ... 372s Setting up libfontconfig1:armhf (2.17.1-3ubuntu1) ... 372s Setting up libsm6:armhf (2:1.2.6-1build1) ... 372s Setting up fontconfig (2.17.1-3ubuntu1) ... 373s Regenerating fonts cache... done. 373s Setting up libxft2:armhf (2.3.6-1build2) ... 373s Setting up libtk8.6:armhf (8.6.17-1) ... 373s Setting up libpango-1.0-0:armhf (1.57.0-1) ... 373s Setting up libcairo2:armhf (1.18.4-3) ... 373s Setting up libxt6t64:armhf (1:1.2.1-1.3) ... 373s Setting up libpangoft2-1.0-0:armhf (1.57.0-1) ... 373s Setting up libpangocairo-1.0-0:armhf (1.57.0-1) ... 373s Setting up r-base-core (4.5.2-1ubuntu2) ... 374s Creating config file /etc/R/Renviron with new version 374s Setting up r-cran-labeling (0.4.3-1) ... 374s Setting up r-cran-farver (2.1.2-1) ... 374s Setting up r-cran-viridislite (0.4.3-1) ... 374s Setting up r-cran-commonmark (1.9.5-1) ... 374s Setting up r-cran-r6 (2.6.1-1) ... 374s Setting up r-cran-microbenchmark (1.5.0-1) ... 374s Setting up r-cran-rlang (1.1.5-3) ... 374s Setting up r-cran-matrixstats (1.5.0-1) ... 374s Setting up r-cran-xfun (0.55+dfsg-1) ... 374s Setting up r-cran-withr (3.0.2+dfsg-1) ... 374s Setting up r-cran-base64enc (0.1-3-3build1) ... 374s Setting up r-cran-digest (0.6.39-1) ... 374s Setting up r-cran-yaml (2.3.10-1) ... 374s Setting up r-cran-evaluate (1.0.5-1) ... 374s Setting up r-cran-highr (0.11+dfsg-1) ... 374s Setting up r-cran-glue (1.8.0-1) ... 374s Setting up r-cran-cli (3.6.4-1) ... 374s Setting up r-cran-lifecycle (1.0.5+dfsg-1) ... 374s Setting up r-cran-r.methodss3 (1.8.2-1) ... 374s Setting up r-cran-markdown (1.13-1) ... 374s Setting up r-cran-s7 (0.2.0-1) ... 374s Setting up r-cran-rcolorbrewer (1.1-3-1build2) ... 374s Setting up r-cran-isoband (0.2.7-1) ... 374s Setting up r-cran-scales (1.4.0-1) ... 374s Setting up r-cran-gtable (0.3.6+dfsg-1) ... 374s Setting up r-cran-knitr (1.51+dfsg-1) ... 374s Setting up r-cran-vctrs (0.6.5-1) ... 374s Setting up r-cran-ggplot2 (4.0.2+dfsg-1) ... 374s Setting up r-cran-r.oo (1.27.1-1) ... 374s Setting up r-cran-r.utils (2.13.0-1) ... 374s Setting up r-cran-r.devices (2.17.3+ds-1) ... 374s Setting up r-cran-r.cache (0.17.0-1) ... 374s Setting up r-cran-r.rsp (0.46.0+ds-1) ... 374s Processing triggers for libc-bin (2.42-2ubuntu4) ... 374s Processing triggers for man-db (2.13.1-1build1) ... 375s Processing triggers for install-info (7.2-5) ... 387s autopkgtest [23:39:57]: test run-unit-test: [----------------------- 391s 391s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 391s Copyright (C) 2025 The R Foundation for Statistical Computing 391s Platform: arm-unknown-linux-gnueabihf (32-bit) 391s 391s R is free software and comes with ABSOLUTELY NO WARRANTY. 391s You are welcome to redistribute it under certain conditions. 391s Type 'license()' or 'licence()' for distribution details. 391s 391s R is a collaborative project with many contributors. 391s Type 'contributors()' for more information and 391s 'citation()' on how to cite R or R packages in publications. 391s 391s Type 'demo()' for some demos, 'help()' for on-line help, or 391s 'help.start()' for an HTML browser interface to help. 391s Type 'q()' to quit R. 391s 391s > library("matrixStats") 391s > 391s > allocArray_R <- function(nrow, ncol, value = NA) { 391s + array(data = value, dim = dim) 391s + } 391s > 391s > values <- list( 391s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 391s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 391s + .Machine$double.xmin, .Machine$double.xmax, 391s + .Machine$double.eps, .Machine$double.neg.eps, 391s + FALSE, TRUE, NA 391s + ) 391s > 391s > dim <- c(2L, 4L, 3L) 391s > for (value in values) { 391s + x0 <- allocArray_R(dim, value = value) 391s + x <- allocArray(dim, value = value) 391s + if (!identical(x, x0)) { 391s + str(list(dim = dim, value = value, x = x, x0 = x0)) 391s + stopifnot(identical(x, x0)) 391s + } 391s + } 391s > 391s 391s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 391s Copyright (C) 2025 The R Foundation for Statistical Computing 391s Platform: arm-unknown-linux-gnueabihf (32-bit) 391s 391s R is free software and comes with ABSOLUTELY NO WARRANTY. 391s You are welcome to redistribute it under certain conditions. 391s Type 'license()' or 'licence()' for distribution details. 391s 391s R is a collaborative project with many contributors. 391s Type 'contributors()' for more information and 391s 'citation()' on how to cite R or R packages in publications. 391s 391s Type 'demo()' for some demos, 'help()' for on-line help, or 391s 'help.start()' for an HTML browser interface to help. 391s Type 'q()' to quit R. 391s 392s > library("matrixStats") 392s > 392s > allocMatrix_R <- function(nrow, ncol, value = NA) { 392s + matrix(data = value, nrow = nrow, ncol = ncol) 392s + } 392s > 392s > values <- list( 392s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 392s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 392s + .Machine$double.xmin, .Machine$double.xmax, 392s + .Machine$double.eps, .Machine$double.neg.eps, 392s + FALSE, TRUE, NA 392s + ) 392s > 392s > nrow <- 2L 392s > ncol <- 3L 392s > for (value in values) { 392s + x0 <- allocMatrix_R(nrow, ncol, value = value) 392s + x <- allocMatrix(nrow, ncol, value = value) 392s + if (!identical(x, x0)) { 392s + str(list(nrow = nrow, ncol = ncol, value = value, x = x, x0 = x0)) 392s + stopifnot(identical(x, x0)) 392s + } 392s + } 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: arm-unknown-linux-gnueabihf (32-bit) 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 > allocVector_R <- function(length, value = NA) { 392s + x <- vector(mode = typeof(value), length = length) 392s + if (!is.finite(value) || value != 0) x[] <- value 392s + x 392s + } 392s > 392s > values <- list( 392s + -1L, 0L, +1L, NA_integer_, .Machine$integer.max, 392s + -1, 0, +1, NA_real_, NaN, -Inf, +Inf, 392s + .Machine$double.xmin, .Machine$double.xmax, 392s + .Machine$double.eps, .Machine$double.neg.eps, 392s + FALSE, TRUE, NA 392s + ) 392s > 392s > n <- 10L 392s > for (value in values) { 392s + x0 <- allocVector_R(n, value = value) 392s + x <- allocVector(n, value = value) 392s + if (!identical(x, x0)) { 392s + str(list(n = n, value = value, x = x, x0 = x0)) 392s + stopifnot(identical(x, x0)) 392s + } 392s + } 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: arm-unknown-linux-gnueabihf (32-bit) 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 > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # Setup 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > data <- data.frame( 392s + logical = c(TRUE, FALSE, TRUE), 392s + integer = 1:3, 392s + double = seq(from = 1.0, to = 3.0, by = 1.0), 392s + complex = seq(from = 1.0, to = 3.0, by = 1.0) + 1.0i, 392s + character = letters[1:3], 392s + stringsAsFactors = FALSE 392s + ) 392s > 392s > modes <- names(data) 392s > 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # Special cases 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > cat("NULL...\n") 392s NULL... 392s > stopifnot(identical(anyMissing(NULL), FALSE)) 392s > cat("NULL...done\n") 392s NULL...done 392s > 392s > cat("raw...\n") 392s raw... 392s > stopifnot(identical(anyMissing(as.raw(0:2)), FALSE)) 392s > cat("raw...done\n") 392s raw...done 392s > 392s > cat("list(NULL)...\n") 392s list(NULL)... 392s > stopifnot(identical(anyMissing(list(NULL)), FALSE)) 392s > cat("list(NULL)...done\n") 392s list(NULL)...done 392s > 392s > 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # Scalars, vectors, and matrices of various modes 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > for (mode in modes) { 392s + cat(sprintf("Mode: %s...\n", mode)) 392s + values <- data[[mode]] 392s + 392s + # Scalars 392s + cat(" scalar\n") 392s + x <- values[1L] 392s + print(x) 392s + stopifnot(identical(anyMissing(x), FALSE)) 392s + is.na(x) <- TRUE 392s + print(x) 392s + stopifnot(identical(anyMissing(x), TRUE)) 392s + 392s + # Vectors 392s + cat(" vector\n") 392s + x <- values 392s + print(x) 392s + stopifnot(identical(anyMissing(x), FALSE)) 392s + is.na(x)[2L] <- TRUE 392s + print(x) 392s + stopifnot(identical(anyMissing(x), TRUE)) 392s + 392s + # Matrices 392s + cat(" matrix\n") 392s + x <- matrix(c(values, values), ncol = 2L) 392s + print(x) 392s + stopifnot(identical(anyMissing(x), FALSE)) 392s + is.na(x)[2L] <- TRUE 392s + print(x) 392s + stopifnot(identical(anyMissing(x), TRUE)) 392s + 392s + cat(sprintf("Mode: %s...done\n", mode)) 392s + } # for (mode ...) 392s Mode: logical... 392s scalar 392s [1] TRUE 392s [1] NA 392s vector 392s [1] TRUE FALSE TRUE 392s [1] TRUE NA TRUE 392s matrix 392s [,1] [,2] 392s [1,] TRUE TRUE 392s [2,] FALSE FALSE 392s [3,] TRUE TRUE 392s [,1] [,2] 392s [1,] TRUE TRUE 392s [2,] NA FALSE 392s [3,] TRUE TRUE 392s Mode: logical...done 392s Mode: integer... 392s scalar 392s [1] 1 392s [1] NA 392s vector 392s [1] 1 2 3 392s [1] 1 NA 3 392s matrix 392s [,1] [,2] 392s [1,] 1 1 392s [2,] 2 2 392s [3,] 3 3 392s [,1] [,2] 392s [1,] 1 1 392s [2,] NA 2 392s [3,] 3 3 392s Mode: integer...done 392s Mode: double... 392s scalar 392s [1] 1 392s [1] NA 392s vector 392s [1] 1 2 3 392s [1] 1 NA 3 392s matrix 392s [,1] [,2] 392s [1,] 1 1 392s [2,] 2 2 392s [3,] 3 3 392s [,1] [,2] 392s [1,] 1 1 392s [2,] NA 2 392s [3,] 3 3 392s Mode: double...done 392s Mode: complex... 392s scalar 392s [1] 1+1i 392s [1] NA 392s vector 392s [1] 1+1i 2+1i 3+1i 392s [1] 1+1i NA 3+1i 392s matrix 392s [,1] [,2] 392s [1,] 1+1i 1+1i 392s [2,] 2+1i 2+1i 392s [3,] 3+1i 3+1i 392s [,1] [,2] 392s [1,] 1+1i 1+1i 392s [2,] NA 2+1i 392s [3,] 3+1i 3+1i 392s Mode: complex...done 392s Mode: character... 392s scalar 392s [1] "a" 392s [1] NA 392s vector 392s [1] "a" "b" "c" 392s [1] "a" NA "c" 392s matrix 392s [,1] [,2] 392s [1,] "a" "a" 392s [2,] "b" "b" 392s [3,] "c" "c" 392s [,1] [,2] 392s [1,] "a" "a" 392s [2,] NA "b" 392s [3,] "c" "c" 392s Mode: character...done 392s > 392s > 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # Data frames 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > cat("data.frame...\n") 392s data.frame... 392s > x <- data 392s > stopifnot(identical(anyMissing(x), FALSE)) 392s > for (mode in modes) { 392s + x <- data 392s + is.na(x[[mode]])[2L] <- TRUE 392s + print(x) 392s + stopifnot(identical(anyMissing(x), TRUE)) 392s + } # for (mode ...) 392s logical integer double complex character 392s 1 TRUE 1 1 1+1i a 392s 2 NA 2 2 2+1i b 392s 3 TRUE 3 3 3+1i c 392s logical integer double complex character 392s 1 TRUE 1 1 1+1i a 392s 2 FALSE NA 2 2+1i b 392s 3 TRUE 3 3 3+1i c 392s logical integer double complex character 392s 1 TRUE 1 1 1+1i a 392s 2 FALSE 2 NA 2+1i b 392s 3 TRUE 3 3 3+1i c 392s logical integer double complex character 392s 1 TRUE 1 1 1+1i a 392s 2 FALSE 2 2 NA b 392s 3 TRUE 3 3 3+1i c 392s logical integer double complex character 392s 1 TRUE 1 1 1+1i a 392s 2 FALSE 2 2 2+1i 392s 3 TRUE 3 3 3+1i c 392s > cat("data.frame...done\n") 392s data.frame...done 392s > 392s > 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # Lists 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > cat("list...\n") 392s list... 392s > x <- as.list(data) 392s > stopifnot(identical(anyMissing(x), FALSE)) 392s > for (mode in modes) { 392s + x <- as.list(data) 392s + is.na(x[[mode]])[2L] <- TRUE 392s + print(x) 392s + stopifnot(identical(anyMissing(x), TRUE)) 392s + } # for (mode ...) 392s $logical 392s [1] TRUE NA TRUE 392s 392s $integer 392s [1] 1 2 3 392s 392s $double 392s [1] 1 2 3 392s 392s $complex 392s [1] 1+1i 2+1i 3+1i 392s 392s $character 392s [1] "a" "b" "c" 392s 392s $logical 392s [1] TRUE FALSE TRUE 392s 392s $integer 392s [1] 1 NA 3 392s 392s $double 392s [1] 1 2 3 392s 392s $complex 392s [1] 1+1i 2+1i 3+1i 392s 392s $character 392s [1] "a" "b" "c" 392s 392s $logical 392s [1] TRUE FALSE TRUE 392s 392s $integer 392s [1] 1 2 3 392s 392s $double 392s [1] 1 NA 3 392s 392s $complex 392s [1] 1+1i 2+1i 3+1i 392s 392s $character 392s [1] "a" "b" "c" 392s 392s $logical 392s [1] TRUE FALSE TRUE 392s 392s $integer 392s [1] 1 2 3 392s 392s $double 392s [1] 1 2 3 392s 392s $complex 392s [1] 1+1i NA 3+1i 392s 392s $character 392s [1] "a" "b" "c" 392s 392s $logical 392s [1] TRUE FALSE TRUE 392s 392s $integer 392s [1] 1 2 3 392s 392s $double 392s [1] 1 2 3 392s 392s $complex 392s [1] 1+1i 2+1i 3+1i 392s 392s $character 392s [1] "a" NA "c" 392s 392s > cat("list...done\n") 392s list...done 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: arm-unknown-linux-gnueabihf (32-bit) 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 > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > # Subsetted tests 392s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 392s > source("utils/validateIndicesFramework.R") 392s > x <- runif(4, min = -3, max = 3) 392s > x[2] <- NA 392s > for (mode in c("integer", "numeric")) { 392s + storage.mode(x) <- mode 392s + for (idxs in index_cases) { 392s + validateIndicesTestVector(x, idxs, 392s + ftest = anyMissing, fsure = function(x, ...) { 392s + anyValue(x, value = NA) 392s + }) 392s + } 392s + } 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: arm-unknown-linux-gnueabihf (32-bit) 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 Loading required namespace: base64enc 392s Loading required namespace: ggplot2 392s > ## Don't test with valgrind 392s > if (Sys.getenv("_R_CHECK_USE_VALGRIND_") == "") { 392s + 392s + ## 3. Make sure all suggested packages are installed / can be loaded 392s + pkgs <- c("base64enc", "ggplot2", "knitr", "markdown", "microbenchmark", 392s + "R.devices", "R.rsp") 392s + if (all(unlist(lapply(pkgs, FUN = requireNamespace)))) { 392s + html <- matrixStats:::benchmark("binCounts") 392s + print(html) 392s + } 392s + 392s + rm(list = "pkgs") 392s + 392s + } 393s Loading required namespace: knitr 393s Loading required namespace: markdown 393s Loading required namespace: microbenchmark 393s Loading required namespace: R.devices 393s Loading required namespace: R.rsp 395s integer: unsorted 398s integer: sorted 400s double: unsorted 403s double: sorted 405s RspFileProduct: 405s Pathname: /tmp/autopkgtest.4cYnbk/autopkgtest_tmp/reports/binCounts.html 405s File size: 70.12 kB (71804 bytes) 405s Content type: text/html 405s Metadata 'author': 'Henrik Bengtsson' 405s Metadata 'title': 'binCounts() benchmarks' 405s Metadata 'date': '2014-05-25' 405s Has processor: FALSE 405s > 405s Warning message: 405s In par(parT) : argument 1 does not name a graphical parameter 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: arm-unknown-linux-gnueabihf (32-bit) 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 > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > # Local functions 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 405s + n0 <- graphics::hist(x, breaks = bx, right = right, 405s + include.lowest = TRUE, plot = FALSE)$counts 405s + } 405s > 405s > 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > # Non-sorted and sorted positions 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > nx <- 1000L # Number of data points 405s > nb <- 200L # Number of bins 405s > 405s > # Uniformely distributed bins 405s > bx <- seq(from = 0, to = 1, length.out = nb + 1L) 405s > bx <- c(-1, bx, 2) 405s > 405s > # Sample data points 405s > set.seed(0xBEEF) 405s > x <- runif(nx, min = 0, max = 1) 405s > 405s > for (kk in 1:2) { 405s + n0 <- binCounts_hist(x, bx = bx) 405s + n1 <- binCounts(x, bx = bx) 405s + # Sanity check 405s + stopifnot(identical(n1, n0)) 405s + 405s + # Check reversed 405s + n1r <- rev(binCounts(-x, bx = rev(-bx), right = TRUE)) 405s + stopifnot(identical(n1r, n1)) 405s + 405s + # Retry with a sorted vector 405s + x <- sort(x) 405s + } # for (kk in 1:2) 405s > 405s > 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > # Missing values 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > x <- 1:40 405s > x[20] <- NA_integer_ 405s > nx <- length(x) 405s > 405s > # Bins 405s > bx <- c(0.5, 50.5, 100.5, 150.5, 200.5) 405s > 405s > y_smooth0 <- binCounts_hist(x, bx = bx) 405s > y_smooth <- binCounts(x, bx = bx) 405s > # Sanity check 405s > stopifnot(all.equal(y_smooth, y_smooth0)) 405s > 405s > 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > # Border cases 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > x <- 1:10 405s > bx <- min(x) - c(10, 1) 405s > y_smooth <- binCounts(x, bx = bx) 405s > stopifnot(all.equal(y_smooth, 0L)) 405s > bx <- range(x) 405s > y_smooth <- binCounts(x, bx = bx) 405s > stopifnot(all.equal(y_smooth, length(x) - 1L)) 405s > bx <- max(x) + c(1, 10) 405s > y_smooth <- binCounts(x, bx = bx) 405s > stopifnot(all.equal(y_smooth, 0L)) 405s > 405s > # Every second empty 405s > x <- 1:10 405s > bx <- rep(x, each = 2L) 405s > y_smooth <- binCounts(x, bx = bx) 405s > stopifnot(all.equal(y_smooth, rep(c(0L, 1L), length.out = length(bx) - 1L))) 405s > ## NOTE: binCounts_hist() does not give the same last bin count 405s > 405s > 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > # Exception handling 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > # Zero bin boundaries (invalid bin definition) 405s > bx <- double(0L) 405s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 405s > stopifnot(inherits(res, "try-error")) 405s > 405s > # One bin boundary (invalid bin definition) 405s > bx <- double(1L) 405s > res <- try(y_smooth <- binCounts(1:10, bx = bx), silent = TRUE) 405s > stopifnot(inherits(res, "try-error")) 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: arm-unknown-linux-gnueabihf (32-bit) 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 > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > # Local functions 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > binCounts_hist <- function(x, bx, right = FALSE, ...) { 405s + n0 <- graphics::hist(x, breaks = bx, right = right, 405s + include.lowest = TRUE, plot = FALSE)$counts 405s + } 405s > 405s > 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > # Subsetted tests 405s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 405s > source("utils/validateIndicesFramework.R") 405s > x <- runif(6, min = -6, max = 6) 405s > storage.mode(x) <- "integer" 405s > bx <- c(-6, 0, 3, 4, 10) 405s > for (idxs in index_cases) { 405s + validateIndicesTestVector(x, idxs, 405s + ftest = binCounts, fsure = binCounts_hist, 405s + bx = bx, right = FALSE) 405s + validateIndicesTestVector(x, idxs, 405s + ftest = binCounts, fsure = binCounts_hist, 405s + bx = bx, right = TRUE) 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: arm-unknown-linux-gnueabihf (32-bit) 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 406s > library("matrixStats") 406s > library("stats") 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Naive R implementation of binMeans() 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 406s + n_smooth <- length(bx) - 1L 406s + res <- double(n_smooth) 406s + counts <- rep(NaN, times = n_smooth) 406s + 406s + if (na.rm) { 406s + keep <- !is.na(x) & !is.na(y) 406s + x <- x[keep] 406s + y <- y[keep] 406s + } 406s + 406s + # For each bin... 406s + for (kk in seq_len(n_smooth)) { 406s + if (right) { 406s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 406s + } else { 406s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 406s + } 406s + y_kk <- y[idxs] 406s + res[kk] <- mean(y_kk) 406s + counts[kk] <- length(idxs) 406s + } # for (kk ...) 406s + 406s + if (count) attr(res, "count") <- counts 406s + res 406s + } 406s > 406s > 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Case #1 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > x <- 1:100 406s > nx <- length(x) 406s > y <- double(nx) 406s > y[1:25] <- 5 406s > y[51:75] <- -5 406s > y <- y + rnorm(nx) 406s > 406s > # Bins 406s > bx <- c(0.5, 25.5, 50.5, 75.5, 100.5) 406s > 406s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 406s > y_smooth <- binMeans(y, x = x, bx = bx) 406s > n_smooth <- binCounts(x, bx = bx) 406s > # Sanity check 406s > stopifnot(all.equal(y_smooth, y_smooth0)) 406s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 406s > 406s > y_smooth0r <- rev(binMeans0(y, x = -x, bx = rev(-bx), 406s + count = FALSE, right = TRUE)) 406s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx), 406s + count = FALSE, right = TRUE)) 406s > # Sanity check 406s > stopifnot(all.equal(y_smooth0r, y_smooth0, check.attributes = FALSE)) 406s > stopifnot(all.equal(y_smoothr, y_smooth0r)) 406s > 406s > 406s > # Integer input 406s > y <- as.integer(y) 406s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 406s > y_smooth <- binMeans(y, x = x, bx = bx) 406s > n_smooth <- binCounts(x, bx = bx) 406s > # Sanity check 406s > stopifnot(is.integer(y), 406s + all.equal(y_smooth, y_smooth0), 406s + all.equal(attr(y_smooth, "count"), n_smooth)) 406s > 406s > # Logical input 406s > y <- as.logical(y) 406s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 406s > y_smooth <- binMeans(y, x = x, bx = bx) 406s > n_smooth <- binCounts(x, bx = bx) 406s > # Sanity check 406s > stopifnot(is.logical(y), 406s + all.equal(y_smooth, y_smooth0), 406s + all.equal(attr(y_smooth, "count"), n_smooth)) 406s > 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Case #2 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > nx <- 1e3 406s > x <- runif(nx) 406s > y <- runif(nx) 406s > 406s > nb <- 10 406s > bx <- do.call(seq, c(as.list(range(x)), length.out = nb)) 406s > bx1 <- c(bx[-1], bx[nb] + 1) 406s > 406s > y_smooth0 <- binMeans0(y, x = x, bx = bx1) 406s > y_smooth <- binMeans(y, x = x, bx = bx1) 406s > n_smooth <- binCounts(x, bx = bx1) 406s > y_smoothr <- rev(binMeans(y, x = -x, bx = rev(-bx1), right = TRUE)) 406s > 406s > # Sanity check 406s > stopifnot(all.equal(y_smooth, y_smooth0)) 406s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 406s > stopifnot(all.equal(y_smoothr, y_smooth, check.attributes = FALSE)) 406s > 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Empty bins 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > x <- c(6:8, 16:19) 406s > nx <- length(x) 406s > y <- runif(nx) 406s > bx <- c(0, 5, 10, 15, 20, 25) 406s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 406s > y_smooth <- binMeans(y, x = x, bx = bx) 406s > n_smooth <- binCounts(x, bx = bx) 406s > stopifnot(all.equal(attr(y_smooth, "count"), n_smooth)) 406s > stopifnot(all.equal(y_smooth, y_smooth0)) 406s > 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Missing values 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > x <- 1:100 406s > x[50] <- NA_integer_ 406s > nx <- length(x) 406s > y <- double(nx) 406s > y[1:25] <- 5 406s > y[51:75] <- -5 406s > y[82:92] <- NA_real_ 406s > y <- y + rnorm(nx) 406s > 406s > # Bins 406s > bx <- c(0.5, 25.5, 75.5, 82.5, 100.5) 406s > 406s > y_smooth0 <- binMeans0(y, x = x, bx = bx) 406s > y_smooth <- binMeans(y, x = x, bx = bx) 406s > # Sanity check 406s > stopifnot(all.equal(y_smooth, y_smooth0)) 406s > 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Exception handling 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Zero bin boundaries (invalid bin definition) 406s > bx <- double(0L) 406s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 406s > stopifnot(inherits(res, "try-error")) 406s > 406s > # One bin boundary (invalid bin definition) 406s > bx <- double(1L) 406s > res <- try(y_smooth <- binMeans(x = 1:5, y = 1:5, bx = bx), silent = TRUE) 406s > stopifnot(inherits(res, "try-error")) 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: arm-unknown-linux-gnueabihf (32-bit) 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 > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Naive R implementation of binMeans() 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > binMeans0 <- function(y, x, bx, na.rm = TRUE, count = TRUE, right = FALSE) { 406s + n_smooth <- length(bx) - 1L 406s + res <- double(n_smooth) 406s + counts <- rep(NaN, times = n_smooth) 406s + 406s + if (na.rm) { 406s + keep <- !is.na(x) & !is.na(y) 406s + x <- x[keep] 406s + y <- y[keep] 406s + } 406s + 406s + # For each bin... 406s + for (kk in seq_len(n_smooth)) { 406s + if (right) { 406s + idxs <- which(bx[kk] < x & x <= bx[kk + 1L]) 406s + } else { 406s + idxs <- which(bx[kk] <= x & x < bx[kk + 1L]) 406s + } 406s + y_kk <- y[idxs] 406s + res[kk] <- mean(y_kk) 406s + counts[kk] <- length(idxs) 406s + } # for (kk ...) 406s + 406s + if (count) attr(res, "count") <- counts 406s + res 406s + } 406s > 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Subsetted tests 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > source("utils/validateIndicesFramework.R") 406s > y <- runif(6, min = -6, max = 6) 406s > x <- runif(6, min = -6, max = 6) 406s > storage.mode(x) <- "integer" 406s > bx <- c(-6, 0, 3, 4, 10) 406s > for (idxs in index_cases) { 406s + for (na.rm in c(TRUE, FALSE)) { 406s + validateIndicesTestVector_w(y, x, idxs, 406s + ftest = binMeans, fsure = binMeans0, 406s + bx = bx, na.rm = na.rm, 406s + count = TRUE, right = FALSE) 406s + validateIndicesTestVector_w(y, x, idxs, 406s + ftest = binMeans, fsure = binMeans0, 406s + bx = bx, na.rm = na.rm, 406s + count = TRUE, right = TRUE) 406s + } 406s + } 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: arm-unknown-linux-gnueabihf (32-bit) 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 > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 406s + if (is.na(value)) { 406s + counts <- sum(is.na(x)) 406s + } else { 406s + counts <- sum(x == value, na.rm = na.rm) 406s + } 406s + as.integer(counts) 406s + } 406s > 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Data type: integer and numeric 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > for (mode in c("integer", "double")) { 406s + x <- runif(20 * 5, min = -3, max = 3) 406s + x[sample.int(length(x), size = 7)] <- 0 406s + storage.mode(x) <- mode 406s + 406s + for (na.rm in c(FALSE, TRUE)) { 406s + # Count zeros 406s + n0 <- count_R(x, value = 0, na.rm = na.rm) 406s + n1 <- count(x, value = 0, na.rm = na.rm) 406s + stopifnot(identical(n1, n0)) 406s + all <- allValue(x, value = 0, na.rm = na.rm) 406s + any <- anyValue(x, value = 0, na.rm = na.rm) 406s + 406s + # Count NAs 406s + n0 <- count_R(x, value = NA, na.rm = na.rm) 406s + n1 <- count(x, value = NA, na.rm = na.rm) 406s + stopifnot(identical(n1, n0)) 406s + all <- allValue(x, value = NA, na.rm = na.rm) 406s + any <- anyValue(x, value = NA, na.rm = na.rm) 406s + 406s + if (mode == "integer") { 406s + ux <- unique(as.vector(x)) 406s + n0 <- n1 <- integer(length(x)) 406s + for (value in ux) { 406s + n0 <- n0 + count_R(x, value = value, na.rm = na.rm) 406s + n1 <- n1 + count(x, value = value, na.rm = na.rm) 406s + stopifnot(identical(n1, n0)) 406s + } 406s + stopifnot(all(n0 == ncol(x))) 406s + } # if (mode == "integer") 406s + 406s + } # for (na.rm ...) 406s + } # for (mode ...) 406s > 406s > # All NAs 406s > na_list <- list(NA_integer_, NA_real_, NaN) 406s > for (na_value in na_list) { 406s + x <- rep(na_value, times = 10L) 406s + for (na.rm in c(FALSE, TRUE)) { 406s + n0 <- count_R(x, na.rm = na.rm) 406s + n1 <- count(x, na.rm = na.rm) 406s + stopifnot(identical(n1, n0)) 406s + 406s + # Count NAs 406s + n0 <- count_R(x, value = NA, na.rm = na.rm) 406s + n1 <- count(x, value = NA, na.rm = na.rm) 406s + stopifnot(identical(n1, n0)) 406s + any <- anyValue(x, value = NA, na.rm = na.rm) 406s + all <- allValue(x, value = NA, na.rm = na.rm) 406s + stopifnot(any) 406s + stopifnot(all) 406s + } 406s + } # for (na_value ...) 406s > 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Data type: logical 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > x <- logical(length = 10L) 406s > x[3:7] <- TRUE 406s > 406s > # Row/column counts 406s > for (na.rm in c(FALSE, TRUE)) { 406s + n0 <- count_R(x, na.rm = na.rm) 406s + n1 <- count(x, na.rm = na.rm) 406s + stopifnot(identical(n1, n0)) 406s + 406s + n_true <- count(x, value = TRUE, na.rm = na.rm) 406s + n_false <- count(x, value = FALSE, na.rm = na.rm) 406s + stopifnot(n_true + n_false == ncol(x)) 406s + 406s + # Count NAs 406s + n0 <- count_R(x, value = NA, na.rm = na.rm) 406s + n1 <- count(x, value = NA, na.rm = na.rm) 406s + stopifnot(identical(n1, n0)) 406s + } 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: arm-unknown-linux-gnueabihf (32-bit) 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 > count_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 406s + if (is.na(value)) { 406s + counts <- sum(is.na(x)) 406s + } else { 406s + counts <- sum(x == value, na.rm = na.rm) 406s + } 406s + as.integer(counts) 406s + } 406s > 406s > 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > # Subsetted tests 406s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 406s > source("utils/validateIndicesFramework.R") 406s > x <- runif(6, min = -3, max = 3) 406s > storage.mode(x) <- "integer" 406s > for (idxs in index_cases) { 406s + validateIndicesTestVector(x, idxs, 406s + ftest = count, fsure = count_R, 406s + value = 0, na.rm = TRUE) 406s + validateIndicesTestVector(x, idxs, 406s + ftest = count, fsure = count_R, 406s + value = 0, na.rm = FALSE) 406s + validateIndicesTestVector(x, idxs, 406s + ftest = count, fsure = count_R, 406s + value = NA_integer_) 406s + } 406s > 407s 407s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 407s Copyright (C) 2025 The R Foundation for Statistical Computing 407s Platform: arm-unknown-linux-gnueabihf (32-bit) 407s 407s R is free software and comes with ABSOLUTELY NO WARRANTY. 407s You are welcome to redistribute it under certain conditions. 407s Type 'license()' or 'licence()' for distribution details. 407s 407s R is a collaborative project with many contributors. 407s Type 'contributors()' for more information and 407s 'citation()' on how to cite R or R packages in publications. 407s 407s Type 'demo()' for some demos, 'help()' for on-line help, or 407s 'help.start()' for an HTML browser interface to help. 407s Type 'q()' to quit R. 407s 407s > library("matrixStats") 407s > 407s > diff2_R <- function(..., useNames = TRUE){ 407s + res <- diff(...) 407s + if (!useNames) names(res) <- NULL 407s + res 407s + } 407s > 407s > set.seed(0x42) 407s > 407s > for (mode in c("integer", "double")) { 407s + x <- rnorm(10, sd = 5) 407s + storage.mode(x) <- mode 407s + str(x) 407s + 407s + for (has_na in c(FALSE, TRUE)) { 407s + for (setNames in c(TRUE, FALSE)) { 407s + for (useNames in c(TRUE, FALSE)) { 407s + if (has_na) { 407s + x[sample(1:10, size = 3)] <- NA 407s + } 407s + if (setNames) { 407s + names(x) <- LETTERS[1:10] 407s + } 407s + for (l in 1:3) { 407s + for (d in 1:4) { 407s + cat(sprintf("%s: NAs = %s, lag = %d, differences = %d, setNames = %d, useNames = %d\n", 407s + mode, has_na, l, d, setNames, useNames)) 407s + y0 <- diff2_R(x, lag = l, differences = d, useNames = useNames) 407s + str(y0) 407s + y1 <- diff2(x, lag = l, differences = d, useNames = useNames) 407s + str(y1) 407s + stopifnot(identical(y1, y0)) 407s + } 407s + } 407s + } 407s + } 407s + } # for (has_na ...) 407s + } 407s int [1:10] 11 1 2 0 -1 -3 -3 6 0 0 407s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 407s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 407s Named int [1:8] 11 -3 1 -1 2 9 -15 6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named int [1:8] 11 -3 1 -1 2 9 -15 6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 407s Named int [1:7] -14 4 -2 3 7 -24 21 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named int [1:7] -14 4 -2 3 7 -24 21 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 407s Named int [1:6] 18 -6 5 4 -31 45 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named int [1:6] 18 -6 5 4 -31 45 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 407s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 407s Named int [1:6] 6 -2 1 12 5 -15 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named int [1:6] 6 -2 1 12 5 -15 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 407s Named int [1:4] -5 14 4 -27 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named int [1:4] -5 14 4 -27 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 407s Named int [1:2] 9 -41 407s - attr(*, "names")= chr [1:2] "I" "J" 407s Named int [1:2] 9 -41 407s - attr(*, "names")= chr [1:2] "I" "J" 407s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 407s Named int [1:7] -11 -2 -5 -3 7 3 3 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named int [1:7] -11 -2 -5 -3 7 3 3 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 407s Named int [1:4] 8 9 8 6 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named int [1:4] 8 9 8 6 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 407s Named int -2 407s - attr(*, "names")= chr "J" 407s Named int -2 407s - attr(*, "names")= chr "J" 407s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 407s Named int(0) 407s - attr(*, "names")= chr(0) 407s Named int(0) 407s - attr(*, "names")= chr(0) 407s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 407s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 407s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 407s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 407s int [1:8] 11 -3 1 -1 2 9 -15 6 407s int [1:8] 11 -3 1 -1 2 9 -15 6 407s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 407s int [1:7] -14 4 -2 3 7 -24 21 407s int [1:7] -14 4 -2 3 7 -24 21 407s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 407s int [1:6] 18 -6 5 4 -31 45 407s int [1:6] 18 -6 5 4 -31 45 407s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 407s int [1:8] -9 -1 -3 -3 -2 9 3 -6 407s int [1:8] -9 -1 -3 -3 -2 9 3 -6 407s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 407s int [1:6] 6 -2 1 12 5 -15 407s int [1:6] 6 -2 1 12 5 -15 407s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 407s int [1:4] -5 14 4 -27 407s int [1:4] -5 14 4 -27 407s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 407s int [1:2] 9 -41 407s int [1:2] 9 -41 407s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 407s int [1:7] -11 -2 -5 -3 7 3 3 407s int [1:7] -11 -2 -5 -3 7 3 3 407s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 407s int [1:4] 8 9 8 6 407s int [1:4] 8 9 8 6 407s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 407s int -2 407s int -2 407s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 407s int(0) 407s int(0) 407s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 407s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s Named int [1:9] -10 1 -2 -1 -2 0 9 -6 0 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 407s Named int [1:8] 11 -3 1 -1 2 9 -15 6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named int [1:8] 11 -3 1 -1 2 9 -15 6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 407s Named int [1:7] -14 4 -2 3 7 -24 21 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named int [1:7] -14 4 -2 3 7 -24 21 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 407s Named int [1:6] 18 -6 5 4 -31 45 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named int [1:6] 18 -6 5 4 -31 45 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 407s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named int [1:8] -9 -1 -3 -3 -2 9 3 -6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 407s Named int [1:6] 6 -2 1 12 5 -15 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named int [1:6] 6 -2 1 12 5 -15 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 407s Named int [1:4] -5 14 4 -27 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named int [1:4] -5 14 4 -27 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 407s Named int [1:2] 9 -41 407s - attr(*, "names")= chr [1:2] "I" "J" 407s Named int [1:2] 9 -41 407s - attr(*, "names")= chr [1:2] "I" "J" 407s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 407s Named int [1:7] -11 -2 -5 -3 7 3 3 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named int [1:7] -11 -2 -5 -3 7 3 3 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 407s Named int [1:4] 8 9 8 6 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named int [1:4] 8 9 8 6 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 407s Named int -2 407s - attr(*, "names")= chr "J" 407s Named int -2 407s - attr(*, "names")= chr "J" 407s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 407s Named int(0) 407s - attr(*, "names")= chr(0) 407s Named int(0) 407s - attr(*, "names")= chr(0) 407s integer: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 407s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 407s int [1:9] -10 1 -2 -1 -2 0 9 -6 0 407s integer: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 407s int [1:8] 11 -3 1 -1 2 9 -15 6 407s int [1:8] 11 -3 1 -1 2 9 -15 6 407s integer: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 407s int [1:7] -14 4 -2 3 7 -24 21 407s int [1:7] -14 4 -2 3 7 -24 21 407s integer: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 407s int [1:6] 18 -6 5 4 -31 45 407s int [1:6] 18 -6 5 4 -31 45 407s integer: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 407s int [1:8] -9 -1 -3 -3 -2 9 3 -6 407s int [1:8] -9 -1 -3 -3 -2 9 3 -6 407s integer: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 407s int [1:6] 6 -2 1 12 5 -15 407s int [1:6] 6 -2 1 12 5 -15 407s integer: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 407s int [1:4] -5 14 4 -27 407s int [1:4] -5 14 4 -27 407s integer: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 407s int [1:2] 9 -41 407s int [1:2] 9 -41 407s integer: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 407s int [1:7] -11 -2 -5 -3 7 3 3 407s int [1:7] -11 -2 -5 -3 7 3 3 407s integer: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 407s int [1:4] 8 9 8 6 407s int [1:4] 8 9 8 6 407s integer: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 407s int -2 407s int -2 407s integer: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 407s int(0) 407s int(0) 407s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 407s Named int [1:9] NA NA NA NA NA 0 9 -6 0 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s Named int [1:9] NA NA NA NA NA 0 9 -6 0 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 407s Named int [1:8] NA NA NA NA NA 9 -15 6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named int [1:8] NA NA NA NA NA 9 -15 6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 407s Named int [1:7] NA NA NA NA NA -24 21 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named int [1:7] NA NA NA NA NA -24 21 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 407s Named int [1:6] NA NA NA NA NA 45 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named int [1:6] NA NA NA NA NA 45 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 407s Named int [1:8] -9 NA NA NA NA 9 3 -6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named int [1:8] -9 NA NA NA NA 9 3 -6 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 407s Named int [1:6] NA NA NA NA NA -15 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named int [1:6] NA NA NA NA NA -15 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 407s Named int [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named int [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 407s Named int [1:2] NA NA 407s - attr(*, "names")= chr [1:2] "I" "J" 407s Named int [1:2] NA NA 407s - attr(*, "names")= chr [1:2] "I" "J" 407s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 407s Named int [1:7] NA NA -5 NA NA 3 3 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named int [1:7] NA NA -5 NA NA 3 3 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 407s Named int [1:4] NA NA 8 NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named int [1:4] NA NA 8 NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 407s Named int NA 407s - attr(*, "names")= chr "J" 407s Named int NA 407s - attr(*, "names")= chr "J" 407s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 407s Named int(0) 407s - attr(*, "names")= chr(0) 407s Named int(0) 407s - attr(*, "names")= chr(0) 407s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 407s int [1:9] NA NA NA NA NA 0 9 NA NA 407s int [1:9] NA NA NA NA NA 0 9 NA NA 407s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 407s int [1:8] NA NA NA NA NA 9 NA NA 407s int [1:8] NA NA NA NA NA 9 NA NA 407s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 407s int [1:7] NA NA NA NA NA NA NA 407s int [1:7] NA NA NA NA NA NA NA 407s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 407s int [1:6] NA NA NA NA NA NA 407s int [1:6] NA NA NA NA NA NA 407s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 407s int [1:8] NA NA NA NA NA 9 NA -6 407s int [1:8] NA NA NA NA NA 9 NA -6 407s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 407s int [1:6] NA NA NA NA NA -15 407s int [1:6] NA NA NA NA NA -15 407s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 407s int [1:4] NA NA NA NA 407s int [1:4] NA NA NA NA 407s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 407s int [1:2] NA NA 407s int [1:2] NA NA 407s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 407s int [1:7] NA NA NA NA NA NA 3 407s int [1:7] NA NA NA NA NA NA 3 407s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 407s int [1:4] NA NA NA NA 407s int [1:4] NA NA NA NA 407s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 407s int NA 407s int NA 407s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 407s int(0) 407s int(0) 407s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 407s Named int [1:9] NA NA NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s Named int [1:9] NA NA NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 407s Named int [1:8] NA NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named int [1:8] NA NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 407s Named int [1:7] NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named int [1:7] NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 407s Named int [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named int [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 407s Named int [1:8] NA NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named int [1:8] NA NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 407s Named int [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named int [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 407s Named int [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named int [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 407s Named int [1:2] NA NA 407s - attr(*, "names")= chr [1:2] "I" "J" 407s Named int [1:2] NA NA 407s - attr(*, "names")= chr [1:2] "I" "J" 407s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 407s Named int [1:7] NA NA NA NA NA NA 3 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named int [1:7] NA NA NA NA NA NA 3 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 407s Named int [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named int [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 407s Named int NA 407s - attr(*, "names")= chr "J" 407s Named int NA 407s - attr(*, "names")= chr "J" 407s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 407s Named int(0) 407s - attr(*, "names")= chr(0) 407s Named int(0) 407s - attr(*, "names")= chr(0) 407s integer: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 407s int [1:9] NA NA NA NA NA NA NA NA NA 407s int [1:9] NA NA NA NA NA NA NA NA NA 407s integer: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 407s int [1:8] NA NA NA NA NA NA NA NA 407s int [1:8] NA NA NA NA NA NA NA NA 407s integer: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 407s int [1:7] NA NA NA NA NA NA NA 407s int [1:7] NA NA NA NA NA NA NA 407s integer: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 407s int [1:6] NA NA NA NA NA NA 407s int [1:6] NA NA NA NA NA NA 407s integer: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 407s int [1:8] NA NA NA NA NA NA NA NA 407s int [1:8] NA NA NA NA NA NA NA NA 407s integer: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 407s int [1:6] NA NA NA NA NA NA 407s int [1:6] NA NA NA NA NA NA 407s integer: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 407s int [1:4] NA NA NA NA 407s int [1:4] NA NA NA NA 407s integer: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 407s int [1:2] NA NA 407s int [1:2] NA NA 407s integer: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 407s int [1:7] NA NA NA NA NA NA 3 407s int [1:7] NA NA NA NA NA NA 3 407s integer: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 407s int [1:4] NA NA NA NA 407s int [1:4] NA NA NA NA 407s integer: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 407s int NA 407s int NA 407s integer: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 407s int(0) 407s int(0) 407s num [1:10] 2.586 -0.344 0.33 9.155 -3.254 ... 407s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 1 407s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 1 407s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 1 407s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 1 407s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 1 407s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 1 407s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 1 407s Named num [1:4] 0.368 42.988 15.396 -29.313 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named num [1:4] 0.368 42.988 15.396 -29.313 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 1 407s Named num [1:2] 15 -72.3 407s - attr(*, "names")= chr [1:2] "I" "J" 407s Named num [1:2] 15 -72.3 407s - attr(*, "names")= chr [1:2] "I" "J" 407s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 1 407s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 1 407s Named num [1:4] -23.52 7.92 11.38 23.27 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named num [1:4] -23.52 7.92 11.38 23.27 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 1 407s Named num 46.8 407s - attr(*, "names")= chr "J" 407s Named num 46.8 407s - attr(*, "names")= chr "J" 407s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 1 407s Named num(0) 407s - attr(*, "names")= chr(0) 407s Named num(0) 407s - attr(*, "names")= chr(0) 407s double: NAs = FALSE, lag = 1, differences = 1, setNames = 1, useNames = 0 407s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 407s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 407s double: NAs = FALSE, lag = 1, differences = 2, setNames = 1, useNames = 0 407s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 407s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 407s double: NAs = FALSE, lag = 1, differences = 3, setNames = 1, useNames = 0 407s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 407s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 407s double: NAs = FALSE, lag = 1, differences = 4, setNames = 1, useNames = 0 407s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 407s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 407s double: NAs = FALSE, lag = 2, differences = 1, setNames = 1, useNames = 0 407s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 407s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 407s double: NAs = FALSE, lag = 2, differences = 2, setNames = 1, useNames = 0 407s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 407s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 407s double: NAs = FALSE, lag = 2, differences = 3, setNames = 1, useNames = 0 407s num [1:4] 0.368 42.988 15.396 -29.313 407s num [1:4] 0.368 42.988 15.396 -29.313 407s double: NAs = FALSE, lag = 2, differences = 4, setNames = 1, useNames = 0 407s num [1:2] 15 -72.3 407s num [1:2] 15 -72.3 407s double: NAs = FALSE, lag = 3, differences = 1, setNames = 1, useNames = 0 407s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 407s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 407s double: NAs = FALSE, lag = 3, differences = 2, setNames = 1, useNames = 0 407s num [1:4] -23.52 7.92 11.38 23.27 407s num [1:4] -23.52 7.92 11.38 23.27 407s double: NAs = FALSE, lag = 3, differences = 3, setNames = 1, useNames = 0 407s num 46.8 407s num 46.8 407s double: NAs = FALSE, lag = 3, differences = 4, setNames = 1, useNames = 0 407s num(0) 407s num(0) 407s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 1 407s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s Named num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 1 407s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 1 407s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 1 407s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 1 407s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 1 407s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 1 407s Named num [1:4] 0.368 42.988 15.396 -29.313 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named num [1:4] 0.368 42.988 15.396 -29.313 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 1 407s Named num [1:2] 15 -72.3 407s - attr(*, "names")= chr [1:2] "I" "J" 407s Named num [1:2] 15 -72.3 407s - attr(*, "names")= chr [1:2] "I" "J" 407s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 1 407s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 1 407s Named num [1:4] -23.52 7.92 11.38 23.27 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named num [1:4] -23.52 7.92 11.38 23.27 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 1 407s Named num 46.8 407s - attr(*, "names")= chr "J" 407s Named num 46.8 407s - attr(*, "names")= chr "J" 407s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 1 407s Named num(0) 407s - attr(*, "names")= chr(0) 407s Named num(0) 407s - attr(*, "names")= chr(0) 407s double: NAs = FALSE, lag = 1, differences = 1, setNames = 0, useNames = 0 407s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 407s num [1:9] -2.929 0.673 8.826 -12.409 -1.221 ... 407s double: NAs = FALSE, lag = 1, differences = 2, setNames = 0, useNames = 0 407s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 407s num [1:8] 3.6 8.15 -21.23 11.19 -2.1 ... 407s double: NAs = FALSE, lag = 1, differences = 3, setNames = 0, useNames = 0 407s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 407s num [1:7] 4.55 -29.39 32.42 -13.29 14.97 ... 407s double: NAs = FALSE, lag = 1, differences = 4, setNames = 0, useNames = 0 407s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 407s num [1:6] -33.9 61.8 -45.7 28.3 -37 ... 407s double: NAs = FALSE, lag = 2, differences = 1, setNames = 0, useNames = 0 407s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 407s num [1:8] -2.26 9.5 -3.58 -13.63 -4.54 ... 407s double: NAs = FALSE, lag = 2, differences = 2, setNames = 0, useNames = 0 407s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 407s num [1:6] -1.33 -23.13 -0.96 19.86 14.44 ... 407s double: NAs = FALSE, lag = 2, differences = 3, setNames = 0, useNames = 0 407s num [1:4] 0.368 42.988 15.396 -29.313 407s num [1:4] 0.368 42.988 15.396 -29.313 407s double: NAs = FALSE, lag = 2, differences = 4, setNames = 0, useNames = 0 407s num [1:2] 15 -72.3 407s num [1:2] 15 -72.3 407s double: NAs = FALSE, lag = 3, differences = 1, setNames = 0, useNames = 0 407s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 407s num [1:7] 6.57 -2.91 -4.81 -16.95 5.01 ... 407s double: NAs = FALSE, lag = 3, differences = 2, setNames = 0, useNames = 0 407s num [1:4] -23.52 7.92 11.38 23.27 407s num [1:4] -23.52 7.92 11.38 23.27 407s double: NAs = FALSE, lag = 3, differences = 3, setNames = 0, useNames = 0 407s num 46.8 407s num 46.8 407s double: NAs = FALSE, lag = 3, differences = 4, setNames = 0, useNames = 0 407s num(0) 407s num(0) 407s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 1 407s Named num [1:9] -2.929 0.673 8.826 NA NA ... 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s Named num [1:9] -2.929 0.673 8.826 NA NA ... 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 1 407s Named num [1:8] 3.6 8.15 NA NA NA ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named num [1:8] 3.6 8.15 NA NA NA ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 1 407s Named num [1:7] 4.55 NA NA NA NA ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named num [1:7] 4.55 NA NA NA NA ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 1 407s Named num [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named num [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 1 407s Named num [1:8] -2.26 9.5 NA NA NA ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named num [1:8] -2.26 9.5 NA NA NA ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 1 407s Named num [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named num [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 1 407s Named num [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named num [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 1 407s Named num [1:2] NA NA 407s - attr(*, "names")= chr [1:2] "I" "J" 407s Named num [1:2] NA NA 407s - attr(*, "names")= chr [1:2] "I" "J" 407s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 1 407s Named num [1:7] 6.57 NA NA -16.95 NA ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named num [1:7] 6.57 NA NA -16.95 NA ... 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 1 407s Named num [1:4] -23.5 NA NA 23.3 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named num [1:4] -23.5 NA NA 23.3 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 1 407s Named num 46.8 407s - attr(*, "names")= chr "J" 407s Named num 46.8 407s - attr(*, "names")= chr "J" 407s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 1 407s Named num(0) 407s - attr(*, "names")= chr(0) 407s Named num(0) 407s - attr(*, "names")= chr(0) 407s double: NAs = TRUE, lag = 1, differences = 1, setNames = 1, useNames = 0 407s num [1:9] NA 0.673 8.826 NA NA ... 407s num [1:9] NA 0.673 8.826 NA NA ... 407s double: NAs = TRUE, lag = 1, differences = 2, setNames = 1, useNames = 0 407s num [1:8] NA 8.15 NA NA NA ... 407s num [1:8] NA 8.15 NA NA NA ... 407s double: NAs = TRUE, lag = 1, differences = 3, setNames = 1, useNames = 0 407s num [1:7] NA NA NA NA NA NA NA 407s num [1:7] NA NA NA NA NA NA NA 407s double: NAs = TRUE, lag = 1, differences = 4, setNames = 1, useNames = 0 407s num [1:6] NA NA NA NA NA NA 407s num [1:6] NA NA NA NA NA NA 407s double: NAs = TRUE, lag = 2, differences = 1, setNames = 1, useNames = 0 407s num [1:8] NA 9.5 NA NA NA ... 407s num [1:8] NA 9.5 NA NA NA ... 407s double: NAs = TRUE, lag = 2, differences = 2, setNames = 1, useNames = 0 407s num [1:6] NA NA NA NA NA NA 407s num [1:6] NA NA NA NA NA NA 407s double: NAs = TRUE, lag = 2, differences = 3, setNames = 1, useNames = 0 407s num [1:4] NA NA NA NA 407s num [1:4] NA NA NA NA 407s double: NAs = TRUE, lag = 2, differences = 4, setNames = 1, useNames = 0 407s num [1:2] NA NA 407s num [1:2] NA NA 407s double: NAs = TRUE, lag = 3, differences = 1, setNames = 1, useNames = 0 407s num [1:7] NA NA NA NA NA NA NA 407s num [1:7] NA NA NA NA NA NA NA 407s double: NAs = TRUE, lag = 3, differences = 2, setNames = 1, useNames = 0 407s num [1:4] NA NA NA NA 407s num [1:4] NA NA NA NA 407s double: NAs = TRUE, lag = 3, differences = 3, setNames = 1, useNames = 0 407s num NA 407s num NA 407s double: NAs = TRUE, lag = 3, differences = 4, setNames = 1, useNames = 0 407s num(0) 407s num(0) 407s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 1 407s Named num [1:9] NA 0.673 8.826 NA NA ... 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s Named num [1:9] NA 0.673 8.826 NA NA ... 407s - attr(*, "names")= chr [1:9] "B" "C" "D" "E" ... 407s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 1 407s Named num [1:8] NA 8.15 NA NA NA ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named num [1:8] NA 8.15 NA NA NA ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 1 407s Named num [1:7] NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named num [1:7] NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 1 407s Named num [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named num [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 1 407s Named num [1:8] NA 9.5 NA NA NA ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s Named num [1:8] NA 9.5 NA NA NA ... 407s - attr(*, "names")= chr [1:8] "C" "D" "E" "F" ... 407s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 1 407s Named num [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s Named num [1:6] NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:6] "E" "F" "G" "H" ... 407s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 1 407s Named num [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named num [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 1 407s Named num [1:2] NA NA 407s - attr(*, "names")= chr [1:2] "I" "J" 407s Named num [1:2] NA NA 407s - attr(*, "names")= chr [1:2] "I" "J" 407s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 1 407s Named num [1:7] NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s Named num [1:7] NA NA NA NA NA NA NA 407s - attr(*, "names")= chr [1:7] "D" "E" "F" "G" ... 407s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 1 407s Named num [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s Named num [1:4] NA NA NA NA 407s - attr(*, "names")= chr [1:4] "G" "H" "I" "J" 407s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 1 407s Named num NA 407s - attr(*, "names")= chr "J" 407s Named num NA 407s - attr(*, "names")= chr "J" 407s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 1 407s Named num(0) 407s - attr(*, "names")= chr(0) 407s Named num(0) 407s - attr(*, "names")= chr(0) 407s double: NAs = TRUE, lag = 1, differences = 1, setNames = 0, useNames = 0 407s num [1:9] NA 0.673 8.826 NA NA ... 407s num [1:9] NA 0.673 8.826 NA NA ... 407s double: NAs = TRUE, lag = 1, differences = 2, setNames = 0, useNames = 0 407s num [1:8] NA 8.15 NA NA NA ... 407s num [1:8] NA 8.15 NA NA NA ... 407s double: NAs = TRUE, lag = 1, differences = 3, setNames = 0, useNames = 0 407s num [1:7] NA NA NA NA NA NA NA 407s num [1:7] NA NA NA NA NA NA NA 407s double: NAs = TRUE, lag = 1, differences = 4, setNames = 0, useNames = 0 407s num [1:6] NA NA NA NA NA NA 407s num [1:6] NA NA NA NA NA NA 407s double: NAs = TRUE, lag = 2, differences = 1, setNames = 0, useNames = 0 407s num [1:8] NA 9.5 NA NA NA ... 407s num [1:8] NA 9.5 NA NA NA ... 407s double: NAs = TRUE, lag = 2, differences = 2, setNames = 0, useNames = 0 407s num [1:6] NA NA NA NA NA NA 407s num [1:6] NA NA NA NA NA NA 407s double: NAs = TRUE, lag = 2, differences = 3, setNames = 0, useNames = 0 407s num [1:4] NA NA NA NA 407s num [1:4] NA NA NA NA 407s double: NAs = TRUE, lag = 2, differences = 4, setNames = 0, useNames = 0 407s num [1:2] NA NA 407s num [1:2] NA NA 407s double: NAs = TRUE, lag = 3, differences = 1, setNames = 0, useNames = 0 407s num [1:7] NA NA NA NA NA NA NA 407s num [1:7] NA NA NA NA NA NA NA 407s double: NAs = TRUE, lag = 3, differences = 2, setNames = 0, useNames = 0 407s num [1:4] NA NA NA NA 407s num [1:4] NA NA NA NA 407s double: NAs = TRUE, lag = 3, differences = 3, setNames = 0, useNames = 0 407s num NA 407s num NA 407s double: NAs = TRUE, lag = 3, differences = 4, setNames = 0, useNames = 0 407s num(0) 407s num(0) 407s > 407s 407s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 407s Copyright (C) 2025 The R Foundation for Statistical Computing 407s Platform: arm-unknown-linux-gnueabihf (32-bit) 407s 407s R is free software and comes with ABSOLUTELY NO WARRANTY. 407s You are welcome to redistribute it under certain conditions. 407s Type 'license()' or 'licence()' for distribution details. 407s 407s R is a collaborative project with many contributors. 407s Type 'contributors()' for more information and 407s 'citation()' on how to cite R or R packages in publications. 407s 407s Type 'demo()' for some demos, 'help()' for on-line help, or 407s 'help.start()' for an HTML browser interface to help. 407s Type 'q()' to quit R. 407s 407s > library("matrixStats") 407s > 407s > diff2_R <- function(..., useNames=NA){ 407s + res <- diff(...) 407s + if (!useNames) names(res) <- NULL 407s + res 407s + } 407s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 407s > # Subsetted tests 407s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 407s > source("utils/validateIndicesFramework.R") 407s > x <- runif(6, min = -6, max = 6) 407s > for (setNames in c(TRUE, FALSE)) { 407s + if (setNames) names(x) <- LETTERS[1:6] 407s + else names(x) <- NULL 407s + for (l in 1:2) { 407s + for (d in 1:2) { 407s + for (idxs in index_cases) { 407s + for (useNames in c(TRUE, FALSE)) { 407s + validateIndicesTestVector(x, idxs, 407s + ftest = diff2, fsure = diff2_R, 407s + lag = l, differences = d, useNames = useNames) 407s + } 407s + } 407s + } 407s + } 407s + } 407s > 407s 407s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 407s Copyright (C) 2025 The R Foundation for Statistical Computing 407s Platform: arm-unknown-linux-gnueabihf (32-bit) 407s 407s R is free software and comes with ABSOLUTELY NO WARRANTY. 407s You are welcome to redistribute it under certain conditions. 407s Type 'license()' or 'licence()' for distribution details. 407s 407s R is a collaborative project with many contributors. 407s Type 'contributors()' for more information and 407s 'citation()' on how to cite R or R packages in publications. 407s 407s Type 'demo()' for some demos, 'help()' for on-line help, or 407s 'help.start()' for an HTML browser interface to help. 407s Type 'q()' to quit R. 407s 407s > library("matrixStats") 407s > 407s > indexByRow_R1 <- function(dim, idxs = NULL, ...) { 407s + n <- prod(dim) 407s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 407s + if (!is.null(idxs)) 407s + x <- x[idxs] 407s + as.vector(x) 407s + } 407s > 407s > 407s > indexByRow_R2 <- function(dim, idxs = NULL, ...) { 407s + n <- prod(dim) 407s + if (is.null(idxs)) { 407s + x <- matrix(seq_len(n), nrow = dim[2L], ncol = dim[1L], byrow = TRUE) 407s + as.vector(x) 407s + } else { 407s + idxs <- idxs - 1L 407s + cols <- idxs %/% dim[2L] 407s + rows <- idxs %% dim[2L] 407s + cols + dim[1L] * rows + 1L 407s + } 407s + } 407s > 407s > 407s > dim <- c(5L, 4L) 407s > x <- matrix(NA_integer_, nrow = dim[1L], ncol = dim[2L]) 407s > y <- t(x) 407s > idxs_by_cols <- seq_along(x) 407s > 407s > # Assign by columns 407s > x[idxs_by_cols] <- idxs_by_cols 407s > print(x) 407s [,1] [,2] [,3] [,4] 407s [1,] 1 6 11 16 407s [2,] 2 7 12 17 407s [3,] 3 8 13 18 407s [4,] 4 9 14 19 407s [5,] 5 10 15 20 407s > 407s > # Truth 407s > y0 <- t(x) 407s > idxs_by_rows <- as.vector(y0) 407s > 407s > # Assert 407s > idxs <- indexByRow(dim) 407s > stopifnot(all.equal(idxs, idxs_by_rows)) 407s > y <- x 407s > y[idxs_by_rows] <- idxs 407s > print(y) 407s [,1] [,2] [,3] [,4] 407s [1,] 1 6 11 16 407s [2,] 2 7 12 17 407s [3,] 3 8 13 18 407s [4,] 4 9 14 19 407s [5,] 5 10 15 20 407s > stopifnot(all(as.vector(y) == as.vector(x))) 407s > 407s > idxs_R1 <- indexByRow_R1(dim) 407s > stopifnot(all.equal(idxs_R1, idxs_by_rows)) 407s > 407s > idxs_R2 <- indexByRow_R2(dim) 407s > stopifnot(all.equal(idxs_R2, idxs_by_rows)) 407s > 407s > # Assert 407s > idxs_by_cols <- seq(from = 1, to = length(x), by = 3L) 407s > idxs_by_rows <- as.vector(t(x)[idxs_by_cols]) 407s > 407s > idxs <- indexByRow(dim, idxs = idxs_by_cols) 407s > stopifnot(all(idxs == idxs_by_rows)) 407s > 407s > idxs_R1 <- indexByRow_R1(dim, idxs = idxs_by_cols) 407s > stopifnot(all(idxs_R1 == idxs_by_rows)) 407s > 407s > idxs_R2 <- indexByRow_R2(dim, idxs = idxs_by_cols) 408s > stopifnot(all(idxs_R2 == idxs_by_rows)) 408s > 408s > 408s > ## DEFUNCT: Backward compatibility 408s > res <- tryCatch({ 408s + idxs1 <- indexByRow(x) 408s + }, error = identity) 408s > stopifnot(inherits(res, "error")) 408s > 408s > 408s > ## Exceptions: 408s > ## Too large matrices are not supported, which happens 408s > ## when prod(dim) > .Machine$integer.max 408s > dim_too_large <- c(.Machine$integer.max, 2L) 408s > res <- tryCatch({ 408s + idxs <- indexByRow(dim_too_large, idxs = 1L) 408s + }, error = identity) 408s > stopifnot(inherits(res, "error")) 408s > 408s > ## Non-positive indices are not supported 408s > res <- tryCatch({ 408s + idxs <- indexByRow(c(1,1), idxs = 0L) 408s + }, error = identity) 408s > stopifnot(inherits(res, "error")) 408s > 408s > res <- tryCatch({ 408s + idxs <- indexByRow(c(1,1), idxs = -1L) 408s + }, error = identity) 408s > stopifnot(inherits(res, "error")) 408s > 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: arm-unknown-linux-gnueabihf (32-bit) 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 > library("stats") 408s > 408s > logSumExp_R <- function(lx, na.rm = FALSE) { 408s + log(sum(exp(lx), na.rm = na.rm)) 408s + } 408s > 408s > ## R-help thread \emph{'[R] Beyond double-precision?'} on May 9, 2009. 408s > 408s > for (mode in c("integer", "double")) { 408s + cat("mode: ", mode, "\n", sep = "") 408s + 408s + set.seed(1) 408s + x <- runif(20, min = 1.0, max = 3.0) 408s + storage.mode(x) <- mode 408s + str(x) 408s + 408s + ## The logarithm of the harmonic mean 408s + y0 <- log(1 / mean(1 / x)) 408s + print(y0) ## -1.600885 408s + 408s + lx <- log(x) 408s + y1 <- log(length(x)) - logSumExp(-lx) 408s + print(y1) ## [1] -1.600885 408s + 408s + # Sanity check 408s + stopifnot(all.equal(y1, y0)) 408s + 408s + y2 <- log(length(x)) - logSumExp_R(-lx) 408s + # Sanity check 408s + stopifnot(all.equal(y2, y0)) 408s + } # for (mode ...) 408s mode: integer 408s int [1:20] 1 1 2 2 1 2 2 2 2 1 ... 408s [1] 0.3215836 408s [1] 0.3215836 408s mode: double 408s num [1:20] 1.53 1.74 2.15 2.82 1.4 ... 408s [1] 0.6673156 408s [1] 0.6673156 408s > 408s > 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > # Missing values 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > ## NA values 408s > lx <- c(1, 2, 3) 408s > lx[2] <- NA_real_ 408s > y0 <- logSumExp_R(lx, na.rm = FALSE) 408s > y <- logSumExp(lx, na.rm = FALSE) 408s > print(y) 408s [1] NA 408s > stopifnot(identical(y, NA_real_)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > y0 <- logSumExp_R(lx, na.rm = TRUE) 408s > y <- logSumExp(lx, na.rm = TRUE) 408s > print(y) 408s [1] 3.126928 408s > stopifnot(all.equal(y, y0)) 408s > 408s > ## NaN values 408s > lx <- c(1, 2, 3) 408s > lx[2] <- NaN 408s > y0 <- logSumExp_R(lx, na.rm = FALSE) 408s > y <- logSumExp(lx, na.rm = FALSE) 408s > print(y) 408s [1] NA 408s > stopifnot(identical(y, NA_real_)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > y0 <- logSumExp_R(lx, na.rm = TRUE) 408s > y <- logSumExp(lx, na.rm = TRUE) 408s > print(y) 408s [1] 3.126928 408s > stopifnot(all.equal(y, y0)) 408s > 408s > 408s > 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > # Corner cases 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > ## Zero-length vectors 408s > lx <- numeric(0L) 408s > y0 <- logSumExp_R(lx) 408s > y <- logSumExp(lx) 408s > print(y) 408s [1] -Inf 408s > stopifnot(identical(y, -Inf)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > ## Vectors of length one 408s > lx <- 1.0 408s > y0 <- logSumExp_R(lx) 408s > y <- logSumExp(lx) 408s > print(y) 408s [1] 1 408s > stopifnot(identical(y, lx)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > lx <- NA_real_ 408s > y0 <- logSumExp_R(lx, na.rm = TRUE) 408s > y <- logSumExp(lx, na.rm = TRUE) 408s > print(y) 408s [1] -Inf 408s > stopifnot(identical(y, -Inf)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > ## All missing values 408s > lx <- c(NA_real_, NA_real_) 408s > y0 <- logSumExp_R(lx, na.rm = TRUE) 408s > y <- logSumExp(lx, na.rm = TRUE) 408s > print(y) 408s [1] -Inf 408s > stopifnot(identical(y, -Inf)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > lx <- c(NA_real_, NA_real_) 408s > y0 <- logSumExp_R(lx, na.rm = FALSE) 408s > y <- logSumExp(lx, na.rm = FALSE) 408s > print(y) 408s [1] NA 408s > stopifnot(identical(y, NA_real_)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > 408s > ## +Inf values 408s > lx <- c(1, 2, +Inf) 408s > y0 <- logSumExp_R(lx) 408s > y <- logSumExp(lx) 408s > print(y) 408s [1] Inf 408s > stopifnot(identical(y, +Inf)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > ## First element is a missing value, cf. PR #33 408s > lx <- c(NA_real_, 1) 408s > y0 <- logSumExp_R(lx) 408s > print(y0) 408s [1] NA 408s > y <- logSumExp(lx, na.rm = FALSE) 408s > print(y) 408s [1] NA 408s > stopifnot(identical(y, NA_real_)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > y0 <- logSumExp_R(lx, na.rm = TRUE) 408s > print(y0) 408s [1] 1 408s > y <- logSumExp(lx, na.rm = TRUE) 408s > print(y) 408s [1] 1 408s > stopifnot(identical(y, 1)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > ## Multiple -Inf values, cf. issue #84 408s > lx <- c(-Inf, -Inf) 408s > y0 <- logSumExp_R(lx) 408s > y <- logSumExp(lx) 408s > print(y) 408s [1] -Inf 408s > stopifnot(identical(y, -Inf)) 408s > stopifnot(all.equal(y, y0)) 408s > 408s > lx <- c(-Inf, 5, -Inf) 408s > y0 <- logSumExp_R(lx) 408s > y <- logSumExp(lx) 408s > print(y) 408s [1] 5 408s > stopifnot(identical(y, 5)) 408s > stopifnot(all.equal(y, y0)) 408s > 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: arm-unknown-linux-gnueabihf (32-bit) 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 > logSumExp_R <- function(lx, na.rm = FALSE) { 408s + log(sum(exp(lx), na.rm = na.rm)) 408s + } 408s > 408s > 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > # Subsetted tests 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > source("utils/validateIndicesFramework.R") 408s > x <- runif(6, min = -6, max = 6) 408s > for (idxs in index_cases) { 408s + validateIndicesTestVector(x, idxs, 408s + ftest = logSumExp, fsure = logSumExp_R, 408s + na.rm = FALSE) 408s + validateIndicesTestVector(x, idxs, 408s + ftest = logSumExp, fsure = logSumExp_R, 408s + na.rm = TRUE) 408s + } 408s > 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: arm-unknown-linux-gnueabihf (32-bit) 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 > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > # Consistency checks 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > set.seed(1) 408s > 408s > mean2_R <- function(x, na.rm = FALSE, idxs = NULL) { 408s + if (is.null(idxs)) { 408s + mean(x, na.rm = na.rm) 408s + } else { 408s + mean(x[idxs], na.rm = na.rm) 408s + } 408s + } # mean2_R() 408s > 408s > 408s > cat("Consistency checks:\n") 408s Consistency checks: 408s > for (kk in 1:20) { 408s + cat("Random test #", kk, "\n", sep = "") 408s + 408s + # Simulate data in a matrix of any shape 408s + n <- sample(100L, size = 1L) 408s + x <- rnorm(n, sd = 100) 408s + 408s + # Add NAs? 408s + if ((kk %% 4) %in% c(3, 0)) { 408s + cat("Adding NAs\n") 408s + nna <- sample(n, size = 1L) 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 + # Integer or double? 408s + if ((kk %% 4) %in% c(2, 0)) { 408s + cat("Coercing to integers\n") 408s + storage.mode(x) <- "integer" 408s + } 408s + 408s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 408s + 408s + # Sum over all 408s + y0 <- mean2_R(x, na.rm = na.rm) 408s + y1 <- mean2(x, na.rm = na.rm) 408s + stopifnot(all.equal(y1, y0)) 408s + 408s + # Sum over subset 408s + nidxs <- sample(n, size = 1L) 408s + idxs <- sample(n, size = nidxs) 408s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 408s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 408s + stopifnot(all.equal(y1, y0)) 408s + 408s + if (storage.mode(x) == "integer") { 408s + storage.mode(x) <- "logical" 408s + 408s + y0 <- mean2_R(x, na.rm = na.rm) 408s + y1 <- mean2(x, na.rm = na.rm) 408s + stopifnot(all.equal(y1, y0)) 408s + 408s + y0 <- mean2_R(x, na.rm = na.rm, idxs = idxs) 408s + y1 <- mean2(x, na.rm = na.rm, idxs = idxs) 408s + stopifnot(all.equal(y1, y0)) 408s + } 408s + } # for (kk ...) 408s Random test #1 408s Random test #2 408s Coercing to integers 408s Random test #3 408s Adding NAs 408s Random test #4 408s Adding NAs 408s Coercing to integers 408s Random test #5 408s Random test #6 408s Coercing to integers 408s Random test #7 408s Adding NAs 408s Random test #8 408s Adding NAs 408s Coercing to integers 408s Random test #9 408s Random test #10 408s Coercing to integers 408s Random test #11 408s Adding NAs 408s Random test #12 408s Adding NAs 408s Coercing to integers 408s Random test #13 408s Random test #14 408s Coercing to integers 408s Random test #15 408s Adding NAs 408s Random test #16 408s Adding NAs 408s Coercing to integers 408s Random test #17 408s Random test #18 408s Coercing to integers 408s Random test #19 408s Adding NAs 408s Random test #20 408s Adding NAs 408s Coercing to integers 408s > 408s > 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > # Special cases 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > for (na.rm in c(FALSE, TRUE)) { 408s + # Averaging over zero elements (integers) 408s + x <- integer(0) 408s + s1 <- mean(x, na.rm = na.rm) 408s + s2 <- mean2(x, na.rm = na.rm) 408s + stopifnot(identical(s1, s2)) 408s + 408s + x <- 1:5 408s + idxs <- integer(0) 408s + s1 <- mean(x[idxs], na.rm = na.rm) 408s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 408s + stopifnot(identical(s1, s2)) 408s + 408s + # Averaging over NA_integer_:s 408s + x <- rep(NA_integer_, times = 5L) 408s + s1 <- mean(x, na.rm = na.rm) 408s + s2 <- mean2(x, na.rm = na.rm) 408s + stopifnot(identical(s1, s2)) 408s + 408s + x <- rep(NA_integer_, times = 5L) 408s + idxs <- 1:3 408s + s1 <- mean(x[idxs], na.rm = na.rm) 408s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 408s + stopifnot(identical(s1, s2)) 408s + 408s + 408s + # Averaging over zero elements (doubles) 408s + x <- double(0) 408s + s1 <- mean(x) 408s + s2 <- mean2(x) 408s + stopifnot(identical(s1, s2)) 408s + 408s + x <- as.double(1:10) 408s + idxs <- integer(0) 408s + s1 <- mean(x[idxs]) 408s + s2 <- mean2(x, idxs = idxs) 408s + stopifnot(identical(s1, s2)) 408s + 408s + # Averaging over NA_real_:s 408s + x <- rep(NA_real_, times = 5L) 408s + s1 <- mean(x, na.rm = na.rm) 408s + s2 <- mean2(x, na.rm = na.rm) 408s + stopifnot(identical(s1, s2)) 408s + 408s + x <- rep(NA_real_, times = 5L) 408s + idxs <- 1:3 408s + s1 <- mean(x[idxs], na.rm = na.rm) 408s + s2 <- mean2(x, idxs = idxs, na.rm = na.rm) 408s + stopifnot(identical(s1, s2)) 408s + 408s + # Averaging over -Inf:s 408s + x <- rep(-Inf, times = 3L) 408s + s1 <- mean(x, na.rm = na.rm) 408s + s2 <- mean2(x, na.rm = na.rm) 408s + stopifnot(identical(s1, s2)) 408s + 408s + # Averaging over +Inf:s 408s + x <- rep(+Inf, times = 3L) 408s + s1 <- mean(x, na.rm = na.rm) 408s + s2 <- mean2(x, na.rm = na.rm) 408s + stopifnot(identical(s1, s2)) 408s + 408s + # Averaging over mix of -Inf:s and +Inf:s 408s + x <- rep(c(-Inf, +Inf), times = 3L) 408s + s1 <- mean(x, na.rm = na.rm) 408s + s2 <- mean2(x, na.rm = na.rm) 408s + stopifnot(identical(s1, s2)) 408s + 408s + # Averaging over mix of -Inf:s and +Inf:s and numerics 408s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 408s + s1 <- mean(x, na.rm = na.rm) 408s + s2 <- mean2(x, na.rm = na.rm) 408s + stopifnot(identical(s1, s2)) 408s + 408s + # Averaging over mix of NaN, NA, +Inf, and numerics 408s + x <- c(NaN, NA, +Inf, 3.14) 408s + s1 <- mean(x, na.rm = na.rm) 408s + s2 <- mean2(x, na.rm = na.rm) 408s + if (na.rm) { 408s + stopifnot(identical(s2, s1)) 408s + } else { 408s + stopifnot(is.na(s1), is.na(s2)) 408s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 408s + ## returned here (as one would expect). NaN might very well be returned, 408s + ## when both NA and NaN are involved. This is an accepted feature in R, 408s + ## which is documented in help("is.nan"). See also 408s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 408s + ## Thus, we cannot guarantee that s1 is identical to s0. 408s + } 408s + 408s + # Averaging over mix of NaN, NA_real_, +Inf, and numerics 408s + x <- c(NA_real_, NaN, +Inf, 3.14) 408s + s1 <- mean(x, na.rm = na.rm) 408s + s2 <- mean2(x, na.rm = na.rm) 408s + if (na.rm) { 408s + stopifnot(identical(s2, s1)) 408s + } else { 408s + stopifnot(is.na(s1), is.na(s2)) 408s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 408s + ## returned here (as one would expect). NaN might very well be returned, 408s + ## when both NA and NaN are involved. This is an accepted feature in R, 408s + ## which is documented in help("is.nan"). See also 408s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 408s + ## Thus, we cannot guarantee that s1 is identical to s0. 408s + } 408s + } 408s > 408s > 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > # Argument 'idxs' 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > x <- 1:5 408s > idxs_list <- list( 408s + integer = 1:3, 408s + double = as.double(1:3), 408s + logical = (x <= 3) 408s + ) 408s > 408s > for (idxs in idxs_list) { 408s + cat("idxs:\n") 408s + str(idxs) 408s + s1 <- mean(x[idxs], na.rm = TRUE) 408s + s2 <- mean2(x, idxs = idxs, na.rm = TRUE) 408s + stopifnot(identical(s1, s2)) 408s + } 408s idxs: 408s int [1:3] 1 2 3 408s idxs: 408s num [1:3] 1 2 3 408s idxs: 408s logi [1:5] TRUE TRUE TRUE FALSE FALSE 408s > 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: arm-unknown-linux-gnueabihf (32-bit) 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 > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > # Subsetted tests 408s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 408s > source("utils/validateIndicesFramework.R") 408s > x <- runif(6, min = -6, max = 6) 408s > storage.mode(x) <- "integer" 408s > for (idxs in index_cases) { 408s + validateIndicesTestVector(x, idxs, 408s + ftest = mean2, fsure = mean, 408s + na.rm = FALSE) 408s + validateIndicesTestVector(x, idxs, 408s + ftest = mean2, fsure = mean, 408s + na.rm = TRUE) 408s + } 408s > 409s 409s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 409s Copyright (C) 2025 The R Foundation for Statistical Computing 409s Platform: arm-unknown-linux-gnueabihf (32-bit) 409s 409s R is free software and comes with ABSOLUTELY NO WARRANTY. 409s You are welcome to redistribute it under certain conditions. 409s Type 'license()' or 'licence()' for distribution details. 409s 409s R is a collaborative project with many contributors. 409s Type 'contributors()' for more information and 409s 'citation()' on how to cite R or R packages in publications. 409s 409s Type 'demo()' for some demos, 'help()' for on-line help, or 409s 'help.start()' for an HTML browser interface to help. 409s Type 'q()' to quit R. 409s 409s > library("matrixStats") 409s > 409s > for (mode in c("integer", "double")) { 409s + cat("mode: ", mode, "\n", sep = "") 409s + 409s + # Empty vector 409s + x <- 0 409s + storage.mode(x) <- mode 409s + y <- prod(x, na.rm = TRUE) 409s + print(y) 409s + z <- product(x, na.rm = TRUE) 409s + print(z) 409s + stopifnot(all.equal(z, y)) 409s + 409s + # Test negative values 409s + x <- c(1, -4, 2) 409s + storage.mode(x) <- mode 409s + y <- prod(x, na.rm = TRUE) 409s + print(y) 409s + z <- product(x, na.rm = TRUE) 409s + print(z) 409s + stopifnot(all.equal(z, y)) 409s + 409s + # Test missing values 409s + x <- c(1, NA, NaN, 2) 409s + storage.mode(x) <- mode 409s + y <- prod(x, na.rm = TRUE) 409s + print(y) 409s + z <- product(x, na.rm = TRUE) 409s + print(z) 409s + stopifnot(all.equal(z, y)) 409s + 409s + x <- c(1, NA, NaN, 2) 409s + storage.mode(x) <- mode 409s + y <- prod(x, na.rm = FALSE) 409s + print(y) 409s + z <- product(x, na.rm = FALSE) 409s + print(z) 409s + stopifnot(all(is.na(z), is.na(y))) 409s + 409s + x <- c(1, NaN, 2) 409s + storage.mode(x) <- mode 409s + y <- prod(x, na.rm = FALSE) 409s + print(y) 409s + stopifnot(is.na(y)) 409s + z <- product(x, na.rm = FALSE) 409s + print(z) 409s + stopifnot(is.na(z)) 409s + 409s + } # for (mode ...) 409s mode: integer 409s [1] 0 409s [1] 0 409s [1] -8 409s [1] -8 409s [1] 2 409s [1] 2 409s [1] NA 409s [1] NA 409s [1] NA 409s [1] NA 409s mode: double 409s [1] 0 409s [1] 0 409s [1] -8 409s [1] -8 409s [1] 2 409s [1] 2 409s [1] NA 409s [1] NA 409s [1] NaN 409s [1] NA 409s > 409s > 409s > # NAs following 0s 409s > x <- c(0L, NA_integer_) 409s > y <- prod(x, na.rm = FALSE) 409s > print(y) 409s [1] NA 409s > z <- product(x, na.rm = FALSE) 409s > print(z) 409s [1] NA 409s > stopifnot(identical(z, y)) 409s > 409s 409s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 409s Copyright (C) 2025 The R Foundation for Statistical Computing 409s Platform: arm-unknown-linux-gnueabihf (32-bit) 409s 409s R is free software and comes with ABSOLUTELY NO WARRANTY. 409s You are welcome to redistribute it under certain conditions. 409s Type 'license()' or 'licence()' for distribution details. 409s 409s R is a collaborative project with many contributors. 409s Type 'contributors()' for more information and 409s 'citation()' on how to cite R or R packages in publications. 409s 409s Type 'demo()' for some demos, 'help()' for on-line help, or 409s 'help.start()' for an HTML browser interface to help. 409s Type 'q()' to quit R. 409s 409s > library("matrixStats") 409s > 409s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 409s > # Subsetted tests 409s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 409s > source("utils/validateIndicesFramework.R") 409s > x <- runif(6, min = -6, max = 6) 409s > storage.mode(x) <- "integer" 409s > for (idxs in index_cases) { 409s + validateIndicesTestVector(x, idxs, 409s + ftest = product, fsure = prod, 409s + na.rm = TRUE) 409s + validateIndicesTestVector(x, idxs, 409s + ftest = product, fsure = prod, 409s + na.rm = FALSE) 409s + } 409s > 409s 409s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 409s Copyright (C) 2025 The R Foundation for Statistical Computing 409s Platform: arm-unknown-linux-gnueabihf (32-bit) 409s 409s R is free software and comes with ABSOLUTELY NO WARRANTY. 409s You are welcome to redistribute it under certain conditions. 409s Type 'license()' or 'licence()' for distribution details. 409s 409s R is a collaborative project with many contributors. 409s Type 'contributors()' for more information and 409s 'citation()' on how to cite R or R packages in publications. 409s 409s Type 'demo()' for some demos, 'help()' for on-line help, or 409s 'help.start()' for an HTML browser interface to help. 409s Type 'q()' to quit R. 409s 409s > library("matrixStats") 409s > library("utils") ## utils::str 409s > 409s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 409s > # Local functions 409s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 409s > psortKM_R <- function(x, k, m) { 409s + x <- sort(x) 409s + x[(k - m + 1):k] 409s + } 409s > 409s > psortKM_R2 <- function(x, k, m) { 409s + partial <- (k - m + 1):k 409s + x <- sort.int(x, partial = partial) 409s + x[partial] 409s + } 409s > 409s > 409s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 409s > # Consistency checks 409s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 409s > set.seed(1) 409s > 409s > cat("Consistency checks:\n") 409s Consistency checks: 409s > x <- 1:30 409s > x[18:20] <- 20 409s > y <- sample(x) 409s > cat("x:\n") 409s x: 409s > str(x) 409s num [1:30] 1 2 3 4 5 6 7 8 9 10 ... 409s > cat("sample(x):\n") 409s sample(x): 409s > str(y) 409s num [1:30] 25 4 7 1 2 23 11 14 20 20 ... 409s > 409s > for (k in c(1L, 2L, 20L, 21L, length(x))) { 409s + for (m in 1:min(5L, k)) { 409s + px0 <- psortKM_R(x, k = k, m = m) 409s + px0b <- psortKM_R2(x, k = k, m = m) 409s + stopifnot(identical(px0b, px0)) 409s + px1 <- matrixStats:::.psortKM(x, k = k, m = m) 409s + cat(sprintf(".psortKM(x, k = %d, m = %d):\n", k, m)) 409s + print(px1) 409s + stopifnot(identical(px1, px0)) 409s + 409s + py0 <- psortKM_R(y, k = k, m = m) 409s + py0b <- psortKM_R2(y, k = k, m = m) 409s + stopifnot(identical(py0b, py0)) 409s + py1 <- matrixStats:::.psortKM(y, k = k, m = m) 409s + cat(sprintf(".psortKM(y, k = %d, m = %d):\n", k, m)) 409s + print(py1) 409s + stopifnot(identical(py1, py0)) 409s + stopifnot(identical(py1, px1)) 409s + } # for (m ...) 409s + } # for (k ...) 409s .psortKM(x, k = 1, m = 1): 409s [1] 1 409s .psortKM(y, k = 1, m = 1): 409s [1] 1 409s .psortKM(x, k = 2, m = 1): 409s [1] 2 409s .psortKM(y, k = 2, m = 1): 409s [1] 2 409s .psortKM(x, k = 2, m = 2): 409s [1] 1 2 409s .psortKM(y, k = 2, m = 2): 409s [1] 1 2 409s .psortKM(x, k = 20, m = 1): 409s [1] 20 409s .psortKM(y, k = 20, m = 1): 409s [1] 20 409s .psortKM(x, k = 20, m = 2): 409s [1] 20 20 409s .psortKM(y, k = 20, m = 2): 409s [1] 20 20 409s .psortKM(x, k = 20, m = 3): 409s [1] 20 20 20 409s .psortKM(y, k = 20, m = 3): 409s [1] 20 20 20 409s .psortKM(x, k = 20, m = 4): 409s [1] 17 20 20 20 409s .psortKM(y, k = 20, m = 4): 409s [1] 17 20 20 20 409s .psortKM(x, k = 20, m = 5): 409s [1] 16 17 20 20 20 409s .psortKM(y, k = 20, m = 5): 409s [1] 16 17 20 20 20 409s .psortKM(x, k = 21, m = 1): 409s [1] 21 409s .psortKM(y, k = 21, m = 1): 409s [1] 21 409s .psortKM(x, k = 21, m = 2): 409s [1] 20 21 409s .psortKM(y, k = 21, m = 2): 409s [1] 20 21 409s .psortKM(x, k = 21, m = 3): 409s [1] 20 20 21 409s .psortKM(y, k = 21, m = 3): 409s [1] 20 20 21 409s .psortKM(x, k = 21, m = 4): 409s [1] 20 20 20 21 409s .psortKM(y, k = 21, m = 4): 409s [1] 20 20 20 21 409s .psortKM(x, k = 21, m = 5): 409s [1] 17 20 20 20 21 409s .psortKM(y, k = 21, m = 5): 409s [1] 17 20 20 20 21 409s .psortKM(x, k = 30, m = 1): 409s [1] 30 409s .psortKM(y, k = 30, m = 1): 409s [1] 30 409s .psortKM(x, k = 30, m = 2): 409s [1] 29 30 409s .psortKM(y, k = 30, m = 2): 409s [1] 29 30 409s .psortKM(x, k = 30, m = 3): 409s [1] 28 29 30 409s .psortKM(y, k = 30, m = 3): 409s [1] 28 29 30 409s .psortKM(x, k = 30, m = 4): 409s [1] 27 28 29 30 409s .psortKM(y, k = 30, m = 4): 409s [1] 27 28 29 30 409s .psortKM(x, k = 30, m = 5): 409s [1] 26 27 28 29 30 409s .psortKM(y, k = 30, m = 5): 409s [1] 26 27 28 29 30 409s > 409s 409s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 409s Copyright (C) 2025 The R Foundation for Statistical Computing 409s Platform: arm-unknown-linux-gnueabihf (32-bit) 409s 409s R is free software and comes with ABSOLUTELY NO WARRANTY. 409s You are welcome to redistribute it under certain conditions. 409s Type 'license()' or 'licence()' for distribution details. 409s 409s R is a collaborative project with many contributors. 409s Type 'contributors()' for more information and 409s 'citation()' on how to cite R or R packages in publications. 409s 409s Type 'demo()' for some demos, 'help()' for on-line help, or 409s 'help.start()' for an HTML browser interface to help. 409s Type 'q()' to quit R. 409s 410s > library("matrixStats") 410s > 410s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 410s + if (is.na(value)) { 410s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 410s + } else { 410s + y <- x == value 410s + 410s + # Preserve dimnames attribute 410s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 410s + if (!isTRUE(all.equal(dim(y), dim))) { 410s + dim(y) <- dim 410s + dimnames(y) <- dimnames(x) 410s + } 410s + 410s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 410s + } 410s + if (!useNames) names(res) <- NULL 410s + res 410s + } 410s > 410s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 410s + if (is.na(value)) { 410s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 410s + } else { 410s + y <- x == value 410s + 410s + # Preserve dimnames attribute 410s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 410s + if (!isTRUE(all.equal(dim(y), dim))) { 410s + dim(y) <- dim 410s + dimnames(y) <- dimnames(x) 410s + } 410s + 410s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 410s + } 410s + if (!useNames) names(res) <- NULL 410s + res 410s + } 410s > 410s > rowAnyMissings_R <- function(x, ..., useNames = TRUE) { 410s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 410s + if (!useNames) names(res) <- NULL 410s + res 410s + } 410s > 410s > 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > # Data type: logical 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 410s > x[7:8, 2:3] <- TRUE 410s > x[1:3, ] <- TRUE 410s > x[, 1] <- TRUE 410s > x[4, ] <- FALSE 410s > x[, 4] <- FALSE 410s > x[2, ] <- FALSE 410s > x[3, ] <- TRUE 410s > 410s > # To check names attribute 410s > dimnames <- list(letters[1:10], LETTERS[1:4]) 410s > 410s > for (kk in 1:3) { 410s + if (kk == 2) { 410s + x[2, 2] <- NA 410s + } else if (kk == 3) { 410s + x[, 2] <- NA 410s + x[2, ] <- NA 410s + } 410s + 410s + # Test with and without dimnames on x 410s + for (setDimnames in c(TRUE, FALSE)) { 410s + dimnames(x) <- if (setDimnames) dimnames else NULL 410s + 410s + for (na.rm in c(FALSE, TRUE)) { 410s + # Check names attribute 410s + for (useNames in c(TRUE, FALSE)) { 410s + m0 <- rowAlls_R(x, na.rm = na.rm, useNames = useNames) 410s + m1 <- rowAlls(x, na.rm = na.rm, useNames = useNames) 410s + m2 <- colAlls(t(x), na.rm = na.rm, useNames = useNames) 410s + str(list("all()", m0 = m0, m1 = m1, m2 = m2)) 410s + stopifnot(identical(m1, m0)) 410s + stopifnot(identical(m2, m0)) 410s + 410s + m0 <- rowAnys_R(x, na.rm = na.rm, useNames = useNames) 410s + m1 <- rowAnys(x, na.rm = na.rm, useNames = useNames) 410s + m2 <- colAnys(t(x), na.rm = na.rm, useNames = useNames) 410s + str(list("any()", m0 = m0, m1 = m1, m2 = m2)) 410s + stopifnot(identical(m1, m0)) 410s + stopifnot(identical(m2, m0)) 410s + 410s + m0 <- rowAnyMissings_R(x, useNames = useNames) 410s + m1 <- rowAnyMissings(x, useNames = useNames) 410s + m2 <- colAnyMissings(t(x), useNames = useNames) 410s + str(list("anyMissing()", m0 = m0, m1 = m1, m2 = m2)) 410s + stopifnot(identical(m1, m0)) 410s + stopifnot(identical(m2, m0)) 410s + } 410s + } 410s + } 410s + } # for (kk ...) 410s List of 4 410s $ : chr "all()" 410s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "any()" 410s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "any()" 410s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "any()" 410s $ m0: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "any()" 410s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE NA TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE FALSE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE TRUE FALSE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "any()" 410s $ m0: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "any()" 410s $ m0: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m1: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s $ m2: Named logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s ..- attr(*, "names")= chr [1:10] "a" "b" "c" "d" ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE NA NA FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s $ m1: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s $ m2: logi [1:10] TRUE NA TRUE NA TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s List of 4 410s $ : chr "all()" 410s $ m0: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s $ m1: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s $ m2: logi [1:10] FALSE TRUE TRUE FALSE FALSE FALSE ... 410s List of 4 410s $ : chr "any()" 410s $ m0: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE FALSE TRUE FALSE TRUE TRUE ... 410s List of 4 410s $ : chr "anyMissing()" 410s $ m0: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m1: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s $ m2: logi [1:10] TRUE TRUE TRUE TRUE TRUE TRUE ... 410s > 410s > 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > # Data type: integer 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > x <- matrix(rep(1:6, length.out = 4 * 5), nrow = 4L, ncol = 5L) 410s > x[2, ] <- 7L 410s > x[3, 1] <- 7L 410s > x[2:3, 3:4] <- NA_integer_ 410s > 410s > # To check names attribute 410s > dimnames <- list(letters[1:4], LETTERS[1:5]) 410s > 410s > # Row/column counts 410s > value <- 7L 410s > 410s > # Test with and without dimnames on x 410s > for (setDimnames in c(TRUE, FALSE)) { 410s + dimnames(x) <- if (setDimnames) dimnames else NULL 410s + for (na.rm in c(FALSE, TRUE)) { 410s + # Check names attribute 410s + for (useNames in c(TRUE, FALSE)) { 410s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 410s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 410s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 410s + stopifnot(identical(r1, r0)) 410s + stopifnot(identical(r2, r1)) 410s + if (!useNames && !setDimnames) { 410s + for (rr in seq_len(nrow(x))) { 410s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 410s + stopifnot(identical(c, r1[rr])) 410s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 410s + stopifnot(identical(c, r1[rr])) 410s + } 410s + } 410s + 410s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 410s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 410s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 410s + stopifnot(identical(r1, r0)) 410s + stopifnot(identical(r2, r1)) 410s + if (!useNames && !setDimnames) { 410s + for (rr in seq_len(nrow(x))) { 410s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 410s + stopifnot(identical(c, r1[rr])) 410s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 410s + stopifnot(identical(c, r1[rr])) 410s + } 410s + } 410s + } 410s + } 410s + } 410s > 410s > 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > # rowAlls(x) et al. on numeric 'x' with logical 'value' 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > x <- matrix(0, nrow = 4L, ncol = 5L) 410s > x[2:4, 2] <- (1:3) / 4 410s > x[2, 2:4] <- (1:3) / 4 410s > x[3:4, 3] <- (3:4) / 4 410s > x[3, 3:4] <- (3:4) / 4 410s > x[1:4, 5] <- (1:4) / 5 410s > x[4, 4] <- NA_real_ 410s > 410s > # To check names attribute 410s > dimnames <- list(letters[1:4], LETTERS[1:5]) 410s > 410s > for (value in c(TRUE, FALSE)) { 410s + for (na.rm in c(FALSE, TRUE)) { 410s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 410s + y <- rowAnys(x, na.rm = na.rm, value = value) 410s + stopifnot(identical(y, y0)) 410s + # Check names attribute 410s + dimnames(x) <- dimnames 410s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 410s + stopifnot(all.equal(y, y0)) 410s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 410s + y <- rowAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 410s + stopifnot(all.equal(y, y0)) 410s + dimnames(x) <- NULL 410s + 410s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 410s + y <- colAnys(x, na.rm = na.rm, value = value) 410s + stopifnot(identical(y, y0)) 410s + # Check names attribute 410s + dimnames(x) <- dimnames 410s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = FALSE) 410s + stopifnot(all.equal(y, y0)) 410s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) any(as.logical(e) == value, na.rm = na.rm))) 410s + y <- colAnys(x, na.rm = na.rm, value = value, useNames = TRUE) 410s + stopifnot(all.equal(y, y0)) 410s + dimnames(x) <- NULL 410s + 410s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 410s + y <- rowAlls(x, na.rm = na.rm, value = value) 410s + stopifnot(identical(y, y0)) 410s + # Check names attribute 410s + dimnames(x) <- dimnames 410s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 410s + stopifnot(all.equal(y, y0)) 410s + y0 <- suppressWarnings(apply(x, MARGIN = 1L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 410s + y <- rowAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 410s + stopifnot(all.equal(y, y0)) 410s + dimnames(x) <- NULL 410s + 410s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 410s + y <- colAlls(x, na.rm = na.rm, value = value) 410s + stopifnot(identical(y, y0)) 410s + print(y0) 410s + # Check names attribute 410s + dimnames(x) <- dimnames 410s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = FALSE) 410s + stopifnot(all.equal(y, y0)) 410s + y0 <- suppressWarnings(apply(x, MARGIN = 2L, FUN = function(e) all(as.logical(e) == value, na.rm = na.rm))) 410s + y <- colAlls(x, na.rm = na.rm, value = value, useNames = TRUE) 410s + stopifnot(all.equal(y, y0)) 410s + dimnames(x) <- NULL 410s + } ## for (na.rm ...) 410s + } ## for(value ...) 410s [1] FALSE FALSE FALSE FALSE TRUE 410s [1] FALSE FALSE FALSE FALSE TRUE 410s [1] TRUE FALSE FALSE FALSE FALSE 410s [1] TRUE FALSE FALSE FALSE FALSE 410s > 410s > 410s > 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > # Data type: character (not sure if this should be supported) 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > all_R <- function(x, value = TRUE, ...) { 410s + if (is.na(value)) { 410s + all(is.na(x), ...) 410s + } else { 410s + all(x == value, ...) 410s + } 410s + } 410s > 410s > any_R <- function(x, value = TRUE, ...) { 410s + if (is.na(value)) { 410s + any(is.na(x), ...) 410s + } else { 410s + any(x == value, ...) 410s + } 410s + } 410s > 410s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 410s > x[2, ] <- "g" 410s > x[2:4, 3:4] <- NA_character_ 410s > 410s > # To check names attribute 410s > dimnames <- list(letters[1:10], LETTERS[1:5]) 410s > 410s > # Test with and without dimnames on x 410s > for (setDimnames in c(TRUE, FALSE)) { 410s + dimnames(x) <- if (setDimnames) dimnames else NULL 410s + 410s + # Row/column counts 410s + for (value in c("g", NA_character_)) { 410s + for (na.rm in c(FALSE, TRUE)) { 410s + # Check names attribute 410s + for (useNames in c(TRUE, FALSE)) { 410s + r0 <- rowAlls_R(x, value = value, na.rm = na.rm, useNames = useNames) 410s + r1 <- rowAlls(x, value = value, na.rm = na.rm, useNames = useNames) 410s + r2 <- colAlls(t(x), value = value, na.rm = na.rm, useNames = useNames) 410s + stopifnot(identical(r1, r0)) 410s + stopifnot(identical(r2, r1)) 410s + if (!useNames && !setDimnames) { 410s + for (rr in seq_len(nrow(x))) { 410s + c0 <- all_R(x[rr, ], value, na.rm = na.rm) 410s + c <- allValue(x[rr, ], value = value, na.rm = na.rm) 410s + stopifnot(identical(c, r1[rr])) 410s + stopifnot(identical(c, c0)) 410s + } 410s + } 410s + 410s + r0 <- rowAnys_R(x, value = value, na.rm = na.rm, useNames = useNames) 410s + r1 <- rowAnys(x, value = value, na.rm = na.rm, useNames = useNames) 410s + r2 <- colAnys(t(x), value = value, na.rm = na.rm, useNames = useNames) 410s + stopifnot(identical(r1, r0)) 410s + stopifnot(identical(r2, r1)) 410s + if (!useNames && !setDimnames) { 410s + for (rr in seq_len(nrow(x))) { 410s + c0 <- any_R(x[rr, ], value, na.rm = na.rm) 410s + c <- anyValue(x[rr, ], value = value, na.rm = na.rm) 410s + stopifnot(identical(c, c0)) 410s + stopifnot(identical(c, r1[rr])) 410s + } 410s + } 410s + } 410s + } 410s + } 410s + } 410s > 410s > 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > # NA 0 test 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > x <- matrix(0, nrow = 3L, ncol = 3L) 410s > x[1, ] <- c(NA_real_, NA_real_, 0) 410s > x[3, ] <- c(1, 0, 1) 410s > 410s > dimnames <- list(letters[1:3], LETTERS[1:3]) 410s > 410s > # Test with and without dimnames on x 410s > for (setDimnames in c(TRUE, FALSE)) { 410s + dimnames(x) <- if (setDimnames) dimnames else NULL 410s + # Check names attribute 410s + for (useNames in c(TRUE, FALSE)) { 410s + r0 <- rowAnys_R(x, value = 0, useNames = useNames) 410s + r1 <- rowAnys(x, value = 0, useNames = useNames) 410s + stopifnot(identical(r0, r1)) 410s + } 410s + } 410s > 410s 410s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 410s Copyright (C) 2025 The R Foundation for Statistical Computing 410s Platform: arm-unknown-linux-gnueabihf (32-bit) 410s 410s R is free software and comes with ABSOLUTELY NO WARRANTY. 410s You are welcome to redistribute it under certain conditions. 410s Type 'license()' or 'licence()' for distribution details. 410s 410s R is a collaborative project with many contributors. 410s Type 'contributors()' for more information and 410s 'citation()' on how to cite R or R packages in publications. 410s 410s Type 'demo()' for some demos, 'help()' for on-line help, or 410s 'help.start()' for an HTML browser interface to help. 410s Type 'q()' to quit R. 410s 410s > library("matrixStats") 410s > 410s > rowAlls_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 410s + if (is.na(value)) { 410s + res <- apply(is.na(x), MARGIN = 1L, FUN = all, na.rm = na.rm) 410s + } else { 410s + y <- x == value 410s + 410s + # Preserve dimnames attribute 410s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 410s + if (!isTRUE(all.equal(dim(y), dim))) { 410s + dim(y) <- dim 410s + dimnames(y) <- dimnames(x) 410s + } 410s + 410s + res <- apply(y, MARGIN = 1L, FUN = all, na.rm = na.rm) 410s + } 410s + if (!useNames) names(res) <- NULL 410s + res 410s + } 410s > 410s > rowAnys_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 410s + if (is.na(value)) { 410s + res <- apply(is.na(x), MARGIN = 1L, FUN = any, na.rm = na.rm) 410s + } else { 410s + y <- x == value 410s + 410s + # Preserve dimnames attribute 410s + dim <- dim(x) # for 0xN and Mx0 cases; needed in R (< 3.4.0) 410s + if (!isTRUE(all.equal(dim(y), dim))) { 410s + dim(y) <- dim 410s + dimnames(y) <- dimnames(x) 410s + } 410s + 410s + res <- apply(y, MARGIN = 1L, FUN = any, na.rm = na.rm) 410s + } 410s + if (!useNames) names(res) <- NULL 410s + res 410s + } 410s > 410s > rowAnyMissings_R <- function(x, ..., useNames = TRUE) { 410s + res <- apply(x, MARGIN = 1L, FUN = anyMissing) 410s + if (!useNames) names(res) <- NULL 410s + res 410s + } 410s > 410s > 410s > all_R <- function(x, value = TRUE, ...) { 410s + if (is.na(value)) { 410s + all(is.na(x), ...) 410s + } else { 410s + all(x == value, ...) 410s + } 410s + } 410s > 410s > any_R <- function(x, value = TRUE, ...) { 410s + if (is.na(value)) { 410s + any(is.na(x), ...) 410s + } else { 410s + any(x == value, ...) 410s + } 410s + } 410s > 410s > 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > # Subsetted tests 410s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 410s > source("utils/validateIndicesFramework.R") 410s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 410s > storage.mode(x) <- "integer" 410s > x[2:3, ] <- NA_integer_ 410s > x[2, 1] <- 0L 410s > x[4:5, ] <- 0L 410s > x[4, 6] <- NA_integer_ 410s > 410s > # To check names attribute 410s > dimnames <- list(letters[1:6], LETTERS[1:6]) 410s > 410s > # Test with and without dimnames on x 410s > for (setDimnames in c(TRUE, FALSE)) { 410s + if (setDimnames) dimnames(x) <- dimnames 410s + else dimnames(x) <- NULL 410s + 410s + count <- 0L 410s + for (rows in index_cases) { 410s + for (cols in index_cases) { 410s + count <- count + 1L 410s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 410s + useNames <- c(TRUE, FALSE) 410s + useNames <- useNames[count %% length(useNames) + 1] 410s + 410s + validateIndicesTestMatrix(x, rows, cols, 410s + ftest = rowAlls, fsure = rowAlls_R, 410s + value = 0, na.rm = TRUE, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + ftest = rowAlls, fsure = rowAlls_R, 410s + value = 0, na.rm = FALSE, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + ftest = rowAlls, fsure = rowAlls_R, 410s + value = NA_integer_, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + fcoltest = colAlls, fsure = rowAlls_R, 410s + value = 0, na.rm = TRUE, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + fcoltest = colAlls, fsure = rowAlls_R, 410s + value = 0, na.rm = FALSE, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + fcoltest = colAlls, fsure = rowAlls_R, 410s + value = NA_integer_, useNames = useNames) 410s + 410s + validateIndicesTestMatrix(x, rows, cols, 410s + ftest = rowAnys, fsure = rowAnys_R, 410s + value = 0, na.rm = TRUE, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + ftest = rowAnys, fsure = rowAnys_R, 410s + value = 0, na.rm = FALSE, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + ftest = rowAnys, fsure = rowAnys_R, 410s + value = NA_integer_, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + fcoltest = colAnys, fsure = rowAnys_R, 410s + value = 0, na.rm = TRUE, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + fcoltest = colAnys, fsure = rowAnys_R, 410s + value = 0, na.rm = FALSE, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + fcoltest = colAnys, fsure = rowAnys_R, 410s + value = NA_integer_, useNames = useNames) 410s + 410s + validateIndicesTestMatrix(x, rows, cols, 410s + ftest = rowAnyMissings, 410s + fsure = rowAnyMissings_R, useNames = useNames) 410s + validateIndicesTestMatrix(x, rows, cols, 410s + fcoltest = colAnyMissings, 410s + fsure = rowAnyMissings_R, useNames = useNames) 410s + } 410s + } 410s + } 412s > 412s > for (rr in seq_len(nrow(x))) { 412s + for (idxs in index_cases) { 412s + validateIndicesTestVector(x[rr, ], idxs, 412s + ftest = allValue, fsure = all_R, 412s + value = 0, na.rm = TRUE) 412s + validateIndicesTestVector(x[rr, ], idxs, 412s + ftest = allValue, fsure = all_R, 412s + value = 0, na.rm = FALSE) 412s + validateIndicesTestVector(x[rr, ], idxs, 412s + ftest = allValue, fsure = all_R, 412s + value = NA_integer_) 412s + 412s + validateIndicesTestVector(x[rr, ], idxs, 412s + ftest = anyValue, fsure = any_R, 412s + value = 0, na.rm = TRUE) 412s + validateIndicesTestVector(x[rr, ], idxs, 412s + ftest = anyValue, fsure = any_R, 412s + value = 0, na.rm = FALSE) 412s + validateIndicesTestVector(x[rr, ], idxs, 412s + ftest = anyValue, fsure = any_R, 412s + value = NA_integer_) 412s + } 412s + } 412s > 412s > 412s > storage.mode(x) <- "character" 412s > # Test with and without dimnames on x 412s > for (setDimnames in c(TRUE, FALSE)) { 412s + if (setDimnames) dimnames(x) <- dimnames 412s + else dimnames(x) <- NULL 412s + for (rows in index_cases) { 412s + for (cols in index_cases) { 412s + # Check names attribute 412s + for (useNames in c(TRUE, FALSE)) { 412s + validateIndicesTestMatrix(x, rows, cols, 412s + ftest = rowAlls, fsure = rowAlls_R, 412s + value = "0", na.rm = TRUE, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + ftest = rowAlls, fsure = rowAlls_R, 412s + value = "0", na.rm = FALSE, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + ftest = rowAlls, fsure = rowAlls_R, 412s + value = NA_character_, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + fcoltest = colAlls, fsure = rowAlls_R, 412s + value = "0", na.rm = TRUE, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + fcoltest = colAlls, fsure = rowAlls_R, 412s + value = "0", na.rm = FALSE, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + fcoltest = colAlls, fsure = rowAlls_R, 412s + value = NA_character_, useNames = useNames) 412s + 412s + validateIndicesTestMatrix(x, rows, cols, 412s + ftest = rowAnys, fsure = rowAnys_R, 412s + value = "0", na.rm = TRUE, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + ftest = rowAnys, fsure = rowAnys_R, 412s + value = "0", na.rm = FALSE, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + ftest = rowAnys, fsure = rowAnys_R, 412s + value = NA_character_, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + fcoltest = colAnys, fsure = rowAnys_R, 412s + value = "0", na.rm = TRUE, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + fcoltest = colAnys, fsure = rowAnys_R, 412s + value = "0", na.rm = FALSE, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + fcoltest = colAnys, fsure = rowAnys_R, 412s + value = NA_character_, useNames = useNames) 412s + 412s + validateIndicesTestMatrix(x, rows, cols, 412s + ftest = rowAnyMissings, 412s + fsure = rowAnyMissings_R, useNames = useNames) 412s + validateIndicesTestMatrix(x, rows, cols, 412s + fcoltest = colAnyMissings, 412s + fsure = rowAnyMissings_R, useNames = useNames) 412s + } 412s + } 412s + } 412s + } 415s > 415s > for (rr in seq_len(nrow(x))) { 415s + for (idxs in index_cases) { 415s + validateIndicesTestVector(x[rr, ], idxs, 415s + ftest = allValue, fsure = all_R, 415s + value = "0", na.rm = TRUE) 415s + validateIndicesTestVector(x[rr, ], idxs, 415s + ftest = allValue, fsure = all_R, 415s + value = "0", na.rm = FALSE) 415s + validateIndicesTestVector(x[rr, ], idxs, 415s + ftest = allValue, fsure = all_R, 415s + value = NA_integer_) 415s + 415s + validateIndicesTestVector(x[rr, ], idxs, 415s + ftest = anyValue, fsure = any_R, 415s + value = "0", na.rm = TRUE) 415s + validateIndicesTestVector(x[rr, ], idxs, 415s + ftest = anyValue, fsure = any_R, 415s + value = "0", na.rm = FALSE) 415s + validateIndicesTestVector(x[rr, ], idxs, 415s + ftest = anyValue, fsure = any_R, 415s + value = NA_integer_) 415s + } 415s + } 416s > 416s 416s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 416s Copyright (C) 2025 The R Foundation for Statistical Computing 416s Platform: arm-unknown-linux-gnueabihf (32-bit) 416s 416s R is free software and comes with ABSOLUTELY NO WARRANTY. 416s You are welcome to redistribute it under certain conditions. 416s Type 'license()' or 'licence()' for distribution details. 416s 416s R is a collaborative project with many contributors. 416s Type 'contributors()' for more information and 416s 'citation()' on how to cite R or R packages in publications. 416s 416s Type 'demo()' for some demos, 'help()' for on-line help, or 416s 'help.start()' for an HTML browser interface to help. 416s Type 'q()' to quit R. 416s 416s > library("matrixStats") 416s > 416s > X <- matrix(rnorm(20 * 6), nrow = 20, ncol = 6) 416s > rownames(X) <- LETTERS[1:nrow(X)] 416s > colnames(X) <- letters[1:ncol(X)] 416s > print(X) 416s a b c d e f 416s A -1.70969746 -0.20445118 0.626065149 -0.678241975 -0.8649937 -0.41310969 416s B -0.89044549 1.58883570 0.356272779 -0.448254369 0.3230926 0.48544529 416s C 0.71970594 -1.70950732 0.442595841 0.602678920 -0.1373078 -0.37308328 416s D -0.35402746 -0.31646814 -0.291657415 0.280860052 -0.3952813 -0.98654660 416s E -0.49139229 0.69680996 0.386202003 -0.350919042 1.0644137 0.07152831 416s F 0.47382601 0.37448742 -2.040464045 0.358071992 -0.2907490 1.71581178 416s G 0.37392719 -2.06479158 1.391528188 1.565101298 -0.1785149 -1.01474719 416s H -1.06307948 -0.77154089 -0.966091165 1.792433472 -0.5944901 1.24211583 416s I 0.20420194 1.59370529 1.085893442 -1.746237239 -0.5511201 0.00395480 416s J -0.75273500 1.94006090 -0.100670492 0.807709022 -0.3366237 -0.11293114 416s K 1.01085698 0.06673488 -1.796392536 0.035342460 0.3320512 0.08454176 416s L -0.01304227 -0.60632692 1.979528616 -0.067969180 1.3880478 -0.17689238 416s M 0.51047878 -0.44533585 -0.527855676 0.463988852 0.7946799 0.19159400 416s N 0.53815817 1.28201759 -0.489765217 1.816168286 -1.2711156 0.08789050 416s O 0.17379371 -0.80215442 0.311328130 -0.823577894 -0.6153302 -0.02498591 416s P -0.64821184 0.05646013 0.949158294 0.002725112 -1.0432842 -0.05208757 416s Q -0.50460733 -0.19490140 0.155902619 -0.099028211 -1.0756057 0.39570864 416s R -0.67163165 -0.89689520 -0.003122939 -1.219003656 0.2768634 0.31078309 416s S 0.62138278 1.60839764 0.932018300 -0.694517456 1.7182220 -1.59129228 416s T 0.23937863 -0.15594325 -1.045054755 -2.393285735 -1.0051318 -0.22545215 416s > 416s > 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > # Apply rowMeans() for 3 sets of 2 columns 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > nbr_of_sets <- 3L 416s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 416s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 416s > print(S) 416s s1 s2 s3 416s [1,] 1 3 5 416s [2,] 2 4 6 416s > 416s > Z <- rowAvgsPerColSet(X, S = S) 416s > print(Z) 416s s1 s2 s3 416s A -0.95707432 -0.026088413 -0.63905168 416s B 0.34919511 -0.045990795 0.40426894 416s C -0.49490069 0.522637381 -0.25519554 416s D -0.33524780 -0.005398681 -0.69091393 416s E 0.10270884 0.017641480 0.56797103 416s F 0.42415671 -0.841196027 0.71253138 416s G -0.84543219 1.478314743 -0.59663102 416s H -0.91731018 0.413171154 0.32381285 416s I 0.89895362 -0.330171898 -0.27358264 416s J 0.59366295 0.353519265 -0.22477744 416s K 0.53879593 -0.880525038 0.20829649 416s L -0.30968459 0.955779718 0.60557770 416s M 0.03257146 -0.031933412 0.49313694 416s N 0.91008788 0.663201535 -0.59161256 416s O -0.31418035 -0.256124882 -0.32015807 416s P -0.29587586 0.475941703 -0.54768590 416s Q -0.34975436 0.028437204 -0.33994852 416s R -0.78426343 -0.611063298 0.29382326 416s S 1.11489021 0.118750422 0.06346484 416s T 0.04171769 -1.719170245 -0.61529199 416s > 416s > # Validation 416s > Z0 <- cbind(s1 = rowMeans(X[, 1:2]), s2 = rowMeans(X[, 3:4]), 416s + s3 = rowMeans(X[, 5:6])) 416s > stopifnot(identical(drop(Z), Z0)) 416s > 416s > 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > # Apply colMeans() for 5 sets of 4 rows 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > nbr_of_sets <- 5L 416s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 416s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 416s > print(S) 416s s1 s2 s3 s4 s5 416s [1,] 1 5 9 13 17 416s [2,] 2 6 10 14 18 416s [3,] 3 7 11 15 19 416s [4,] 4 8 12 16 20 416s > 416s > Z <- colAvgsPerRowSet(X, S = S) 416s > print(Z) 416s a b c d e f 416s s1 -0.55861612 -0.16039774 0.283319088 -0.06073934 -0.2686225343 -0.32182357 416s s2 -0.17667964 -0.44125877 -0.307206255 0.84117193 0.0001649361 0.50367718 416s s3 0.11232041 0.74854354 0.292089757 -0.24278873 0.2080887924 -0.05033174 416s s4 0.14355471 0.02274686 0.060716383 0.36482609 -0.5337625504 0.05060275 416s s5 -0.07886939 0.09016445 0.009935806 -1.10145876 -0.0214130263 -0.27756317 416s > 416s > # Validation 416s > Z0 <- rbind(s1 = colMeans(X[1:4, ]), s2 = colMeans(X[5:8, ]), 416s + s3 = colMeans(X[9:12, ]), s4 = colMeans(X[13:16, ]), 416s + s5 = colMeans(X[17:20, ])) 416s > stopifnot(identical(drop(Z), Z0)) 416s > 416s > 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > # When there is only one "complete" set 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > nbr_of_sets <- 1L 416s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 416s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 416s > print(S) 416s s1 416s [1,] 1 416s [2,] 2 416s [3,] 3 416s [4,] 4 416s [5,] 5 416s [6,] 6 416s > 416s > Z <- rowAvgsPerColSet(X, S = S, FUN = rowMeans) 416s > print(Z) 416s s1 416s A -0.54073814 416s B 0.23582442 416s C -0.07581962 416s D -0.34385347 416s E 0.22944045 416s F 0.09849735 416s G 0.01208384 416s H -0.06010873 416s I 0.09839969 416s J 0.24080159 416s K -0.04447754 416s L 0.41722427 416s M 0.16459166 416s N 0.32722562 416s O -0.29682110 416s P -0.12254002 416s Q -0.22042189 416s R -0.36716782 416s S 0.43236849 416s T -0.76424818 416s > 416s > Z0 <- rowMeans(X) 416s > stopifnot(identical(drop(Z), Z0)) 416s > 416s > 416s > nbr_of_sets <- 1L 416s > S <- matrix(1:nrow(X), ncol = nbr_of_sets) 416s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 416s > print(S) 416s s1 416s [1,] 1 416s [2,] 2 416s [3,] 3 416s [4,] 4 416s [5,] 5 416s [6,] 6 416s [7,] 7 416s [8,] 8 416s [9,] 9 416s [10,] 10 416s [11,] 11 416s [12,] 12 416s [13,] 13 416s [14,] 14 416s [15,] 15 416s [16,] 16 416s [17,] 17 416s [18,] 18 416s [19,] 19 416s [20,] 20 416s > 416s > Z <- colAvgsPerRowSet(X, S = S, FUN = colMeans) 416s > print(Z) 416s a b c d e f 416s s1 -0.111658 0.05195967 0.06777096 -0.03979776 -0.1231089 -0.01908771 416s > 416s > Z0 <- colMeans(X) 416s > stopifnot(identical(drop(Z), Z0)) 416s > 416s > 416s > 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > # Use weights 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > nbr_of_sets <- 3L 416s > S <- matrix(1:ncol(X), ncol = nbr_of_sets) 416s > colnames(S) <- sprintf("s%d", 1:nbr_of_sets) 416s > print(S) 416s s1 s2 s3 416s [1,] 1 3 5 416s [2,] 2 4 6 416s > 416s > W <- matrix(runif(length(X)), nrow = nrow(X), ncol = ncol(X)) 416s > Z1 <- rowAvgsPerColSet(X, W = W, S = S, FUN = rowWeightedMeans) 416s > print(Z1) 416s s1 s2 s3 416s A -0.95707432 -0.026088413 -0.63905168 416s B 0.34919511 -0.045990795 0.40426894 416s C -0.49490069 0.522637381 -0.25519554 416s D -0.33524780 -0.005398681 -0.69091393 416s E 0.10270884 0.017641480 0.56797103 416s F 0.42415671 -0.841196027 0.71253138 416s G -0.84543219 1.478314743 -0.59663102 416s H -0.91731018 0.413171154 0.32381285 416s I 0.89895362 -0.330171898 -0.27358264 416s J 0.59366295 0.353519265 -0.22477744 416s K 0.53879593 -0.880525038 0.20829649 416s L -0.30968459 0.955779718 0.60557770 416s M 0.03257146 -0.031933412 0.49313694 416s N 0.91008788 0.663201535 -0.59161256 416s O -0.31418035 -0.256124882 -0.32015807 416s P -0.29587586 0.475941703 -0.54768590 416s Q -0.34975436 0.028437204 -0.33994852 416s R -0.78426343 -0.611063298 0.29382326 416s S 1.11489021 0.118750422 0.06346484 416s T 0.04171769 -1.719170245 -0.61529199 416s > Z2 <- colAvgsPerRowSet(X, W = W, S = S, FUN = colWeightedMeans) 416s > print(Z2) 416s a b c d e f 416s s1 -1.30007147 0.6921923 0.49116896 -0.563248172 -0.2709505 0.0361678 416s s2 0.18283924 -1.0129877 0.07546921 0.441769486 -0.2662945 -0.6798149 416s s3 -0.00878314 0.5356487 -0.82713102 0.003576475 0.3868324 0.8936700 416s > 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > # Result should always be a matrix, including when nrow(X) <= 1 416s > # (https://github.com/HenrikBengtsson/matrixStats/issues/108) 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > X <- matrix(1:3, nrow = 1L, ncol = 3L) 416s > S <- matrix(1, nrow = 1L, ncol = 1L) 416s > Z1 <- rowAvgsPerColSet(X, S = S) 416s > stopifnot(is.matrix(Z1)) 416s > Z2 <- rowAvgsPerColSet(X, S = S, rows = 0) 416s > stopifnot(is.matrix(Z2)) 416s > 416s > 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > # Works with many, one or zero columns / rows 416s > # (https://github.com/HenrikBengtsson/matrixStats/issues/172) 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > S <- cbind(1:2, 3:4, 5:6) 416s > X <- matrix(rnorm(2 * 6), nrow = 6, ncol = 2) 416s > Z2 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 416s > Z2_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 416s + colSums2(X[S[,2], ,drop=FALSE]), 416s + colSums2(X[S[,3], ,drop=FALSE])) 416s > stopifnot(identical(Z2, Z2_ref)) 416s > X <- matrix(rnorm(6), nrow = 6, ncol = 1) 416s > Z1 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 416s > Z1_ref <- rbind(colSums2(X[S[,1], ,drop=FALSE]), 416s + colSums2(X[S[,2], ,drop=FALSE]), 416s + colSums2(X[S[,3], ,drop=FALSE])) 416s > stopifnot(identical(Z1, Z1_ref)) 416s > X <- matrix(numeric(0), nrow = 6, ncol = 0) 416s > Z0 <- colAvgsPerRowSet(X, S = S, FUN = colSums2) 416s > Z0_ref <- matrix(numeric(0), nrow = ncol(S), ncol = 0) 416s > stopifnot(identical(Z0, unname(Z0_ref))) 416s > 416s > 416s > S <- rbind(1:4, 5:8) 416s > X <- matrix(rnorm(n = 2 * 8), nrow = 2, ncol = 8) 416s > Z2 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 416s > Z2_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 416s + rowMeans2(X[,S[,2],drop=FALSE]), 416s + rowMeans2(X[,S[,3],drop=FALSE]), 416s + rowMeans2(X[,S[,4],drop=FALSE])) 416s > stopifnot(identical(Z2, Z2_ref)) 416s > X <- matrix(rnorm(n = 8), nrow = 1, ncol = 8) 416s > Z1 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 416s > Z1_ref <- cbind(rowMeans2(X[,S[,1],drop=FALSE]), 416s + rowMeans2(X[,S[,2],drop=FALSE]), 416s + rowMeans2(X[,S[,3],drop=FALSE]), 416s + rowMeans2(X[,S[,4],drop=FALSE])) 416s > stopifnot(identical(Z1, Z1_ref)) 416s > X <- matrix(numeric(0), nrow = 0, ncol = 8) 416s > Z0 <- rowAvgsPerColSet(X, S = S, FUN = rowMeans2) 416s > Z0_ref <- matrix(numeric(0), nrow = 0, ncol = ncol(S)) 416s > stopifnot(identical(Z0, Z0_ref)) 416s > 416s 416s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 416s Copyright (C) 2025 The R Foundation for Statistical Computing 416s Platform: arm-unknown-linux-gnueabihf (32-bit) 416s 416s R is free software and comes with ABSOLUTELY NO WARRANTY. 416s You are welcome to redistribute it under certain conditions. 416s Type 'license()' or 'licence()' for distribution details. 416s 416s R is a collaborative project with many contributors. 416s Type 'contributors()' for more information and 416s 'citation()' on how to cite R or R packages in publications. 416s 416s Type 'demo()' for some demos, 'help()' for on-line help, or 416s 'help.start()' for an HTML browser interface to help. 416s Type 'q()' to quit R. 416s 416s > library("matrixStats") 416s > 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > # Subsetted tests 416s > # - - - - - - - - - - - - - - - - - - - - - - - - - - 416s > source("utils/validateIndicesFramework.R") 416s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 416s > #W <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 416s > for (rows in index_cases) { 416s + for (cols in index_cases) { 416s + if (is.null(rows)) { 416s + rows <- seq_len(nrow(x)) 416s + rows_finite <- rows 416s + } else { 416s + rows_finite <- rows[is.finite(rows)] 416s + } 416s + 416s + if (is.null(cols)) { 416s + cols <- seq_len(ncol(x)) 416s + cols_finite <- cols 416s + } else { 416s + cols_finite <- cols[is.finite(cols)] 416s + } 416s + 416s + suppressWarnings({ 416s + actual <- tryCatch({ 416s + rowAvgsPerColSet(x, rows = rows, S = matrix(cols, ncol = 1), 416s + FUN = rowMeans) 416s + }, error = function(c) "error") 416s + expect <- tryCatch({ 416s + rowMeans(x[rows, cols_finite, drop = FALSE], na.rm = TRUE) 416s + }, error = function(c) "error") 416s + }) 416s + stopifnot(all.equal(as.vector(actual), expect)) 416s + 416s + suppressWarnings({ 416s + actual <- tryCatch({ 416s + colAvgsPerRowSet(x, cols = cols, S = matrix(rows, ncol = 1), 416s + FUN = colMeans) 416s + }, error = function(c) "error") 416s + expect <- tryCatch({ 416s + colMeans(x[rows_finite, cols, drop = FALSE], na.rm = TRUE) 416s + }, error = function(c) "error") 416s + }) 416s + stopifnot(all.equal(as.vector(actual), expect)) 416s + } 416s + } 416s > 416s 416s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 416s Copyright (C) 2025 The R Foundation for Statistical Computing 416s Platform: arm-unknown-linux-gnueabihf (32-bit) 416s 416s R is free software and comes with ABSOLUTELY NO WARRANTY. 416s You are welcome to redistribute it under certain conditions. 416s Type 'license()' or 'licence()' for distribution details. 416s 416s R is a collaborative project with many contributors. 416s Type 'contributors()' for more information and 416s 'citation()' on how to cite R or R packages in publications. 416s 416s Type 'demo()' for some demos, 'help()' for on-line help, or 416s 'help.start()' for an HTML browser interface to help. 416s Type 'q()' to quit R. 416s 416s > library("matrixStats") 416s > 416s > x <- matrix(1:27, ncol = 3) 416s > 416s > # To check names attribute 416s > dimnames <- list(letters[1:9], LETTERS[1:3]) 416s > 416s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 416s + res <- x[, idxs] 416s + # Preserve names attribute? 416s + if (!useNames) names(res) <- NULL 416s + res 416s + } 416s > 416s > idxs <- 1L 416s > # Test with and without dimnames on x 416s > for (setDimnames in c(TRUE, FALSE)) { 416s + if (setDimnames) dimnames(x) <- dimnames 416s + else dimnames(x) <- NULL 416s + # Check names attribute 416s + for (useNames in c(TRUE, FALSE)) { 416s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 416s + y <- rowCollapse(x, idxs, useNames = useNames) 416s + stopifnot(identical(y, y_truth)) 416s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 416s + stopifnot(identical(y2, y)) 416s + } 416s + } 416s > 416s > idxs <- 2L 416s > # Test with and without dimnames on x 416s > for (setDimnames in c(TRUE, FALSE)) { 416s + if (setDimnames) dimnames(x) <- dimnames 416s + else dimnames(x) <- NULL 416s + # Check names attribute 416s + for (useNames in c(TRUE, FALSE)) { 416s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 416s + y <- rowCollapse(x, idxs, useNames = useNames) 416s + stopifnot(identical(y, y_truth)) 416s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 416s + stopifnot(identical(y2, y)) 416s + } 416s + } 417s > 417s > 417s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 417s + res <- c(x[1:5, 1], x[6:9, 3]) 417s + # Preserve names attribute? 417s + if (!useNames) names(res) <- NULL 417s + res 417s + } 417s > 417s > idxs <- c(1, 1, 1, 1, 1, 3, 3, 3, 3) 417s > # Test with and without dimnames on x 417s > for (setDimnames in c(TRUE, FALSE)) { 417s + if (setDimnames) dimnames(x) <- dimnames 417s + else dimnames(x) <- NULL 417s + # Check names attribute 417s + for (useNames in c(TRUE, FALSE)) { 417s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 417s + y <- rowCollapse(x, idxs, useNames = useNames) 417s + stopifnot(identical(y, y_truth)) 417s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 417s + stopifnot(identical(y2, y)) 417s + } 417s + } 417s > 417s > 417s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 417s + res <- c(x[1, 1], x[2, 2], x[3, 3], x[4, 1], x[5, 2], 417s + x[6, 3], x[7, 1], x[8, 2], x[9, 3]) 417s + # Preserve names attribute? 417s + if (useNames) { 417s + names <- rownames(x) 417s + if (!is.null(names)) names(res) <- names 417s + } 417s + res 417s + } 417s > 417s > idxs <- 1:3 417s > # Test with and without dimnames on x 417s > for (setDimnames in c(TRUE, FALSE)) { 417s + if (setDimnames) dimnames(x) <- dimnames 417s + else dimnames(x) <- NULL 417s + # Check names attribute 417s + for (useNames in c(TRUE, FALSE)) { 417s + y_truth <- rowCollapse_R(x, idxs, useNames = useNames) 417s + y <- rowCollapse(x, idxs, useNames = useNames) 417s + stopifnot(identical(y, y_truth)) 417s + y2 <- colCollapse(t(x), idxs, useNames = useNames) 417s + stopifnot(identical(y2, y)) 417s + } 417s + } 417s > 417s 417s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 417s Copyright (C) 2025 The R Foundation for Statistical Computing 417s Platform: arm-unknown-linux-gnueabihf (32-bit) 417s 417s R is free software and comes with ABSOLUTELY NO WARRANTY. 417s You are welcome to redistribute it under certain conditions. 417s Type 'license()' or 'licence()' for distribution details. 417s 417s R is a collaborative project with many contributors. 417s Type 'contributors()' for more information and 417s 'citation()' on how to cite R or R packages in publications. 417s 417s Type 'demo()' for some demos, 'help()' for on-line help, or 417s 'help.start()' for an HTML browser interface to help. 417s Type 'q()' to quit R. 417s 417s > library("matrixStats") 417s > 417s > rowCollapse_R <- function(x, idxs, ..., useNames = TRUE) { 417s + ans <- c() 417s + storage.mode(ans) <- storage.mode(x) 417s + for (ii in seq_len(length(idxs))) { 417s + ans[ii] <- x[ii, idxs[ii]] 417s + } 417s + 417s + # Preserve names attribute 417s + if (useNames) { 417s + names <- rownames(x) 417s + if (!is.null(names)) names(ans) <- names 417s + } 417s + 417s + ans 417s + } 417s > 417s > 417s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 417s > # Subsetted tests 417s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 417s > source("utils/validateIndicesFramework.R") 417s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 417s > storage.mode(x) <- "integer" 417s > 417s > # To check names attribute 417s > dimnames <- list(letters[1:6], LETTERS[1:6]) 417s > 417s > for (rows in index_cases) { 417s + if (is.null(rows)) rows <- seq_len(nrow(x)) 417s + 417s + for (idxs in list(2L, seq_len(6L))) { 417s + for (useNames in c(TRUE, FALSE)) { 417s + suppressWarnings({ 417s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 417s + error = function(c) "error") 417s + expect <- tryCatch({ 417s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 417s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 417s + }, error = function(c) "error") 417s + }) 417s + stopifnot(all.equal(actual, expect)) 417s + 417s + suppressWarnings({ 417s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 417s + error = function(c) "error") 417s + }) 417s + stopifnot(all.equal(actual, expect)) 417s + 417s + # Check names attribute 417s + dimnames(x) <- dimnames 417s + suppressWarnings({ 417s + actual <- tryCatch(rowCollapse(x, idxs, rows = rows, useNames = useNames), 417s + error = function(c) "error") 417s + expect <- tryCatch({ 417s + idxs_0 <- rep(idxs, length.out = nrow(x))[rows] 417s + rowCollapse_R(x[rows, , drop = FALSE], idxs_0, useNames = useNames) 417s + }, error = function(c) "error") 417s + }) 417s + stopifnot(all.equal(actual, expect)) 417s + 417s + suppressWarnings({ 417s + actual <- tryCatch(colCollapse(t(x), idxs, cols = rows, useNames = useNames), 417s + error = function(c) "error") 417s + }) 417s + stopifnot(all.equal(actual, expect)) 417s + 417s + dimnames(x) <- NULL 417s + } 417s + } 417s + } 417s > 417s 417s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 417s Copyright (C) 2025 The R Foundation for Statistical Computing 417s Platform: arm-unknown-linux-gnueabihf (32-bit) 417s 417s R is free software and comes with ABSOLUTELY NO WARRANTY. 417s You are welcome to redistribute it under certain conditions. 417s Type 'license()' or 'licence()' for distribution details. 417s 417s R is a collaborative project with many contributors. 417s Type 'contributors()' for more information and 417s 'citation()' on how to cite R or R packages in publications. 417s 417s Type 'demo()' for some demos, 'help()' for on-line help, or 417s 'help.start()' for an HTML browser interface to help. 417s Type 'q()' to quit R. 417s 417s > library("matrixStats") 417s > 417s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ...) { 417s + if (is.na(value)) { 417s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 417s + sum(is.na(x)) 417s + ) 417s + } else { 417s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 417s + sum(x == value, na.rm = na.rm) 417s + ) 417s + } 417s + # Preserve names attribute 417s + names <- names(counts) 417s + counts <- as.integer(counts) 417s + if (useNames && !is.null(names)) names(counts) <- names 417s + counts 417s + } 417s > 417s > 417s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 417s > # Data type: integer and numeric 417s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 417s > for (mode in c("integer", "double")) { 417s + x <- matrix(runif(10 * 5, min = -3, max = 3), nrow = 10L, ncol = 5L) 417s + x[sample.int(length(x), size = 7L)] <- 0 417s + storage.mode(x) <- mode 417s + 417s + dimnames = list(letters[1:10], LETTERS[1:5]) 417s + 417s + # Test with and without dimnames on x 417s + for (setDimnames in c(TRUE, FALSE)) { 417s + if (setDimnames) dimnames(x) <- dimnames 417s + else dimnames(x) <- NULL 417s + for (na.rm in c(FALSE, TRUE)) { 417s + # Check names attribute 417s + for (useNames in c(TRUE, FALSE)) { 417s + # Count zeros 417s + r0 <- rowCounts_R(x, value = 0, na.rm = na.rm, useNames = useNames) 417s + r1 <- rowCounts(x, value = 0, na.rm = na.rm, useNames = useNames) 417s + r2 <- colCounts(t(x), value = 0, na.rm = na.rm, useNames = useNames) 417s + stopifnot(identical(r1, r0)) 417s + stopifnot(identical(r2, r0)) 417s + 417s + # Count NAs 417s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 417s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 417s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 417s + stopifnot(identical(r1, r0)) 417s + stopifnot(identical(r2, r0)) 417s + 417s + if (mode == "integer") { 417s + ux <- unique(as.vector(x)) 417s + r0 <- r1 <- r2 <- integer(nrow(x)) 417s + for (value in ux) { 417s + r0 <- r0 + rowCounts_R(x, value = value, na.rm = na.rm, useNames = useNames) 417s + r1 <- r1 + rowCounts(x, value = value, na.rm = na.rm, useNames = useNames) 417s + r2 <- r2 + colCounts(t(x), value = value, na.rm = na.rm, useNames = useNames) 417s + stopifnot(identical(r1, r0)) 417s + stopifnot(identical(r2, r0)) 417s + } 417s + stopifnot(all(r0 == ncol(x))) 417s + } # if (mode == "integer") 417s + } # for (useNames ...) 417s + } # for (na.rm ...) 417s + } # for (setDimnames ...) 417s + } # for (mode ...) 417s > 417s > 417s > # All NAs 417s > na_list <- list(NA_integer_, NA_real_, NaN) 417s > for (na_value in na_list) { 417s + x <- matrix(na_value, nrow = 10L, ncol = 5L) 417s + # Test with and without dimnames on x 417s + for (setDimnames in c(TRUE, FALSE)) { 417s + if (setDimnames) dimnames(x) <- dimnames 417s + else dimnames(x) <- NULL 417s + for (na.rm in c(FALSE, TRUE)) { 417s + # Check names attribute 417s + for (useNames in c(TRUE, FALSE)) { 417s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 417s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 417s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 417s + stopifnot(identical(r1, r0)) 417s + stopifnot(identical(r2, r0)) 417s + 417s + # Count NAs 417s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 417s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 417s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 417s + stopifnot(all(r0 == ncol(x))) 417s + stopifnot(identical(r1, r0)) 417s + stopifnot(identical(r2, r0)) 417s + } 417s + } 417s + } 417s + } # for (na_value ...) 417s > 417s > 417s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 417s > # Data type: logical 417s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 417s > x <- matrix(FALSE, nrow = 10L, ncol = 4L) 417s > x[7:8, 2:3] <- TRUE 417s > x[1:3, ] <- TRUE 417s > x[, 1] <- TRUE 417s > x[4, ] <- FALSE 417s > x[, 4] <- FALSE 417s > x[2, ] <- FALSE 417s > x[3, ] <- TRUE 417s > 417s > # To check names attribute 417s > dimnames <- list(letters[1:10], LETTERS[1:4]) 417s > 417s > # Test with and without dimnames on x 417s > for (setDimnames in c(TRUE, FALSE)) { 417s + if (setDimnames) dimnames(x) <- dimnames 417s + else dimnames(x) <- NULL 417s + # Row/column counts 417s + for (na.rm in c(FALSE, TRUE)) { 417s + # Check names attribute 417s + for (useNames in c(TRUE, FALSE)) { 417s + r0 <- rowCounts_R(x, na.rm = na.rm, useNames = useNames) 417s + r1 <- rowCounts(x, na.rm = na.rm, useNames = useNames) 417s + r2 <- colCounts(t(x), na.rm = na.rm, useNames = useNames) 417s + stopifnot(identical(r1, r0)) 417s + stopifnot(identical(r2, r0)) 417s + 417s + r_true <- rowCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 417s + r_false <- rowCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 417s + stopifnot(r_true + r_false == ncol(x)) 417s + 417s + c_true <- colCounts(x, value = TRUE, na.rm = na.rm, useNames = useNames) 417s + c_false <- colCounts(x, value = FALSE, na.rm = na.rm, useNames = useNames) 417s + stopifnot(c_true + c_false == nrow(x)) 417s + 417s + # Count NAs 417s + r0 <- rowCounts_R(x, value = NA, na.rm = na.rm, useNames = useNames) 417s + r1 <- rowCounts(x, value = NA, na.rm = na.rm, useNames = useNames) 417s + r2 <- colCounts(t(x), value = NA, na.rm = na.rm, useNames = useNames) 417s + stopifnot(identical(r1, r0)) 417s + stopifnot(identical(r2, r0)) 417s + } 417s + } 417s + } 417s > 417s > 417s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 417s > # Data type: character (not sure if this should be supported) 417s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 417s > x <- matrix(rep(letters, length.out = 10 * 5), nrow = 10L, ncol = 5L) 417s > x[2:3, 3:4] <- NA_character_ 417s > 417s > # Row/column counts 417s > for (na.rm in c(FALSE, TRUE)) { 417s + for (value in c("g", NA_character_)) { 417s + r0 <- rowCounts_R(x, value = value, na.rm = na.rm) 417s + r1 <- rowCounts(x, value = value, na.rm = na.rm) 417s + r2 <- colCounts(t(x), value = value, na.rm = na.rm) 417s + stopifnot(identical(r1, r0)) 417s + stopifnot(identical(r2, r0)) 417s + 417s + c <- count(x[1, ], value = value, na.rm = na.rm) 417s + stopifnot(identical(c, r1[1])) 417s + 417s + c <- count(x[2, ], value = value, na.rm = na.rm) 417s + stopifnot(identical(c, r1[2])) 417s + } 417s + } 417s > 417s > # NA row 417s > x <- matrix(0, nrow = 2L, ncol = 2L) 417s > x[1, ] <- NA_integer_ 417s > 417s > dimnames <- list(letters[1:2], LETTERS[1:2]) 417s > 417s > # Test with and without dimnames on x 417s > for (setDimnames in c(TRUE, FALSE)) { 417s + if (setDimnames) dimnames(x) <- dimnames 417s + else dimnames(x) <- NULL 417s + # Check names attribute 417s + for (useNames in c(TRUE, FALSE)) { 417s + r0 <- rowCounts(x, value = 0, useNames = useNames) 417s + r1 <- rowCounts_R(x, value = 0, useNames = useNames) 417s + stopifnot(identical(r0, r1)) 417s + } 417s + } 417s > 417s 417s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 417s Copyright (C) 2025 The R Foundation for Statistical Computing 417s Platform: arm-unknown-linux-gnueabihf (32-bit) 417s 417s R is free software and comes with ABSOLUTELY NO WARRANTY. 417s You are welcome to redistribute it under certain conditions. 417s Type 'license()' or 'licence()' for distribution details. 417s 417s R is a collaborative project with many contributors. 417s Type 'contributors()' for more information and 417s 'citation()' on how to cite R or R packages in publications. 417s 417s Type 'demo()' for some demos, 'help()' for on-line help, or 417s 'help.start()' for an HTML browser interface to help. 417s Type 'q()' to quit R. 417s 417s > library("matrixStats") 417s > 417s > rowCounts_R <- function(x, value = TRUE, na.rm = FALSE, ..., useNames = TRUE) { 417s + if (is.na(value)) { 417s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 417s + sum(is.na(x)) 417s + ) 417s + } else { 417s + counts <- apply(x, MARGIN = 1L, FUN = function(x) 417s + sum(x == value, na.rm = na.rm) 417s + ) 417s + } 417s + # Preserve names attribute 417s + names <- names(counts) 417s + counts <- as.integer(counts) 417s + if (useNames && !is.null(names)) names(counts) <- names 417s + counts 417s + } # rowCounts_R() 417s > 417s > 417s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 417s > # Subsetted tests 417s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 417s > source("utils/validateIndicesFramework.R") 417s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 417s > x[2:3, 3:4] <- NA_real_ 417s > storage.mode(x) <- "integer" 417s > 417s > # To check names attribute 417s > dimnames <- list(letters[1:6], LETTERS[1:6]) 417s > 417s > # Test with and without dimnames on x 417s > for (setDimnames in c(TRUE, FALSE)) { 417s + if (setDimnames) dimnames(x) <- dimnames 417s + else dimnames(x) <- NULL 417s + for (rows in index_cases) { 417s + for (cols in index_cases) { 417s + # Check names attribute 417s + for (useNames in c(TRUE, FALSE)) { 417s + validateIndicesTestMatrix(x, rows, cols, 417s + ftest = rowCounts, fsure = rowCounts_R, 417s + value = 0, na.rm = TRUE, useNames = useNames) 417s + validateIndicesTestMatrix(x, rows, cols, 417s + fcoltest = colCounts, fsure = rowCounts_R, 417s + value = 0, na.rm = TRUE, useNames = useNames) 417s + for (value in c(0, NA_integer_)) { 417s + validateIndicesTestMatrix(x, rows, cols, 417s + ftest = rowCounts, fsure = rowCounts_R, 417s + value = value, useNames = useNames) 417s + validateIndicesTestMatrix(x, rows, cols, 417s + fcoltest = colCounts, fsure = rowCounts_R, 417s + value = value, useNames = useNames) 417s + } 417s + } 417s + } 417s + } 417s + } 419s > 419s > x <- matrix(rep(letters, length.out = 6 * 6), nrow = 6, ncol = 6) 419s > x[2:3, 3:4] <- NA_character_ 419s > # Test with and without dimnames on x 419s > for (setDimnames in c(TRUE, FALSE)) { 419s + if (setDimnames) dimnames(x) <- dimnames 419s + else dimnames(x) <- NULL 419s + 419s + count <- 0L 419s + for (rows in index_cases) { 419s + for (cols in index_cases) { 419s + count <- count + 1L 419s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 419s + useNames <- c(TRUE, FALSE) 419s + useNames <- useNames[count %% length(useNames) + 1] 419s + 419s + validateIndicesTestMatrix(x, rows, cols, 419s + ftest = rowCounts, fsure = rowCounts_R, 419s + value = "g", na.rm = TRUE, useNames = useNames) 419s + validateIndicesTestMatrix(x, rows, cols, 419s + fcoltest = colCounts, fsure = rowCounts_R, 419s + value = "g", na.rm = TRUE, useNames = useNames) 419s + for (value in c("g", NA_character_)) { 419s + validateIndicesTestMatrix(x, rows, cols, 419s + ftest = rowCounts, fsure = rowCounts_R, 419s + value = value, useNames = useNames) 419s + validateIndicesTestMatrix(x, rows, cols, 419s + fcoltest = colCounts, fsure = rowCounts_R, 419s + value = value, useNames = useNames) 419s + } 419s + } 419s + } 419s + } 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: arm-unknown-linux-gnueabihf (32-bit) 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 > rowCummins_R <- function(x, ..., useNames = TRUE) { 420s + suppressWarnings({ 420s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 420s + }) 420s + 420s + # Preserve dimnames attribute? 420s + dim(y) <- dim(x) 420s + dimnames(y) <- if (useNames) dimnames(x) else NULL 420s + y 420s + } 420s > 420s > rowCummaxs_R <- function(x, ..., useNames = TRUE) { 420s + mode <- storage.mode(x) 420s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 420s + storage.mode(x) <- "numeric" 420s + suppressWarnings({ 420s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 420s + }) 420s + 420s + # Preserve dimnames attribute? 420s + dim(y) <- dim(x) 420s + dimnames(y) <- if (useNames) dimnames(x) else NULL 420s + 420s + y 420s + } 420s > 420s > 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > # With and without some NAs 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > for (mode in c("logical", "integer", "double")) { 420s + for (add_na in c(FALSE, TRUE)) { 420s + cat("add_na = ", add_na, "\n", sep = "") 420s + 420s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 420s + diag(x) <- 0 420s + if (add_na) { 420s + x[3:7, c(2, 4)] <- NA_real_ 420s + } 420s + cat("mode: ", mode, "\n", sep = "") 420s + storage.mode(x) <- mode 420s + str(x) 420s + 420s + # To check dimnames 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 + # Check names attribute 420s + for (useNames in c(TRUE, FALSE)) { 420s + # Row/column ranges 420s + r0 <- rowCummins_R(x, useNames = useNames) 420s + r1 <- rowCummins(x, useNames = useNames) 420s + r2 <- t(colCummins(t(x), useNames = useNames)) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + 420s + r0 <- rowCummaxs_R(x, useNames = useNames) 420s + r1 <- rowCummaxs(x, useNames = useNames) 420s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + } # for (useNames ...) 420s + } # for (setDimnames ...) 420s + } # for (add_na ...) 420s + } # for (mode ...) 420s add_na = FALSE 420s mode: logical 420s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 420s add_na = TRUE 420s mode: logical 420s logi [1:10, 1:5] FALSE TRUE TRUE TRUE TRUE TRUE ... 420s add_na = FALSE 420s mode: integer 420s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 420s add_na = TRUE 420s mode: integer 420s int [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 420s add_na = FALSE 420s mode: double 420s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 420s add_na = TRUE 420s mode: double 420s num [1:10, 1:5] 0 2 3 4 5 6 7 8 9 10 ... 420s > 420s > 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > # All NAs 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > for (mode in c("logical", "integer", "double")) { 420s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 420s + cat("mode: ", mode, "\n", sep = "") 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 + # Check names attribute 420s + for (useNames in c(TRUE, FALSE)) { 420s + r0 <- rowCummins_R(x, useNames = useNames) 420s + r1 <- rowCummins(x, useNames = useNames) 420s + r2 <- t(colCummins(t(x), useNames = useNames)) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + 420s + r0 <- rowCummaxs_R(x, useNames = useNames) 420s + r1 <- rowCummaxs(x, useNames = useNames) 420s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + } # for (useNames ...) 420s + } # for (setDimnames ...) 420s + } # for (mode ...) 420s mode: logical 420s logi [1:10, 1:5] NA NA NA NA NA NA ... 420s mode: integer 420s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 420s mode: double 420s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 420s > 420s > 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > # A 1x1 matrix 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > for (mode in c("logical", "integer", "double")) { 420s + x <- matrix(0, nrow = 1L, ncol = 1L) 420s + cat("mode: ", mode, "\n", sep = "") 420s + storage.mode(x) <- mode 420s + str(x) 420s + 420s + # To check dimnames attribute 420s + dimnames <- list("a", "A") 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 + # Check names attribute 420s + for (useNames in c(TRUE, FALSE)) { 420s + r0 <- rowCummins_R(x, useNames = useNames) 420s + r1 <- rowCummins(x, useNames = useNames) 420s + r2 <- t(colCummins(t(x), useNames = useNames)) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + 420s + r0 <- rowCummaxs_R(x, useNames = useNames) 420s + r1 <- rowCummaxs(x, useNames = useNames) 420s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + } # for (useNames ...) 420s + } # for (setDimnames ...) 420s + } # for (mode ...) 420s mode: logical 420s logi [1, 1] FALSE 420s mode: integer 420s int [1, 1] 0 420s mode: double 420s num [1, 1] 0 420s > 420s > 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > # Corner cases 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > for (mode in c("logical", "integer", "double")) { 420s + cat("mode: ", mode, "\n", sep = "") 420s + value <- 0 420s + storage.mode(value) <- mode 420s + value0 <- if (mode == "logical") 0L else value 420s + 420s + # A 0x0 matrix 420s + x <- matrix(value, nrow = 0L, ncol = 0L) 420s + str(x) 420s + r0 <- matrix(value0, nrow = nrow(x), ncol = ncol(x)) 420s + r1 <- rowCummins(x) 420s + r2 <- t(colCummins(t(x))) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + 420s + # A 0xK matrix 420s + x <- matrix(value, nrow = 0L, ncol = 5L) 420s + str(x) 420s + colnames <- LETTERS[1:5] 420s + # Test with and without dimnames on x 420s + for (setDimnames in c(TRUE, FALSE)) { 420s + if (setDimnames) colnames(x) <- colnames 420s + else dimnames(x) <- NULL 420s + # Check names attribute 420s + for (useNames in c(TRUE, FALSE)) { 420s + r0 <- rowCummins_R(x, useNames = useNames) 420s + r1 <- rowCummins(x, useNames = useNames) 420s + r2 <- t(colCummins(t(x), useNames = useNames)) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + r0 <- rowCummaxs_R(x, useNames = useNames) 420s + r1 <- rowCummaxs(x, useNames = useNames) 420s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + } # for (useNames ...) 420s + } # for (setDimnames ...) 420s + 420s + # A Nx0 matrix 420s + x <- matrix(value, nrow = 5L, ncol = 0L) 420s + str(x) 420s + rownames <- LETTERS[1:5] 420s + # Test with and without dimnames on x 420s + for (setDimnames in c(TRUE, FALSE)) { 420s + if (setDimnames) rownames(x) <- rownames 420s + else dimnames(x) <- NULL 420s + # Check names attribute 420s + for (useNames in c(TRUE, FALSE)) { 420s + r0 <- rowCummins_R(x, useNames = useNames) 420s + r1 <- rowCummins(x, useNames = useNames) 420s + r2 <- t(colCummins(t(x), useNames = useNames)) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + 420s + r0 <- rowCummaxs_R(x, useNames = useNames) 420s + r1 <- rowCummaxs(x, useNames = useNames) 420s + r2 <- t(colCummaxs(t(x), useNames = useNames)) 420s + stopifnot(all.equal(r1, r2)) 420s + stopifnot(all.equal(r1, r0)) 420s + stopifnot(all.equal(r2, r0)) 420s + } # for (useNames ...) 420s + } # for (setDimnames ...) 420s + } # for (mode ...) 420s mode: logical 420s logi[0 , 0 ] 420s logi[0 , 1:5] 420s logi[1:5, 0 ] 420s mode: integer 420s int[0 , 0 ] 420s int[0 , 1:5] 420s int[1:5, 0 ] 420s mode: double 420s num[0 , 0 ] 420s num[0 , 1:5] 420s num[1:5, 0 ] 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: arm-unknown-linux-gnueabihf (32-bit) 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 > rowCummins_R <- function(x, ..., useNames = TRUE) { 420s + suppressWarnings({ 420s + y <- t(apply(x, MARGIN = 1L, FUN = cummin)) 420s + }) 420s + 420s + # Preserve dimnames attribute? 420s + dim(y) <- dim(x) 420s + dimnames(y) <- if (useNames) dimnames(x) else NULL 420s + 420s + y 420s + } 420s > 420s > rowCummaxs_R <- function(x, ..., useNames = TRUE) { 420s + mode <- storage.mode(x) 420s + # Change mode because a bug is detected on cummax for integer in R-3.2.0 420s + storage.mode(x) <- "numeric" 420s + suppressWarnings({ 420s + y <- t(apply(x, MARGIN = 1L, FUN = cummax)) 420s + }) 420s + 420s + # Preserve dimnames attribute? 420s + dim(y) <- dim(x) 420s + dimnames(y) <- if (useNames) dimnames(x) else NULL 420s + 420s + storage.mode(y) <- mode 420s + y 420s + } 420s > 420s > 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > # Subsetted tests 420s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 420s > source("utils/validateIndicesFramework.R") 420s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 420s > storage.mode(x) <- "integer" 420s > 420s > # To check dimnames attribute 420s > dimnames <- list(letters[1:6], LETTERS[1:6]) 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 (rows in index_cases) { 420s + for (cols in index_cases) { 420s + # Check names attribute 420s + for (useNames in c(TRUE, FALSE)) { 420s + validateIndicesTestMatrix(x, rows, cols, 420s + ftest = rowCummins, fsure = rowCummins_R, useNames = useNames,verbose=TRUE) 420s + validateIndicesTestMatrix(x, rows, cols, 420s + ftest = function(x, rows, cols, ..., useNames) { 420s + t(colCummins(t(x), rows = cols, cols = rows, useNames = useNames)) 420s + }, fsure = rowCummins_R, useNames = useNames) 420s + 420s + validateIndicesTestMatrix(x, rows, cols, 420s + ftest = rowCummaxs, fsure = rowCummaxs_R, useNames = useNames) 420s + validateIndicesTestMatrix(x, rows, cols, 420s + ftest = function(x, rows, cols, ..., useNames) { 420s + t(colCummaxs(t(x), rows = cols, cols = rows, useNames = useNames)) 420s + }, fsure = rowCummaxs_R, useNames = useNames) 420s + } 420s + } 420s + } 420s + } 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: arm-unknown-linux-gnueabihf (32-bit) 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 > rowCumprods_R <- function(x, ..., useNames = TRUE) { 422s + suppressWarnings({ 422s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 422s + }) 422s + 422s + # Preserve dimnames attribute? 422s + dim(y) <- dim(x) 422s + dimnames(y) <- if (useNames) dimnames(x) else NULL 422s + 422s + y 422s + } 422s > 422s > 422s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422s > # With and without some NAs 422s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422s > for (mode in c("logical", "integer", "double")) { 422s + for (add_na in c(FALSE, TRUE)) { 422s + cat("add_na = ", add_na, "\n", sep = "") 422s + 422s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 422s + if (add_na) { 422s + x[3:7, c(2, 4)] <- NA_real_ 422s + } 422s + cat("mode: ", mode, "\n", sep = "") 422s + storage.mode(x) <- mode 422s + str(x) 422s + 422s + # To check dimnames attribute 422s + dimnames <- list(letters[1:10], LETTERS[1:5]) 422s + 422s + # Test with and without dimnames on x 422s + for (setDimnames in c(TRUE, FALSE)) { 422s + if (setDimnames) dimnames(x) <- dimnames 422s + else dimnames(x) <- NULL 422s + # Check names attribute 422s + for (useNames in c(TRUE, FALSE)) { 422s + # Row/column ranges 422s + r0 <- rowCumprods_R(x, useNames = useNames) 422s + r1 <- rowCumprods(x, useNames = useNames) 422s + r2 <- t(colCumprods(t(x), useNames = useNames)) 422s + stopifnot(all.equal(r1, r2)) 422s + stopifnot(all.equal(r1, r0)) 422s + stopifnot(all.equal(r2, r0)) 422s + } # for (useNames ...) 422s + } # for (setDimnames ...) 422s + } # for (add_na ...) 422s + } # for (mode ...) 422s add_na = FALSE 422s mode: logical 422s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 422s add_na = TRUE 422s mode: logical 422s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 422s add_na = FALSE 422s mode: integer 422s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 422s add_na = TRUE 422s mode: integer 422s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 422s add_na = FALSE 422s mode: double 422s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 422s add_na = TRUE 422s mode: double 422s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 422s > 422s > 422s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422s > # All NAs 422s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422s > for (mode in c("logical", "integer", "double")) { 422s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 422s + cat("mode: ", mode, "\n", sep = "") 422s + storage.mode(x) <- mode 422s + str(x) 422s + 422s + # Test with and without dimnames on x 422s + for (setDimnames in c(TRUE, FALSE)) { 422s + if (setDimnames) dimnames(x) <- dimnames 422s + else dimnames(x) <- NULL 422s + # Check names attribute 422s + for (useNames in c(TRUE, FALSE)) { 422s + # Row/column ranges 422s + r0 <- rowCumprods_R(x, useNames = useNames) 422s + r1 <- rowCumprods(x, useNames = useNames) 422s + r2 <- t(colCumprods(t(x), useNames = useNames)) 422s + stopifnot(all.equal(r1, r2)) 422s + stopifnot(all.equal(r1, r0)) 422s + stopifnot(all.equal(r2, r0)) 422s + } # for (useNames ...) 422s + } # for (setDimnames ...) 422s + } # for (mode ...) 422s mode: logical 422s logi [1:10, 1:5] NA NA NA NA NA NA ... 422s mode: integer 422s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 422s mode: double 422s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 422s > 422s > 422s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422s > # A 1x1 matrix 422s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422s > for (mode in c("logical", "integer", "double")) { 422s + x <- matrix(0, nrow = 1L, ncol = 1L) 422s + cat("mode: ", mode, "\n", sep = "") 422s + storage.mode(x) <- mode 422s + str(x) 422s + 422s + dimnames <- list("a", "A") 422s + # Test with and without dimnames on x 422s + for (setDimnames in c(TRUE, FALSE)) { 422s + if (setDimnames) dimnames(x) <- dimnames 422s + else dimnames(x) <- NULL 422s + # Check names attribute 422s + for (useNames in c(TRUE, FALSE)) { 422s + # Row/column ranges 422s + r0 <- rowCumprods_R(x, useNames = useNames) 422s + r1 <- rowCumprods(x, useNames = useNames) 422s + r2 <- t(colCumprods(t(x), useNames = useNames)) 422s + stopifnot(all.equal(r1, r2)) 422s + stopifnot(all.equal(r1, r0)) 422s + stopifnot(all.equal(r2, r0)) 422s + } # for (useNames ...) 422s + } # for (setDimnames ...) 422s + } 422s mode: logical 422s logi [1, 1] FALSE 422s mode: integer 422s int [1, 1] 0 422s mode: double 422s num [1, 1] 0 422s > 422s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422s > # BUG FIX TEST: Assert zeros don't trump NAs in integer matrices 422s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422s > for (mode in c("logical", "integer", "double")) { 422s + x <- matrix(NA_real_, nrow = 3L, ncol = 2L) 422s + x[1, 2] <- 0 422s + x[2, 2] <- 1 422s + x[3, 1] <- 0 422s + storage.mode(x) <- mode 422s + cat("mode: ", mode, "\n", sep = "") 422s + str(x) 422s + 422s + dimnames <- list(letters[1:3], LETTERS[1:2]) 422s + # Test with and without dimnames on x 422s + for (setDimnames in c(TRUE, FALSE)) { 422s + if (setDimnames) dimnames(x) <- dimnames 422s + else dimnames(x) <- NULL 422s + # Check names attribute 422s + for (useNames in c(TRUE, FALSE)) { 422s + # Row/column ranges 422s + r0 <- rowCumprods_R(x, useNames = useNames) 422s + r1 <- rowCumprods(x, useNames = useNames) 422s + r2 <- t(colCumprods(t(x), useNames = useNames)) 422s + stopifnot(all.equal(r1, r2)) 422s + stopifnot(all.equal(r1, r0)) 422s + stopifnot(all.equal(r2, r0)) 422s + } # for (useNames ...) 422s + } # for (setDimnames ...) 422s + } 422s mode: logical 422s logi [1:3, 1:2] NA NA FALSE FALSE TRUE NA 422s mode: integer 422s int [1:3, 1:2] NA NA 0 0 1 NA 422s mode: double 422s num [1:3, 1:2] NA NA 0 0 1 NA 422s > 422s > 422s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422s > # Corner cases 422s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 422s > for (mode in c("logical", "integer", "double")) { 422s + cat("mode: ", mode, "\n", sep = "") 422s + value <- 0 422s + storage.mode(value) <- mode 422s + if (mode == "logical") value2 <- 0L 422s + 422s + # A 0x0 matrix 422s + x <- matrix(value, nrow = 0L, ncol = 0L) 422s + str(x) 422s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 422s + r1 <- rowCumprods(x) 422s + r2 <- t(colCumprods(t(x))) 422s + stopifnot(all.equal(r1, r2)) 422s + stopifnot(all.equal(r1, r0)) 422s + stopifnot(all.equal(r2, r0)) 422s + 422s + # A 0xK matrix 422s + x <- matrix(value, nrow = 0L, ncol = 5L) 422s + str(x) 422s + colnames <- LETTERS[1:5] 422s + # Test with and without dimnames on x 422s + for (setDimnames in c(TRUE, FALSE)) { 422s + if (setDimnames) colnames(x) <- colnames 422s + else dimnames(x) <- NULL 422s + # Check names attribute 422s + for (useNames in c(TRUE, FALSE)) { 422s + r0 <- rowCumprods_R(x, useNames = useNames) 422s + r1 <- rowCumprods(x, useNames = useNames) 422s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 422s + stopifnot(all.equal(r1, r2)) 422s + stopifnot(all.equal(r1, r0)) 422s + stopifnot(all.equal(r2, r0)) 422s + } # for (useNames ...) 422s + } # for (setDimnames ...) 422s + 422s + # A Nx0 matrix 422s + x <- matrix(value, nrow = 5L, ncol = 0L) 422s + str(x) 422s + rownames <- LETTERS[1:5] 422s + # Test with and without dimnames on x 422s + for (setDimnames in c(TRUE, FALSE)) { 422s + if (setDimnames) rownames(x) <- rownames 422s + else dimnames(x) <- NULL 422s + # Check names attribute 422s + for (useNames in c(TRUE, FALSE)) { 422s + r0 <- rowCumprods_R(x, useNames = useNames) 422s + r1 <- rowCumprods(x, useNames = useNames) 422s + r2 <- t(rowCumprods(t(x), useNames = useNames)) 422s + stopifnot(all.equal(r1, r2)) 422s + stopifnot(all.equal(r1, r0)) 422s + stopifnot(all.equal(r2, r0)) 422s + } # for (useNames ...) 422s + } # for (setDimnames ...) 422s + } # for (mode ...) 422s mode: logical 422s logi[0 , 0 ] 422s logi[0 , 1:5] 422s logi[1:5, 0 ] 422s mode: integer 422s int[0 , 0 ] 422s int[0 , 1:5] 422s int[1:5, 0 ] 422s mode: double 422s num[0 , 0 ] 422s num[0 , 1:5] 422s num[1:5, 0 ] 422s > 423s 423s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 423s Copyright (C) 2025 The R Foundation for Statistical Computing 423s Platform: arm-unknown-linux-gnueabihf (32-bit) 423s 423s R is free software and comes with ABSOLUTELY NO WARRANTY. 423s You are welcome to redistribute it under certain conditions. 423s Type 'license()' or 'licence()' for distribution details. 423s 423s R is a collaborative project with many contributors. 423s Type 'contributors()' for more information and 423s 'citation()' on how to cite R or R packages in publications. 423s 423s Type 'demo()' for some demos, 'help()' for on-line help, or 423s 'help.start()' for an HTML browser interface to help. 423s Type 'q()' to quit R. 423s 423s > library("matrixStats") 423s > 423s > rowCumprods_R <- function(x, ..., useNames = TRUE) { 423s + suppressWarnings({ 423s + y <- t(apply(x, MARGIN = 1L, FUN = cumprod)) 423s + }) 423s + 423s + # Preserve dimnames attribute? 423s + dim(y) <- dim(x) 423s + dimnames(y) <- if (useNames) dimnames(x) else NULL 423s + 423s + y 423s + } 423s > 423s > 423s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 423s > # Subsetted tests 423s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 423s > source("utils/validateIndicesFramework.R") 423s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 423s > storage.mode(x) <- "integer" 423s > 423s > # To check dimnames attribute 423s > dimnames <- list(letters[1:6], LETTERS[1:6]) 423s > 423s > # Test with and without dimnames on x 423s > for (setDimnames in c(TRUE, FALSE)) { 423s + if (setDimnames) dimnames(x) <- dimnames 423s + else dimnames(x) <- NULL 423s + for (rows in index_cases) { 423s + for (cols in index_cases) { 423s + # Check names attribute 423s + for (useNames in c(TRUE, FALSE)) { 423s + validateIndicesTestMatrix(x, rows, cols, 423s + ftest = rowCumprods, fsure = rowCumprods_R, useNames = useNames) 423s + validateIndicesTestMatrix(x, rows, cols, 423s + ftest = function(x, rows, cols, ..., useNames) { 423s + t(colCumprods(t(x), rows = cols, cols = rows, useNames = useNames)) 423s + }, fsure = rowCumprods_R, useNames = useNames) 423s + } 423s + } 423s + } 423s + } 423s > 424s 424s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 424s Copyright (C) 2025 The R Foundation for Statistical Computing 424s Platform: arm-unknown-linux-gnueabihf (32-bit) 424s 424s R is free software and comes with ABSOLUTELY NO WARRANTY. 424s You are welcome to redistribute it under certain conditions. 424s Type 'license()' or 'licence()' for distribution details. 424s 424s R is a collaborative project with many contributors. 424s Type 'contributors()' for more information and 424s 'citation()' on how to cite R or R packages in publications. 424s 424s Type 'demo()' for some demos, 'help()' for on-line help, or 424s 'help.start()' for an HTML browser interface to help. 424s Type 'q()' to quit R. 424s 424s > library("matrixStats") 424s > 424s > rowCumsums_R <- function(x, ..., useNames = TRUE) { 424s + suppressWarnings({ 424s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 424s + }) 424s + 424s + # Preserve dimnames attribute? 424s + dim(y) <- dim(x) 424s + dimnames(y) <- if (useNames) dimnames(x) else NULL 424s + 424s + y 424s + } 424s > 424s > 424s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 424s > # With and without some NAs 424s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 424s > dimnames <- list(letters[1:10], LETTERS[1:5]) # to check dimnames attribute 424s > for (mode in c("logical", "integer", "double")) { 424s + for (add_na in c(FALSE, TRUE)) { 424s + cat("add_na = ", add_na, "\n", sep = "") 424s + 424s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 424s + if (add_na) { 424s + x[3:7, c(2, 4)] <- NA_real_ 424s + } 424s + cat("mode: ", mode, "\n", sep = "") 424s + storage.mode(x) <- mode 424s + str(x) 424s + 424s + # Test with and without dimnames on x 424s + for (setDimnames in c(TRUE, FALSE)) { 424s + if (setDimnames) dimnames(x) <- dimnames 424s + else dimnames(x) <- NULL 424s + # Check names attribute 424s + for (useNames in c(TRUE, FALSE)) { 424s + # Row/column ranges 424s + r0 <- rowCumsums_R(x, useNames = useNames) 424s + r1 <- rowCumsums(x, useNames = useNames) 424s + r2 <- t(colCumsums(t(x), useNames = useNames)) 424s + stopifnot(all.equal(r1, r2)) 424s + stopifnot(all.equal(r1, r0)) 424s + stopifnot(all.equal(r2, r0)) 424s + } # for (useNames ...) 424s + } # for (setDimnames ...) 424s + } # for (add_na ...) 424s + } 424s add_na = FALSE 424s mode: logical 424s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 424s add_na = TRUE 424s mode: logical 424s logi [1:10, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 424s add_na = FALSE 424s mode: integer 424s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 424s add_na = TRUE 424s mode: integer 424s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 424s add_na = FALSE 424s mode: double 424s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 424s add_na = TRUE 424s mode: double 424s num [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 424s > 424s > 424s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 424s > # All NAs 424s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 424s > for (mode in c("logical", "integer", "double")) { 424s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 424s + cat("mode: ", mode, "\n", sep = "") 424s + storage.mode(x) <- mode 424s + str(x) 424s + 424s + # Test with and without dimnames on x 424s + for (setDimnames in c(TRUE, FALSE)) { 424s + if (setDimnames) dimnames(x) <- dimnames 424s + else dimnames(x) <- NULL 424s + # Check names attribute 424s + for (useNames in c(TRUE, FALSE)) { 424s + # Row/column ranges 424s + r0 <- rowCumsums_R(x, useNames = useNames) 424s + r1 <- rowCumsums(x, useNames = useNames) 424s + r2 <- t(colCumsums(t(x), useNames = useNames)) 424s + stopifnot(all.equal(r1, r2)) 424s + stopifnot(all.equal(r1, r0)) 424s + stopifnot(all.equal(r2, r0)) 424s + } # for (useNames ...) 424s + } # for (setDimnames ...) 424s + } # for (mode ...) 424s mode: logical 424s logi [1:10, 1:5] NA NA NA NA NA NA ... 424s mode: integer 424s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 424s mode: double 424s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 424s > 424s > 424s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 424s > # A 1x1 matrix 424s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 424s > dimnames <- list("a", "A") # to check dimnames attribute 424s > for (mode in c("logical", "integer", "double")) { 424s + x <- matrix(0, nrow = 1L, ncol = 1L) 424s + cat("mode: ", mode, "\n", sep = "") 424s + storage.mode(x) <- mode 424s + str(x) 424s + 424s + r0 <- rowCumsums_R(x) 424s + r1 <- rowCumsums(x) 424s + r2 <- t(colCumsums(t(x))) 424s + stopifnot(all.equal(r1, r2)) 424s + stopifnot(all.equal(r1, r0)) 424s + stopifnot(all.equal(r2, r0)) 424s + 424s + # Check dimnames attribute 424s + dimnames(x) <- dimnames 424s + # r0 <- rowCumsums_R(x) 424s + # > r0 424s + # a 424s + # [1,] 0 424s + r1 <- rowCumsums(x, useNames = TRUE) 424s + r2 <- t(colCumsums(t(x), useNames = TRUE)) 424s + stopifnot(identical(dimnames(r1), dimnames)) 424s + stopifnot(identical(dimnames(r2), dimnames)) 424s + dimnames(x) <- NULL 424s + } 424s mode: logical 424s logi [1, 1] FALSE 424s mode: integer 424s int [1, 1] 0 424s mode: double 424s num [1, 1] 0 424s > 424s > 424s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 424s > # Corner cases 424s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 424s > names <- LETTERS[1:5] # to check dimnames attribute 424s > for (mode in c("logical", "integer", "double")) { 424s + cat("mode: ", mode, "\n", sep = "") 424s + value <- 0 424s + storage.mode(value) <- mode 424s + value2 <- value 424s + if (mode == "logical") value2 <- 0L 424s + 424s + # A 0x0 matrix 424s + x <- matrix(value, nrow = 0L, ncol = 0L) 424s + str(x) 424s + r0 <- matrix(value2, nrow = nrow(x), ncol = ncol(x)) 424s + r1 <- rowCumsums(x) 424s + r2 <- t(colCumsums(t(x))) 424s + stopifnot(all.equal(r1, r2)) 424s + stopifnot(all.equal(r1, r0)) 424s + stopifnot(all.equal(r2, r0)) 424s + 424s + # A 0xK matrix 424s + x <- matrix(value, nrow = 0L, ncol = 5L) 424s + str(x) 424s + colnames <- LETTERS[1:5] 424s + # Test with and without dimnames on x 424s + for (setDimnames in c(TRUE, FALSE)) { 424s + if (setDimnames) colnames(x) <- colnames 424s + else dimnames(x) <- NULL 424s + # Check names attribute 424s + for (useNames in c(TRUE, FALSE)) { 424s + r0 <- rowCumsums_R(x, useNames = useNames) 424s + r1 <- rowCumsums(x, useNames = useNames) 424s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 424s + stopifnot(all.equal(r1, r2)) 424s + stopifnot(all.equal(r1, r0)) 424s + stopifnot(all.equal(r2, r0)) 424s + } # for (useNames ...) 424s + } # for (setDimnames ...) 424s + 424s + # A Nx0 matrix 424s + x <- matrix(value, nrow = 5L, ncol = 0L) 424s + str(x) 424s + rownames <- LETTERS[1:5] 424s + # Test with and without dimnames on x 424s + for (setDimnames in c(TRUE, FALSE)) { 424s + if (setDimnames) rownames(x) <- rownames 424s + else dimnames(x) <- NULL 424s + # Check names attribute 424s + for (useNames in c(TRUE, FALSE)) { 424s + r0 <- rowCumsums_R(x, useNames = useNames) 424s + r1 <- rowCumsums(x, useNames = useNames) 424s + r2 <- t(rowCumsums(t(x), useNames = useNames)) 424s + stopifnot(all.equal(r1, r2)) 424s + stopifnot(all.equal(r1, r0)) 424s + stopifnot(all.equal(r2, r0)) 424s + } # for (useNames ...) 424s + } # for (setDimnames ...) 424s + } # for (mode ...) 424s mode: logical 424s logi[0 , 0 ] 424s logi[0 , 1:5] 424s logi[1:5, 0 ] 424s mode: integer 424s int[0 , 0 ] 424s int[0 , 1:5] 424s int[1:5, 0 ] 424s mode: double 424s num[0 , 0 ] 424s num[0 , 1:5] 424s num[1:5, 0 ] 424s > 424s 424s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 424s Copyright (C) 2025 The R Foundation for Statistical Computing 424s Platform: arm-unknown-linux-gnueabihf (32-bit) 424s 424s R is free software and comes with ABSOLUTELY NO WARRANTY. 424s You are welcome to redistribute it under certain conditions. 424s Type 'license()' or 'licence()' for distribution details. 424s 424s R is a collaborative project with many contributors. 424s Type 'contributors()' for more information and 424s 'citation()' on how to cite R or R packages in publications. 424s 424s Type 'demo()' for some demos, 'help()' for on-line help, or 424s 'help.start()' for an HTML browser interface to help. 424s Type 'q()' to quit R. 424s 424s > library("matrixStats") 424s > 424s > rowCumsums_R <- function(x, ..., useNames = TRUE) { 424s + suppressWarnings({ 424s + y <- t(apply(x, MARGIN = 1L, FUN = cumsum)) 424s + }) 424s + 424s + # Preserve dimnames attribute? 424s + dim(y) <- dim(x) 424s + dimnames(y) <- if (useNames) dimnames(x) else NULL 424s + 424s + y 424s + } 424s > 424s > 424s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 424s > # Subsetted tests 424s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 424s > source("utils/validateIndicesFramework.R") 424s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 424s > storage.mode(x) <- "integer" 424s > 424s > # To check dimnames attribute 424s > dimnames <- list(letters[1:6], LETTERS[1:6]) 424s > 424s > # Test with and without dimnames on x 424s > for (setDimnames in c(TRUE, FALSE)) { 424s + if (setDimnames) dimnames(x) <- dimnames 424s + else dimnames(x) <- NULL 424s + for (rows in index_cases) { 424s + for (cols in index_cases) { 424s + # Check names attribute 424s + for (useNames in c(TRUE, FALSE)) { 424s + validateIndicesTestMatrix(x, rows, cols, 424s + ftest = rowCumsums, fsure = rowCumsums_R, useNames = useNames) 424s + validateIndicesTestMatrix(x, rows, cols, 424s + ftest = function(x, rows, cols, ..., useNames) { 424s + t(colCumsums(t(x), rows = cols, cols = rows, useNames = useNames)) 424s + }, fsure = rowCumsums_R, useNames = useNames) 424s + } 424s + } 424s + } 424s + } 425s > 425s 425s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 425s Copyright (C) 2025 The R Foundation for Statistical Computing 425s Platform: arm-unknown-linux-gnueabihf (32-bit) 425s 425s R is free software and comes with ABSOLUTELY NO WARRANTY. 425s You are welcome to redistribute it under certain conditions. 425s Type 'license()' or 'licence()' for distribution details. 425s 425s R is a collaborative project with many contributors. 425s Type 'contributors()' for more information and 425s 'citation()' on how to cite R or R packages in publications. 425s 425s Type 'demo()' for some demos, 'help()' for on-line help, or 425s 'help.start()' for an HTML browser interface to help. 425s Type 'q()' to quit R. 425s 425s > library("matrixStats") 425s > 425s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = TRUE) { 425s + ncol2 <- ncol(x) - lag * differences 425s + if (ncol2 <= 0) { 425s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 425s + # Preserve names attribute 425s + if (useNames && !is.null(rownames(x))) rownames(y) <- rownames(x) 425s + return(y) 425s + } 425s + suppressWarnings({ 425s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 425s + }) 425s + y <- t(y) 425s + 425s + # Preserve dimnames attribute 425s + dim(y) <- c(nrow(x), ncol2) 425s + if (useNames && !is.null(dimnames(x))) { 425s + colnames <- colnames(x) 425s + if (!is.null(colnames)) { 425s + len <- length(colnames) 425s + colnames <- colnames[(len - ncol2 + 1):len] 425s + } 425s + dimnames(y) <- list(rownames(x), colnames) 425s + } 425s + else dimnames(y) <- NULL 425s + 425s + y 425s + } 425s > 425s > 425s > set.seed(0x42) 425s > 425s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 425s > # With and without some NAs 425s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 425s > for (mode in c("integer", "double")) { 425s + cat("mode: ", mode, "\n", sep = "") 425s + 425s + for (add_na in c(FALSE, TRUE)) { 425s + cat("add_na = ", add_na, "\n", sep = "") 425s + 425s + x <- matrix(sample(10 * 8) + 0.1, nrow = 10L, ncol = 8L) 425s + if (add_na) { 425s + x[3:7, c(2, 4)] <- NA_real_ 425s + } 425s + storage.mode(x) <- mode 425s + str(x) 425s + 425s + dimnames <- list(letters[1:10], LETTERS[1:8]) 425s + 425s + # Test with and without dimnames on x 425s + for (setDimnames in c(TRUE, FALSE)) { 425s + if (setDimnames) dimnames(x) <- dimnames 425s + else dimnames(x) <- NULL 425s + # Check dimnames attribute 425s + for (useNames in c(TRUE, FALSE)) { 425s + for (lag in 1:4) { 425s + for (differences in 1:3) { 425s + cat(sprintf("mode: %s, lag = %d, differences = %d\n", 425s + mode, lag, differences)) 425s + # Row/column ranges 425s + r0 <- rowDiffs_R(x, lag = lag, differences = differences, useNames = useNames) 425s + r1 <- rowDiffs(x, lag = lag, differences = differences, useNames = useNames) 425s + r2 <- t(colDiffs(t(x), lag = lag, differences = differences, useNames = useNames)) 425s + stopifnot(all.equal(r1, r0)) 425s + stopifnot(all.equal(r2, r0)) 425s + stopifnot(all.equal(r1, r2)) 425s + } 425s + } 425s + } # for (useNames ...) 425s + } # for (setDimnames ...) 425s + } # for (add_na ...) 425s + } # for (mode ...) 425s mode: integer 425s add_na = FALSE 425s int [1:10, 1:8] 68 26 29 47 48 10 1 38 16 40 ... 425s mode: integer, lag = 1, differences = 1 426s mode: integer, lag = 1, differences = 2 426s mode: integer, lag = 1, differences = 3 426s mode: integer, lag = 2, differences = 1 426s mode: integer, lag = 2, differences = 2 426s mode: integer, lag = 2, differences = 3 426s mode: integer, lag = 3, differences = 1 426s mode: integer, lag = 3, differences = 2 426s mode: integer, lag = 3, differences = 3 426s mode: integer, lag = 4, differences = 1 426s mode: integer, lag = 4, differences = 2 426s mode: integer, lag = 4, differences = 3 426s mode: integer, lag = 1, differences = 1 426s mode: integer, lag = 1, differences = 2 426s mode: integer, lag = 1, differences = 3 426s mode: integer, lag = 2, differences = 1 426s mode: integer, lag = 2, differences = 2 426s mode: integer, lag = 2, differences = 3 426s mode: integer, lag = 3, differences = 1 426s mode: integer, lag = 3, differences = 2 426s mode: integer, lag = 3, differences = 3 426s mode: integer, lag = 4, differences = 1 426s mode: integer, lag = 4, differences = 2 426s mode: integer, lag = 4, differences = 3 426s mode: integer, lag = 1, differences = 1 426s mode: integer, lag = 1, differences = 2 426s mode: integer, lag = 1, differences = 3 426s mode: integer, lag = 2, differences = 1 426s mode: integer, lag = 2, differences = 2 426s mode: integer, lag = 2, differences = 3 426s mode: integer, lag = 3, differences = 1 426s mode: integer, lag = 3, differences = 2 426s mode: integer, lag = 3, differences = 3 426s mode: integer, lag = 4, differences = 1 426s mode: integer, lag = 4, differences = 2 426s mode: integer, lag = 4, differences = 3 426s mode: integer, lag = 1, differences = 1 426s mode: integer, lag = 1, differences = 2 426s mode: integer, lag = 1, differences = 3 426s mode: integer, lag = 2, differences = 1 426s mode: integer, lag = 2, differences = 2 426s mode: integer, lag = 2, differences = 3 426s mode: integer, lag = 3, differences = 1 426s mode: integer, lag = 3, differences = 2 426s mode: integer, lag = 3, differences = 3 426s mode: integer, lag = 4, differences = 1 426s mode: integer, lag = 4, differences = 2 426s mode: integer, lag = 4, differences = 3 426s add_na = TRUE 426s int [1:10, 1:8] 80 71 7 52 79 22 31 10 29 63 ... 426s mode: integer, lag = 1, differences = 1 426s mode: integer, lag = 1, differences = 2 426s mode: integer, lag = 1, differences = 3 426s mode: integer, lag = 2, differences = 1 426s mode: integer, lag = 2, differences = 2 426s mode: integer, lag = 2, differences = 3 426s mode: integer, lag = 3, differences = 1 426s mode: integer, lag = 3, differences = 2 426s mode: integer, lag = 3, differences = 3 426s mode: integer, lag = 4, differences = 1 426s mode: integer, lag = 4, differences = 2 426s mode: integer, lag = 4, differences = 3 426s mode: integer, lag = 1, differences = 1 426s mode: integer, lag = 1, differences = 2 426s mode: integer, lag = 1, differences = 3 426s mode: integer, lag = 2, differences = 1 426s mode: integer, lag = 2, differences = 2 426s mode: integer, lag = 2, differences = 3 426s mode: integer, lag = 3, differences = 1 426s mode: integer, lag = 3, differences = 2 426s mode: integer, lag = 3, differences = 3 426s mode: integer, lag = 4, differences = 1 426s mode: integer, lag = 4, differences = 2 426s mode: integer, lag = 4, differences = 3 426s mode: integer, lag = 1, differences = 1 426s mode: integer, lag = 1, differences = 2 426s mode: integer, lag = 1, differences = 3 426s mode: integer, lag = 2, differences = 1 426s mode: integer, lag = 2, differences = 2 426s mode: integer, lag = 2, differences = 3 426s mode: integer, lag = 3, differences = 1 426s mode: integer, lag = 3, differences = 2 426s mode: integer, lag = 3, differences = 3 426s mode: integer, lag = 4, differences = 1 426s mode: integer, lag = 4, differences = 2 426s mode: integer, lag = 4, differences = 3 426s mode: integer, lag = 1, differences = 1 426s mode: integer, lag = 1, differences = 2 426s mode: integer, lag = 1, differences = 3 426s mode: integer, lag = 2, differences = 1 426s mode: integer, lag = 2, differences = 2 426s mode: integer, lag = 2, differences = 3 426s mode: integer, lag = 3, differences = 1 426s mode: integer, lag = 3, differences = 2 426s mode: integer, lag = 3, differences = 3 426s mode: integer, lag = 4, differences = 1 426s mode: integer, lag = 4, differences = 2 426s mode: integer, lag = 4, differences = 3 426s mode: double 426s add_na = FALSE 426s 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 ... 426s mode: double, lag = 1, differences = 1 426s mode: double, lag = 1, differences = 2 426s mode: double, lag = 1, differences = 3 426s mode: double, lag = 2, differences = 1 426s mode: double, lag = 2, differences = 2 426s mode: double, lag = 2, differences = 3 426s mode: double, lag = 3, differences = 1 426s mode: double, lag = 3, differences = 2 426s mode: double, lag = 3, differences = 3 426s mode: double, lag = 4, differences = 1 426s mode: double, lag = 4, differences = 2 426s mode: double, lag = 4, differences = 3 426s mode: double, lag = 1, differences = 1 426s mode: double, lag = 1, differences = 2 426s mode: double, lag = 1, differences = 3 426s mode: double, lag = 2, differences = 1 426s mode: double, lag = 2, differences = 2 426s mode: double, lag = 2, differences = 3 426s mode: double, lag = 3, differences = 1 426s mode: double, lag = 3, differences = 2 426s mode: double, lag = 3, differences = 3 426s mode: double, lag = 4, differences = 1 426s mode: double, lag = 4, differences = 2 426s mode: double, lag = 4, differences = 3 426s mode: double, lag = 1, differences = 1 426s mode: double, lag = 1, differences = 2 426s mode: double, lag = 1, differences = 3 426s mode: double, lag = 2, differences = 1 426s mode: double, lag = 2, differences = 2 426s mode: double, lag = 2, differences = 3 426s mode: double, lag = 3, differences = 1 426s mode: double, lag = 3, differences = 2 426s mode: double, lag = 3, differences = 3 426s mode: double, lag = 4, differences = 1 426s mode: double, lag = 4, differences = 2 426s mode: double, lag = 4, differences = 3 426s mode: double, lag = 1, differences = 1 426s mode: double, lag = 1, differences = 2 426s mode: double, lag = 1, differences = 3 426s mode: double, lag = 2, differences = 1 426s mode: double, lag = 2, differences = 2 426s mode: double, lag = 2, differences = 3 426s mode: double, lag = 3, differences = 1 426s mode: double, lag = 3, differences = 2 426s mode: double, lag = 3, differences = 3 426s mode: double, lag = 4, differences = 1 426s mode: double, lag = 4, differences = 2 426s mode: double, lag = 4, differences = 3 426s add_na = TRUE 426s 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 ... 426s mode: double, lag = 1, differences = 1 426s mode: double, lag = 1, differences = 2 426s mode: double, lag = 1, differences = 3 426s mode: double, lag = 2, differences = 1 426s mode: double, lag = 2, differences = 2 426s mode: double, lag = 2, differences = 3 426s mode: double, lag = 3, differences = 1 426s mode: double, lag = 3, differences = 2 426s mode: double, lag = 3, differences = 3 426s mode: double, lag = 4, differences = 1 426s mode: double, lag = 4, differences = 2 426s mode: double, lag = 4, differences = 3 426s mode: double, lag = 1, differences = 1 426s mode: double, lag = 1, differences = 2 426s mode: double, lag = 1, differences = 3 426s mode: double, lag = 2, differences = 1 426s mode: double, lag = 2, differences = 2 426s mode: double, lag = 2, differences = 3 426s mode: double, lag = 3, differences = 1 426s mode: double, lag = 3, differences = 2 426s mode: double, lag = 3, differences = 3 426s mode: double, lag = 4, differences = 1 426s mode: double, lag = 4, differences = 2 426s mode: double, lag = 4, differences = 3 426s mode: double, lag = 1, differences = 1 426s mode: double, lag = 1, differences = 2 426s mode: double, lag = 1, differences = 3 426s mode: double, lag = 2, differences = 1 426s mode: double, lag = 2, differences = 2 426s mode: double, lag = 2, differences = 3 426s mode: double, lag = 3, differences = 1 426s mode: double, lag = 3, differences = 2 426s mode: double, lag = 3, differences = 3 426s mode: double, lag = 4, differences = 1 426s mode: double, lag = 4, differences = 2 426s mode: double, lag = 4, differences = 3 426s mode: double, lag = 1, differences = 1 426s mode: double, lag = 1, differences = 2 426s mode: double, lag = 1, differences = 3 426s mode: double, lag = 2, differences = 1 426s mode: double, lag = 2, differences = 2 426s mode: double, lag = 2, differences = 3 426s mode: double, lag = 3, differences = 1 426s mode: double, lag = 3, differences = 2 426s mode: double, lag = 3, differences = 3 426s mode: double, lag = 4, differences = 1 426s mode: double, lag = 4, differences = 2 426s mode: double, lag = 4, differences = 3 426s > 426s > 426s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 426s > # All NAs 426s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 426s > for (mode in c("integer", "double")) { 426s + cat("mode: ", mode, "\n", sep = "") 426s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 426s + storage.mode(x) <- mode 426s + str(x) 426s + 426s + dimnames <- list(letters[1:10], LETTERS[1:5]) 426s + 426s + # Test with and without dimnames on x 426s + for (setDimnames in c(TRUE, FALSE)) { 426s + if (setDimnames) dimnames(x) <- dimnames 426s + else dimnames(x) <- NULL 426s + # Check dimnames attribute 426s + for (useNames in c(TRUE, FALSE)) { 426s + r0 <- rowDiffs_R(x, useNames = useNames) 426s + r1 <- rowDiffs(x, useNames = useNames) 426s + r2 <- t(colDiffs(t(x), useNames = useNames)) 426s + stopifnot(all.equal(r1, r0)) 426s + stopifnot(all.equal(r2, r0)) 426s + stopifnot(all.equal(r1, r2)) 426s + } # for (useNames ...) 426s + } # for (setDimnames ...) 426s + } # for (mode ...) 426s mode: integer 426s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 426s mode: double 426s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 426s > 426s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 426s > # A 1x1 matrix 426s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 426s > x <- matrix(0, nrow = 1L, ncol = 1L) 426s > dimnames <- list("a", "A") 426s > # Test with and without dimnames on x 426s > for (setDimnames in c(TRUE, FALSE)) { 426s + if (setDimnames) dimnames(x) <- dimnames 426s + else dimnames(x) <- NULL 426s + # Check dimnames attribute 426s + for (useNames in c(TRUE, FALSE)) { 426s + r0 <- rowDiffs_R(x, useNames = useNames) 426s + r1 <- rowDiffs(x, useNames = useNames) 426s + r2 <- t(colDiffs(t(x), useNames = useNames)) 426s + stopifnot(all.equal(r1, r0)) 426s + stopifnot(all.equal(r2, r0)) 426s + stopifnot(all.equal(r1, r2)) 426s + } # for (useNames ...) 426s + } # for (setDimnames ...) 426s > 426s 426s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 426s Copyright (C) 2025 The R Foundation for Statistical Computing 426s Platform: arm-unknown-linux-gnueabihf (32-bit) 426s 426s R is free software and comes with ABSOLUTELY NO WARRANTY. 426s You are welcome to redistribute it under certain conditions. 426s Type 'license()' or 'licence()' for distribution details. 426s 426s R is a collaborative project with many contributors. 426s Type 'contributors()' for more information and 426s 'citation()' on how to cite R or R packages in publications. 426s 426s Type 'demo()' for some demos, 'help()' for on-line help, or 426s 'help.start()' for an HTML browser interface to help. 426s Type 'q()' to quit R. 426s 426s > library("matrixStats") 426s > 426s > rowDiffs_R <- function(x, lag = 1L, differences = 1L, ..., useNames = TRUE) { 426s + ncol2 <- ncol(x) - lag * differences 426s + if (ncol2 <= 0) { 426s + y <- matrix(x[integer(0L)], nrow = nrow(x), ncol = 0L) 426s + # Preserve names attribute 426s + if (useNames && !is.null(rownames(x))) rownames(y) <- rownames(x) 426s + return(y) 426s + } 426s + suppressWarnings({ 426s + y <- apply(x, MARGIN = 1L, FUN = diff, lag = lag, differences = differences) 426s + }) 426s + y <- t(y) 426s + 426s + # Preserve dimnames attribute 426s + dim(y) <- c(nrow(x), ncol2) 426s + if (useNames && !is.null(dimnames(x))) { 426s + colnames <- colnames(x) 426s + if (!is.null(colnames)) { 426s + len <- length(colnames) 426s + colnames <- colnames[(len - ncol2 + 1):len] 426s + } 426s + dimnames(y) <- list(rownames(x), colnames) 426s + } 426s + else dimnames(y) <- NULL 426s + 426s + y 426s + } 426s > 426s > 426s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 426s > # Subsetted tests 426s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 426s > source("utils/validateIndicesFramework.R") 426s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 426s > storage.mode(x) <- "integer" 426s > 426s > # To check dimnames attribute 426s > dimnames <- list(letters[1:6], LETTERS[1:6]) 426s > 426s > # Test with and without dimnames on x 426s > for (setDimnames in c(TRUE, FALSE)) { 426s + if (setDimnames) dimnames(x) <- dimnames 426s + else dimnames(x) <- NULL 426s + 426s + count <- 0L 426s + for (rows in index_cases) { 426s + for (cols in index_cases) { 426s + count <- count + 1L 426s + for (lag in 1:2) { 426s + for (differences in 1:3) { 426s + # Check dimnames attribute 426s + useNames <- c(TRUE, FALSE) 426s + useNames <- useNames[count %% length(useNames) + 1] 426s + validateIndicesTestMatrix(x, rows, cols, 426s + ftest = rowDiffs, fsure = rowDiffs_R, 426s + lag = lag, differences = differences, useNames = useNames) 426s + validateIndicesTestMatrix(x, rows, cols, 426s + ftest = function(x, rows, cols, ..., useNames) { 426s + t(colDiffs(t(x), rows = cols, cols = rows, ..., useNames = useNames)) 426s + }, fsure = rowDiffs_R, 426s + lag = lag, differences = differences, useNames = useNames) 426s + } 426s + } 426s + } 426s + } 426s + } 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: arm-unknown-linux-gnueabihf (32-bit) 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 > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 429s + quantile_na <- function(x, ..., na.rm = FALSE) { 429s + if (!na.rm && anyMissing(x)) 429s + return(c(NA_real_, NA_real_)) 429s + quantile(x, ..., na.rm = na.rm) 429s + } 429s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 429s + probs = c(0.25, 0.75), na.rm = na.rm) 429s + rownames(q) <- NULL # Not needed anymore 429s + 429s + # Preserve names attribute 429s + dim(q) <- c(2L, nrow(x)) 429s + colnames(q) <- if (useNames) rownames(x) else NULL 429s + 429s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 429s + } 429s > 429s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 429s > # Test with multiple quantiles 429s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 429s > for (mode in c("integer", "double")) { 429s + cat("mode: ", mode, "\n", sep = "") 429s + x <- matrix(1:100 + 0.1, nrow = 10, ncol = 10) 429s + storage.mode(x) <- mode 429s + str(x) 429s + 429s + # To check names attribute 429s + dimnames <- list(letters[1:10], LETTERS[1:10]) 429s + 429s + for (add_na in c(FALSE, TRUE)) { 429s + if (add_na) { 429s + x[3:5, 6:9] <- NA 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 + for (na.rm in c(FALSE, TRUE)) { 429s + # Check names attribute 429s + for (useNames in c(TRUE, FALSE)) { 429s + probs <- c(0, 0.5, 1) 429s + q0 <- rowIQRs_R(x, na.rm = na.rm, useNames = useNames) 429s + print(q0) 429s + q1 <- rowIQRs(x, na.rm = na.rm, useNames = useNames) 429s + print(q1) 429s + stopifnot(all.equal(q1, q0)) 429s + q2 <- colIQRs(t(x), na.rm = na.rm, useNames = useNames) 429s + stopifnot(all.equal(q2, q0)) 429s + 429s + q <- iqr(x[3, ], na.rm = na.rm) 429s + print(q) 429s + } # for (useNames ...) 429s + } # for (na.rm ...) 429s + } # for (setDimnames ...) 429s + } # for (add_na ...) 429s + } # for (mode ...) 429s mode: integer 429s int [1:10, 1:10] 1 2 3 4 5 6 7 8 9 10 ... 429s a b c d e f g h i j 429s 45 45 45 45 45 45 45 45 45 45 429s a b c d e f g h i j 429s 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s a b c d e f g h i j 429s 45 45 45 45 45 45 45 45 45 45 429s a b c d e f g h i j 429s 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s a b c d e f g h i j 429s 45 45 NA NA NA 45 45 45 45 45 429s a b c d e f g h i j 429s 45 45 NA NA NA 45 45 45 45 45 429s [1] NA 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] NA 429s a b c d e f g h i j 429s 45 45 25 25 25 45 45 45 45 45 429s a b c d e f g h i j 429s 45 45 25 25 25 45 45 45 45 45 429s [1] 25 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 25 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] NA 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] NA 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 25 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 25 429s mode: double 429s 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 ... 429s a b c d e f g h i j 429s 45 45 45 45 45 45 45 45 45 45 429s a b c d e f g h i j 429s 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s a b c d e f g h i j 429s 45 45 45 45 45 45 45 45 45 45 429s a b c d e f g h i j 429s 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 45 45 45 45 45 45 45 45 45 429s [1] 45 429s a b c d e f g h i j 429s 45 45 NA NA NA 45 45 45 45 45 429s a b c d e f g h i j 429s 45 45 NA NA NA 45 45 45 45 45 429s [1] NA 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] NA 429s a b c d e f g h i j 429s 45 45 25 25 25 45 45 45 45 45 429s a b c d e f g h i j 429s 45 45 25 25 25 45 45 45 45 45 429s [1] 25 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 25 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] NA 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] 45 45 NA NA NA 45 45 45 45 45 429s [1] NA 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 25 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 45 45 25 25 25 45 45 45 45 45 429s [1] 25 429s > 429s > 429s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 429s > # Test corner cases 429s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 429s > for (mode in c("integer", "double")) { 429s + cat("mode: ", mode, "\n", sep = "") 429s + # Empty vectors 429s + x <- integer(0L) 429s + storage.mode(x) <- mode 429s + str(x) 429s + q <- iqr(x) 429s + print(q) 429s + stopifnot(identical(q, NA_real_)) 429s + 429s + # Scalar 429s + x <- 1L 429s + storage.mode(x) <- mode 429s + str(x) 429s + q <- iqr(x) 429s + str(q) 429s + stopifnot(identical(q, 0)) 429s + } 429s mode: integer 429s int(0) 429s [1] NA 429s int 1 429s num 0 429s mode: double 429s num(0) 429s [1] NA 429s num 1 429s num 0 429s > 429s > 429s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 429s > # Single row matrices 429s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 429s > x <- matrix(1, nrow = 1L, ncol = 2L) 429s > dimnames <- list("a", LETTERS[1:2]) 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 + q0 <- rowIQRs_R(x, useNames = useNames) 429s + q1 <- rowIQRs(x, useNames = useNames) 429s + q2 <- colIQRs(t(x), useNames = useNames) 429s + stopifnot(all.equal(q0, q1)) 429s + stopifnot(all.equal(q0, q2)) 429s + } 429s + } 429s > 429s > x <- matrix(1, nrow = 2L, ncol = 1L) 429s > q <- colIQRs(x) 429s > stopifnot(identical(q, 0)) 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: arm-unknown-linux-gnueabihf (32-bit) 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 > rowIQRs_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 429s + quantile_na <- function(x, ..., na.rm = FALSE) { 429s + if (!na.rm && anyMissing(x)) 429s + return(c(NA_real_, NA_real_)) 429s + quantile(x, ..., na.rm = na.rm) 429s + } 429s + q <- apply(x, MARGIN = 1L, FUN = quantile_na, 429s + probs = c(0.25, 0.75), na.rm = na.rm) 429s + rownames(q) <- NULL # Not needed anymore 429s + 429s + # Preserve names attribute 429s + dim(q) <- c(2L, nrow(x)) 429s + colnames(q) <- if (useNames) rownames(x) else NULL 429s + 429s + q[2L, , drop = TRUE] - q[1L, , drop = TRUE] 429s + } 429s > 429s > 429s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 429s > # Subsetted tests 429s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 429s > source("utils/validateIndicesFramework.R") 429s > x <- runif(6, min = -6, max = 6) 429s > for (idxs in index_cases) { 429s + for (na.rm in c(TRUE, FALSE)) { 429s + validateIndicesTestVector(x, idxs, ftest = iqr, fsure = function(x, na.rm) { 429s + dim(x) <- c(1L, length(x)) 429s + rowIQRs_R(x, na.rm = na.rm) 429s + }, na.rm = na.rm) 429s + } 429s + } 429s > 429s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 429s > 429s > # To check names attribute 429s > dimnames <- list(letters[1:6], LETTERS[1:6]) 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 = rowIQRs, fsure = rowIQRs_R, 429s + na.rm = na.rm, useNames = useNames) 429s + validateIndicesTestMatrix(x, rows, cols, 429s + fcoltest = colIQRs, fsure = rowIQRs_R, 429s + na.rm = na.rm, useNames = useNames) 429s + } 429s + } 429s + } 430s > 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: arm-unknown-linux-gnueabihf (32-bit) 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 > # Test inspired by the harmonic mean example in R-help 431s > # thread '[R] Beyond double-precision?' on May 9, 2009. 431s > 431s > library("matrixStats") 431s > library("stats") 431s > 431s > logSumExp0 <- function(lx) { 431s + idx_max <- which.max(lx) 431s + log1p(sum(exp(lx[-idx_max] - lx[idx_max]))) + lx[idx_max] 431s + } 431s > 431s > n <- 200L 431s > set.seed(1) 431s > 431s > for (mode in c("integer", "double")) { 431s + cat("mode: ", mode, "\n", sep = "") 431s + x <- matrix(runif(n, min = 1.0, max = 3.0), nrow = 20L) 431s + storage.mode(x) <- mode 431s + str(x) 431s + 431s + # The logarithm of the harmonic mean by rows 431s + y_h <- log(1 / rowMeans(1 / x)) 431s + str(y_h) 431s + 431s + lx_neg <- -log(x) 431s + 431s + y0 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp0) 431s + stopifnot(all.equal(y0, y_h)) 431s + 431s + y1 <- log(ncol(x)) - apply(lx_neg, MARGIN = 1L, FUN = logSumExp) 431s + stopifnot(all.equal(y1, y0)) 431s + 431s + y2 <- log(ncol(x)) - rowLogSumExps(lx_neg) 431s + stopifnot(all.equal(y2, y0)) 431s + 431s + y3 <- log(ncol(x)) - colLogSumExps(t(lx_neg)) 431s + stopifnot(all.equal(y3, y0)) 431s + 431s + 431s + # The logarithm of the harmonic mean by columns 431s + y_h <- log(1 / colMeans(1 / x)) 431s + str(y_h) 431s + 431s + y0 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp0) 431s + stopifnot(all.equal(y0, y_h)) 431s + 431s + y1 <- log(nrow(x)) - apply(lx_neg, MARGIN = 2L, FUN = logSumExp) 431s + stopifnot(all.equal(y1, y0)) 431s + 431s + y2 <- log(nrow(x)) - colLogSumExps(lx_neg) 431s + stopifnot(all.equal(y2, y0)) 431s + 431s + y3 <- log(nrow(x)) - rowLogSumExps(t(lx_neg)) 431s + stopifnot(all.equal(y3, y0)) 431s + 431s + # Testing names 431s + rownames(lx_neg) <- seq_len(nrow(x)) 431s + colnames(lx_neg) <- seq_len(ncol(x)) 431s + y2 <- rowLogSumExps(lx_neg, useNames = TRUE) 431s + stopifnot(identical(names(y2), rownames(lx_neg))) 431s + y3 <- colLogSumExps(t(lx_neg), useNames = TRUE) 431s + stopifnot(identical(names(y3), rownames(lx_neg))) 431s + } # for (mode ...) 431s mode: integer 431s int [1:20, 1:10] 1 1 2 2 1 2 2 2 2 1 ... 431s num [1:20] 0.357 0.223 0.223 0.288 0.511 ... 431s num [1:10] 0.322 0.223 0.322 0.255 0.255 ... 431s mode: double 431s num [1:20, 1:10] 1.54 1.44 2.03 1.54 1.36 ... 431s num [1:20] 0.526 0.466 0.734 0.638 0.604 ... 431s num [1:10] 0.627 0.582 0.617 0.474 0.418 ... 431s > 431s > 431s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 431s > # Corner cases 431s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 431s > ## Zero-size matrices 431s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 0L) 431s > y <- rowLogSumExps(lx) 431s > print(y) 431s numeric(0) 431s > stopifnot(length(y) == nrow(lx)) 431s > 431s > y <- colLogSumExps(lx) 431s > print(y) 431s numeric(0) 431s > stopifnot(length(y) == ncol(lx)) 431s > 431s > ## Zero-height matrices 431s > lx <- matrix(numeric(0L), nrow = 0L, ncol = 5L) 431s > y <- rowLogSumExps(lx) 431s > print(y) 431s numeric(0) 431s > stopifnot(length(y) == nrow(lx)) 431s > 431s > y <- colLogSumExps(lx) 431s > print(y) 431s [1] -Inf -Inf -Inf -Inf -Inf 431s > stopifnot(length(y) == ncol(lx)) 431s > stopifnot(all(y == -Inf)) 431s > 431s > ## Zero-width matrices 431s > lx <- matrix(numeric(0L), nrow = 5L, ncol = 0L) 431s > y <- colLogSumExps(lx) 431s > print(y) 431s numeric(0) 431s > stopifnot(length(y) == ncol(lx)) 431s > 431s > y <- rowLogSumExps(lx) 431s > print(y) 431s [1] -Inf -Inf -Inf -Inf -Inf 431s > stopifnot(length(y) == nrow(lx)) 431s > stopifnot(all(y == -Inf)) 431s > 431s > 431s > ## Matrices with one element 431s > lx <- matrix(1.0, nrow = 1L, ncol = 1L) 431s > y <- rowLogSumExps(lx) 431s > print(y) 431s [1] 1 431s > stopifnot(length(y) == nrow(lx)) 431s > stopifnot(all(y == lx)) 431s > 431s > y <- colLogSumExps(lx) 431s > print(y) 431s [1] 1 431s > stopifnot(length(y) == ncol(lx)) 431s > stopifnot(all(y == lx)) 431s > 431s > ## All missing values 431s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 431s > y <- rowLogSumExps(lx, na.rm = TRUE) 431s > print(y) 431s [1] -Inf 431s > stopifnot(length(y) == nrow(lx)) 431s > stopifnot(identical(y, -Inf)) 431s > 431s > lx <- matrix(NA_real_, nrow = 1L, ncol = 1L) 431s > y <- colLogSumExps(lx, na.rm = TRUE) 431s > print(y) 431s [1] -Inf 431s > stopifnot(length(y) == ncol(lx)) 431s > stopifnot(identical(y, -Inf)) 431s > 431s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 431s > y <- rowLogSumExps(lx, na.rm = TRUE) 431s > print(y) 431s [1] -Inf -Inf 431s > stopifnot(length(y) == nrow(lx)) 431s > stopifnot(all(y == -Inf)) 431s > 431s > y <- rowLogSumExps(lx, na.rm = FALSE) 431s > print(y) 431s [1] NA NA 431s > stopifnot(length(y) == nrow(lx)) 431s > stopifnot(all(is.na(y) & !is.nan(y))) 431s > 431s > lx <- matrix(NA_real_, nrow = 2L, ncol = 2L) 431s > y <- colLogSumExps(lx, na.rm = TRUE) 431s > print(y) 431s [1] -Inf -Inf 431s > stopifnot(length(y) == ncol(lx)) 431s > stopifnot(all(y == -Inf)) 431s > 431s > y <- colLogSumExps(lx, na.rm = FALSE) 431s > print(y) 431s [1] NA NA 431s > stopifnot(length(y) == ncol(lx)) 431s > stopifnot(all(is.na(y) & !is.nan(y))) 431s > 431s > ## +Inf values 431s > lx <- matrix(c(1, 2, +Inf), nrow = 3L, ncol = 2L) 431s > y <- colLogSumExps(lx, na.rm = TRUE) 431s > print(y) 431s [1] Inf Inf 431s > stopifnot(length(y) == ncol(lx)) 431s > stopifnot(all(y == +Inf)) 431s > 431s > ## multiple -Inf values 431s > lx <- matrix(c(-Inf, -Inf), nrow = 2L, ncol = 3L) 431s > y <- rowLogSumExps(lx) 431s > print(y) 431s [1] -Inf -Inf 431s > stopifnot(length(y) == nrow(lx)) 431s > stopifnot(all(y == -Inf)) 431s > 431s > lx <- matrix(c(-Inf, 5, -Inf), nrow = 2L, ncol = 3L, byrow = TRUE) 431s > y <- rowLogSumExps(lx) 431s > print(y) 431s [1] 5 5 431s > stopifnot(length(y) == nrow(lx)) 431s > stopifnot(all(y == 5)) 431s > 431s > ## Bug report #104 (https://github.com/HenrikBengtsson/matrixStats/issues/104) 431s > ## (This would core dump on Windows) 431s > x <- matrix(0.0, nrow = 2L, ncol = 32762L) 431s > y <- colLogSumExps(x) 431s > str(y) 431s num [1:32762] 0.693 0.693 0.693 0.693 0.693 ... 431s > 431s > ## Bug report #120 (https://github.com/HenrikBengtsson/matrixStats/issues/120) 431s > ## (This would error if x had rownames/colnames and non-NULL rows/cols were 431s > ## used) 431s > x <- matrix(runif(6), nrow = 2L, ncol = 3L, 431s + dimnames = list(c("A", "B"), c("a", "b", "c"))) 431s > y <- colLogSumExps(x, cols = 3:1, useNames = TRUE) 431s > stopifnot(names(y) == c("c", "b", "a")) 431s > y <- rowLogSumExps(x, rows = 2, useNames = TRUE) 431s > stopifnot(names(y) == "B") 431s > 431s > 431s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 431s > # Check names attributes 431s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 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 > rowLogSumExps_R <- function(x, ..., useNames = TRUE) { 431s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 431s + log(sum(exp(rx), ...)) 431s + }, ...) 431s + if (isFALSE(useNames)) names(res) <- NULL 431s + res 431s + } 431s > 431s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 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 + for (useNames in c(TRUE, FALSE)) { 431s + y0 <- rowLogSumExps_R(x, useNames = useNames) 431s + y1 <- rowLogSumExps(x, useNames = useNames) 431s + y2 <- colLogSumExps(t(x), useNames = useNames) 431s + stopifnot(all.equal(y1, y0)) 431s + stopifnot(all.equal(y2, y0)) 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: arm-unknown-linux-gnueabihf (32-bit) 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 > ## 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 > rowLogSumExps_R <- function(x, ..., useNames = TRUE) { 431s + res <- apply(x, MARGIN = 1L, FUN = function(rx, ...) { 431s + log(sum(exp(rx), ...)) 431s + }, ...) 431s + if (isFALSE(useNames)) names(res) <- NULL 431s + res 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 > 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 + for (rows in index_cases) { 431s + for (cols in index_cases) { 431s + for (na.rm in c(TRUE, FALSE)) { 431s + for (useNames in c(TRUE, FALSE)) { 431s + validateIndicesTestMatrix(x, rows, cols, 431s + ftest = rowLogSumExps, 431s + fsure = rowLogSumExps_R, 431s + na.rm = na.rm, useNames = useNames) 431s + validateIndicesTestMatrix(x, rows, cols, 431s + fcoltest = colLogSumExps, 431s + fsure = rowLogSumExps_R, 431s + na.rm = na.rm, useNames = useNames) 431s + } 431s + } 431s + } 431s + } 431s + } 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: arm-unknown-linux-gnueabihf (32-bit) 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 > ## Always allow testing of the 'center' argument (as long as it's not defunct) 432s > options(matrixStats.center.onUse = "ignore") 432s > 432s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 432s + suppressWarnings({ 432s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 432s + }) 432s + if (!useNames) names(res) <- NULL 432s + res 432s + } 432s > 432s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 432s + suppressWarnings({ 432s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 432s + }) 432s + if (!useNames) names(res) <- NULL 432s + res 432s + } 432s > 432s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 432s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 432s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 432s + } 432s > 432s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 432s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 432s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 432s + } 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # A 3x3 matrix (no ties) 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > for (mode in c("integer", "double")) { 432s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 432s + cat("mode: ", mode, "\n", sep = "") 432s + storage.mode(x) <- mode 432s + str(x) 432s + 432s + # To check name 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 + tx <- t(x) 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + cat("rowMads():\n") 432s + center <- rowMedians(x, na.rm = TRUE, useNames = useNames) 432s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 432s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 432s + r1b <- rowMads_center(x, na.rm = TRUE, useNames = useNames) 432s + r1c <- rowMads(x, center = center, na.rm = TRUE, useNames = useNames) 432s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 432s + r2b <- colMads_center(tx, na.rm = TRUE, useNames = useNames) 432s + stopifnot(all.equal(r1, r2)) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r1b, r1)) 432s + stopifnot(all.equal(r1c, r1)) 432s + stopifnot(all.equal(r2, r0)) 432s + stopifnot(all.equal(r2b, r2)) 432s + 432s + cat("colMads():\n") 432s + center <- colMedians(x, na.rm = TRUE, useNames = useNames) 432s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 432s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 432s + r1b <- colMads_center(x, na.rm = TRUE, useNames = useNames) 432s + r1c <- colMads(x, center = center, na.rm = TRUE, useNames = useNames) 432s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 432s + r2b <- rowMads_center(tx, na.rm = TRUE, useNames = useNames) 432s + stopifnot(all.equal(r1, r2)) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r1b, r1)) 432s + stopifnot(all.equal(r1c, r1)) 432s + stopifnot(all.equal(r2, r0)) 432s + stopifnot(all.equal(r2b, r2)) 432s + } 432s + } 432s + } 432s mode: integer 432s int [1:3, 1:3] 1 2 3 2 3 4 3 4 5 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s mode: double 432s num [1:3, 1:3] 1.1 2.1 3.1 2.1 3.1 4.1 3.1 4.1 5.1 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # Ties: a 4x4 matrix 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > for (mode in c("integer", "double")) { 432s + x <- matrix(c(1:4, 2:5, 3:6, 4:7) + 0.1, nrow = 4, ncol = 4) 432s + cat("mode: ", mode, "\n", sep = "") 432s + storage.mode(x) <- mode 432s + str(x) 432s + tx <- t(x) 432s + 432s + # To check name 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 + tx <- t(x) 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + cat("rowMads():\n") 432s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 432s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 432s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 432s + stopifnot(all.equal(r1, r2)) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r2, r0)) 432s + 432s + cat("colMads():\n") 432s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 432s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 432s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 432s + stopifnot(all.equal(r1, r2)) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r2, r0)) 432s + } 432s + } 432s + } 432s mode: integer 432s int [1:4, 1:4] 1 2 3 4 2 3 4 5 3 4 ... 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s mode: double 432s 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 ... 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s > tx <- NULL 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # No ties: a 3x3 matrix with an NA value 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > for (mode in c("integer", "double")) { 432s + x <- matrix(c(1, 2, 3, 2, 3, 4, 3, 4, 5) + 0.1, nrow = 3, ncol = 3) 432s + x[2, 2] <- NA_real_ 432s + 432s + cat("mode: ", mode, "\n", sep = "") 432s + storage.mode(x) <- mode 432s + str(x) 432s + tx <- t(x) 432s + 432s + # To check name 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 + tx <- t(x) 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + cat("rowMads():\n") 432s + r0 <- rowMads_R(x, na.rm = TRUE, useNames = useNames) 432s + r1 <- rowMads(x, na.rm = TRUE, useNames = useNames) 432s + r2 <- colMads(tx, na.rm = TRUE, useNames = useNames) 432s + stopifnot(all.equal(r1, r2)) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r2, r0)) 432s + 432s + cat("colMads():\n") 432s + r0 <- colMads_R(x, na.rm = TRUE, useNames = useNames) 432s + r1 <- colMads(x, na.rm = TRUE, useNames = useNames) 432s + r2 <- rowMads(tx, na.rm = TRUE, useNames = useNames) 432s + stopifnot(all.equal(r1, r2)) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r2, r0)) 432s + } 432s + } 432s + } 432s mode: integer 432s int [1:3, 1:3] 1 2 3 2 NA 4 3 4 5 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s mode: double 432s num [1:3, 1:3] 1.1 2.1 3.1 2.1 NA 4.1 3.1 4.1 5.1 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s rowMads(): 432s colMads(): 432s > tx <- NULL 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # With and without some NAs 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > for (add_na in c(FALSE, TRUE)) { 432s + cat("add_na = ", add_na, "\n", sep = "") 432s + 432s + x <- matrix(1:50, nrow = 10L, ncol = 5L) 432s + if (add_na) { 432s + x[3:7, c(2, 4)] <- NA_real_ 432s + } 432s + 432s + # To check name attribute 432s + dimnames <- list(letters[1:10], LETTERS[1:5]) 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 + tx <- t(x) 432s + # Row/column ranges 432s + for (na.rm in c(FALSE, TRUE)) { 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + cat("na.rm = ", na.rm, "\n", sep = "") 432s + cat("rowMads():\n") 432s + center <- rowMedians(x, na.rm = na.rm, useNames = useNames) 432s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 432s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 432s + r2 <- rowMads(x, center = center, na.rm = na.rm, useNames = useNames) 432s + r3 <- colMads(tx, na.rm = na.rm, useNames = useNames) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r2, r0)) 432s + stopifnot(all.equal(r2, r1)) 432s + stopifnot(all.equal(r3, r0)) 432s + stopifnot(all.equal(r3, r1)) 432s + stopifnot(all.equal(r3, r2)) 432s + 432s + cat("colMads():\n") 432s + center <- colMedians(x, na.rm = na.rm, useNames = useNames) 432s + r0 <- colMads_R(x, na.rm = na.rm, useNames = useNames) 432s + r1 <- colMads(x, na.rm = na.rm, useNames = useNames) 432s + r2 <- colMads(x, center = center, na.rm = na.rm, useNames = useNames) 432s + r3 <- rowMads(tx, na.rm = na.rm, useNames = useNames) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r2, r0)) 432s + stopifnot(all.equal(r2, r1)) 432s + stopifnot(all.equal(r3, r0)) 432s + stopifnot(all.equal(r3, r1)) 432s + stopifnot(all.equal(r3, r2)) 432s + } 432s + } 432s + } 432s + tx <- NULL 432s + } # for (add_na ...) 432s add_na = FALSE 432s na.rm = FALSE 432s rowMads(): 432s colMads(): 432s na.rm = FALSE 432s rowMads(): 432s colMads(): 432s na.rm = TRUE 432s rowMads(): 432s colMads(): 432s na.rm = TRUE 432s rowMads(): 432s colMads(): 432s na.rm = FALSE 432s rowMads(): 432s colMads(): 432s na.rm = FALSE 432s rowMads(): 432s colMads(): 432s na.rm = TRUE 432s rowMads(): 432s colMads(): 432s na.rm = TRUE 432s rowMads(): 432s colMads(): 432s add_na = TRUE 432s na.rm = FALSE 432s rowMads(): 432s colMads(): 432s na.rm = FALSE 432s rowMads(): 432s colMads(): 432s na.rm = TRUE 432s rowMads(): 432s colMads(): 432s na.rm = TRUE 432s rowMads(): 432s colMads(): 432s na.rm = FALSE 432s rowMads(): 432s colMads(): 432s na.rm = FALSE 432s rowMads(): 432s colMads(): 432s na.rm = TRUE 432s rowMads(): 432s colMads(): 432s na.rm = TRUE 432s rowMads(): 432s colMads(): 432s > 432s > 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # All NAs 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 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 + tx <- t(x) 432s + # Row/column ranges 432s + for (na.rm in c(FALSE, TRUE)) { 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + cat("na.rm = ", na.rm, "\n", sep = "") 432s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 432s + if (na.rm) r0[is.na(r0)] <- NaN 432s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 432s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r2, r0)) 432s + stopifnot(all.equal(r1, r2)) 432s + } 432s + } 432s + } 432s na.rm = FALSE 432s na.rm = FALSE 432s na.rm = TRUE 432s na.rm = TRUE 432s na.rm = FALSE 432s na.rm = FALSE 432s na.rm = TRUE 432s na.rm = TRUE 432s > tx <- NULL 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # A 1x1 matrix 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > x <- matrix(0, nrow = 1L, ncol = 1L) 432s > dimnames <- list("a", "A") 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 + tx <- t(x) 432s + # Row/column ranges 432s + for (na.rm in c(FALSE, TRUE)) { 432s + # Check names attribute 432s + for (useNames in c(TRUE, FALSE)) { 432s + cat("na.rm = ", na.rm, "\n", sep = "") 432s + r0 <- rowMads_R(x, na.rm = na.rm, useNames = useNames) 432s + r1 <- rowMads(x, na.rm = na.rm, useNames = useNames) 432s + r2 <- colMads(tx, na.rm = na.rm, useNames = useNames) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r2, r0)) 432s + stopifnot(all.equal(r1, r2)) 432s + } 432s + } 432s + } 432s na.rm = FALSE 432s na.rm = FALSE 432s na.rm = TRUE 432s na.rm = TRUE 432s na.rm = FALSE 432s na.rm = FALSE 432s na.rm = TRUE 432s na.rm = TRUE 432s > 432s > 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > # A 0x0 matrix 432s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 432s > x <- matrix(double(0), nrow = 0, ncol = 0) 432s > tx <- t(x) 432s > for (na.rm in c(FALSE, TRUE)) { 432s + cat("na.rm = ", na.rm, "\n", sep = "") 432s + r0 <- rowMads_R(x, na.rm = na.rm) 432s + r1 <- rowMads(x, na.rm = na.rm) 432s + r2 <- colMads(tx, na.rm = na.rm) 432s + stopifnot(all.equal(r1, r2)) 432s + stopifnot(all.equal(r1, r0)) 432s + stopifnot(all.equal(r2, r0)) 432s + } 432s na.rm = FALSE 432s na.rm = TRUE 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: arm-unknown-linux-gnueabihf (32-bit) 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 433s > library("matrixStats") 433s > 433s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 433s > options(matrixStats.center.onUse = "ignore") 433s > 433s > rowMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 433s + suppressWarnings({ 433s + res <- apply(x, MARGIN = 1L, FUN = mad, na.rm = na.rm) 433s + }) 433s + if (!useNames) names(res) <- NULL 433s + res 433s + } 433s > 433s > colMads_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 433s + suppressWarnings({ 433s + res <- apply(x, MARGIN = 2L, FUN = mad, na.rm = na.rm) 433s + }) 433s + if (!useNames) names(res) <- NULL 433s + res 433s + } 433s > 433s > rowMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 433s + center <- rowMedians(x, cols = cols, na.rm = na.rm, useNames = FALSE) 433s + rowMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 433s + } 433s > 433s > colMads_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 433s + center <- colMedians(x, rows = rows, na.rm = na.rm, useNames = FALSE) 433s + colMads(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 433s + } 433s > 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 + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 433s + useNames <- c(TRUE, FALSE) 433s + useNames <- useNames[count %% length(useNames) + 1] 433s + 433s + validateIndicesTestMatrix(x, rows, cols, 433s + ftest = rowMads, fsure = rowMads_R, 433s + na.rm = na.rm, useNames = useNames) 433s + validateIndicesTestMatrix(x, rows, cols, 433s + ftest = rowMads_center, fsure = rowMads_R, 433s + na.rm = na.rm, useNames = useNames) 433s + 433s + validateIndicesTestMatrix(x, rows, cols, 433s + fcoltest = colMads, fsure = rowMads_R, 433s + na.rm = na.rm, useNames = useNames) 433s + validateIndicesTestMatrix(x, rows, cols, 433s + fcoltest = colMads_center, fsure = rowMads_R, 433s + na.rm = na.rm, 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: arm-unknown-linux-gnueabihf (32-bit) 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 434s > library("matrixStats") 434s > 434s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 434s + res <- rowMeans(x, na.rm = na.rm) 434s + if (!useNames) names(res) <- NULL 434s + res 434s + } 434s > 434s > colMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 434s + res <- colMeans(x, na.rm = na.rm) 434s + if (!useNames) names(res) <- NULL 434s + res 434s + } 434s > 434s > for (mode in c("integer", "logical", "double")) { 434s + x <- matrix(-4:4, nrow = 3, ncol = 3) 434s + storage.mode(x) <- mode 434s + if (mode == "double") x <- x + 0.1 434s + 434s + # To check names attribute 434s + dimnames <- list(letters[1:3], LETTERS[1:3]) 434s + 434s + # Test with and without dimnames on x 434s + for (setDimnames in c(TRUE, FALSE)) { 434s + if (setDimnames) dimnames(x) <- dimnames 434s + else dimnames(x) <- NULL 434s + # Check names attribute 434s + for (useNames in c(TRUE, FALSE)) { 434s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + 434s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + } 434s + } 434s + } 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Special case: Single-element matrix 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > cat("Special case: Single-element matrix:\n") 434s Special case: Single-element matrix: 434s > for (mode in c("integer", "logical", "double")) { 434s + x <- matrix(1, nrow = 1, ncol = 1) 434s + storage.mode(x) <- mode 434s + 434s + # To check names attribute 434s + dimnames <- list("a", "A") 434s + 434s + # Test with and without dimnames on x 434s + for (setDimnames in c(TRUE, FALSE)) { 434s + if (setDimnames) dimnames(x) <- dimnames 434s + else dimnames(x) <- NULL 434s + # Check names attribute 434s + for (useNames in c(TRUE, FALSE)) { 434s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + 434s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + } 434s + } 434s + } 434s > 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Special case: Empty matrix 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > cat("Special case: Empty matrix:\n") 434s Special case: Empty matrix: 434s > for (mode in c("integer", "logical", "double")) { 434s + x <- matrix(integer(0), nrow = 0, ncol = 0) 434s + storage.mode(x) <- mode 434s + 434s + y0 <- rowMeans(x, na.rm = FALSE) 434s + y1 <- rowMeans2(x, na.rm = FALSE) 434s + stopifnot(all.equal(y1, y0)) 434s + 434s + y0 <- colMeans(x, na.rm = FALSE) 434s + y1 <- colMeans2(x, na.rm = FALSE) 434s + stopifnot(all.equal(y1, y0)) 434s + } 434s > 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Special case: All NAs 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > cat("Special case: All NAs:\n") 434s Special case: All NAs: 434s > for (mode in c("integer", "logical", "double")) { 434s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 434s + storage.mode(x) <- mode 434s + 434s + # To check names attribute 434s + dimnames <- list(letters[1:3], LETTERS[1:3]) 434s + 434s + # Test with and without dimnames on x 434s + for (setDimnames in c(TRUE, FALSE)) { 434s + if (setDimnames) dimnames(x) <- dimnames 434s + else dimnames(x) <- NULL 434s + # Check names attribute 434s + for (useNames in c(TRUE, FALSE)) { 434s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 434s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + 434s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 434s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + } 434s + } 434s + } 434s > 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Special case: All NaNs 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > cat("Special case: All NaNs:\n") 434s Special case: All NaNs: 434s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 434s > 434s > # Test with and without dimnames on x 434s > for (setDimnames in c(TRUE, FALSE)) { 434s + if (setDimnames) dimnames(x) <- dimnames 434s + else dimnames(x) <- NULL 434s + # Check names attribute 434s + for (useNames in c(TRUE, FALSE)) { 434s + y0 <- rowMeans_R(x, na.rm = TRUE, useNames = useNames) 434s + y1 <- rowMeans2(x, na.rm = TRUE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + 434s + y0 <- colMeans_R(x, na.rm = TRUE, useNames = useNames) 434s + y1 <- colMeans2(x, na.rm = TRUE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + } 434s + } 434s > 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Special case: All Infs 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > cat("Special case: All Infs:\n") 434s Special case: All Infs: 434s > x <- matrix(Inf, nrow = 3, ncol = 3) 434s > 434s > # Test with and without dimnames on x 434s > for (setDimnames in c(TRUE, FALSE)) { 434s + if (setDimnames) dimnames(x) <- dimnames 434s + else dimnames(x) <- NULL 434s + # Check names attribute 434s + for (useNames in c(TRUE, FALSE)) { 434s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + 434s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + } 434s + } 434s > 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Special case: All -Infs 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > cat("Special case: All -Infs:\n") 434s Special case: All -Infs: 434s > x <- matrix(-Inf, nrow = 3, ncol = 3) 434s > 434s > # Test with and without dimnames on x 434s > for (setDimnames in c(TRUE, FALSE)) { 434s + if (setDimnames) dimnames(x) <- dimnames 434s + else dimnames(x) <- NULL 434s + # Check names attribute 434s + for (useNames in c(TRUE, FALSE)) { 434s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + 434s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + } 434s + } 434s > 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Special case: Infs and -Infs 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > cat("Special case: Infs and -Infs:\n") 434s Special case: Infs and -Infs: 434s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 434s > 434s > # To check names attribute 434s > dimnames <- list(letters[1:4], LETTERS[1:4]) 434s > 434s > # Test with and without dimnames on x 434s > for (setDimnames in c(TRUE, FALSE)) { 434s + if (setDimnames) dimnames(x) <- dimnames 434s + else dimnames(x) <- NULL 434s + # Check names attribute 434s + for (useNames in c(TRUE, FALSE)) { 434s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + 434s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + } 434s + } 434s > 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Special case: NaNs and NAs 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > cat("Special case: NaNs and NAs:\n") 434s Special case: NaNs and NAs: 434s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 434s > 434s > # Test with and without dimnames on x 434s > for (setDimnames in c(TRUE, FALSE)) { 434s + if (setDimnames) dimnames(x) <- dimnames 434s + else dimnames(x) <- NULL 434s + # Check names attribute 434s + for (useNames in c(TRUE, FALSE)) { 434s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + str(y0) 434s + stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 434s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 434s + str(y1) 434s + stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 434s + stopifnot(all.equal(y1, y0)) 434s + 434s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 434s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 434s + stopifnot(all.equal(y1, y0)) 434s + } 434s + } 434s Named num [1:4] NaN NA NaN NA 434s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 434s Named num [1:4] NaN NA NaN NA 434s - attr(*, "names")= chr [1:4] "a" "b" "c" "d" 434s num [1:4] NaN NA NaN NA 434s num [1:4] NaN NA NaN NA 434s num [1:4] NaN NA NaN NA 434s num [1:4] NaN NA NaN NA 434s num [1:4] NaN NA NaN NA 434s num [1:4] NaN NA NaN NA 434s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 434s > ## returned here (as one would expect). NaN might very well be returned, 434s > ## when both NA and NaN are involved. This is an accepted feature in R, 434s > ## which is documented in help("is.nan"). See also 434s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 434s > ## Thus, we cannot guarantee that y1 is identical to y0. 434s > 434s > 434s > 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Special case: Integer overflow with ties 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > cat("Special case: Integer overflow with ties:\n") 434s Special case: Integer overflow with ties: 434s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 434s > 434s > # Test with and without dimnames on x 434s > for (setDimnames in c(TRUE, FALSE)) { 434s + if (setDimnames) dimnames(x) <- dimnames 434s + else dimnames(x) <- NULL 434s + # Check names attribute 434s + for (useNames in c(TRUE, FALSE)) { 434s + y0 <- rowMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- rowMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + 434s + y0 <- colMeans_R(x, na.rm = FALSE, useNames = useNames) 434s + y1 <- colMeans2(x, na.rm = FALSE, useNames = useNames) 434s + stopifnot(all.equal(y1, y0)) 434s + } 434s + } 434s > 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Consistency checks 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > set.seed(1) 434s > 434s > cat("Consistency checks:\n") 434s Consistency checks: 434s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 434s > for (kk in seq_len(n_sims)) { 434s + cat("Random test #", kk, "\n", sep = "") 434s + 434s + # Simulate data in a matrix of any shape 434s + dim <- sample(50:200, size = 2) 434s + n <- prod(dim) 434s + x <- rnorm(n, sd = 100) 434s + dim(x) <- dim 434s + 434s + # Add NAs? 434s + if ((kk %% 4) %in% c(3, 0)) { 434s + cat("Adding NAs\n") 434s + nna <- sample(n, size = 1) 434s + na_values <- c(NA_real_, NaN) 434s + t <- sample(na_values, size = nna, replace = TRUE) 434s + x[sample(length(x), size = nna)] <- t 434s + } 434s + 434s + # Mode? 434s + modes <- "double" 434s + if ((kk %% 4) %in% c(2, 0)) { 434s + modes <- c("integer", "logical") 434s + } 434s + 434s + for (mode in modes) { 434s + if (mode != "double") { 434s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 434s + storage.mode(x) <- mode 434s + } 434s + 434s + na.rm <- sample(c(TRUE, FALSE), size = 1) 434s + 434s + # rowMeans2(): 434s + y0 <- rowMeans(x, na.rm = na.rm) 434s + y1 <- rowMeans2(x, na.rm = na.rm) 434s + stopifnot(all.equal(y1, y0)) 434s + y2 <- colMeans2(t(x), na.rm = na.rm) 434s + stopifnot(all.equal(y2, y0)) 434s + 434s + # colMeans2(): 434s + y0 <- colMeans(x, na.rm = na.rm) 434s + y1 <- colMeans2(x, na.rm = na.rm) 434s + stopifnot(all.equal(y1, y0)) 434s + y2 <- rowMeans2(t(x), na.rm = na.rm) 434s + stopifnot(all.equal(y2, y0)) 434s + } 434s + } # for (kk ...) 434s Random test #1 434s Random test #2 434s Coercing from double to integer 434s Coercing from integer to logical 434s Random test #3 434s Adding NAs 434s Random test #4 434s Adding NAs 434s Coercing from double to integer 434s Coercing from integer to logical 434s Random test #5 434s Random test #6 434s Coercing from double to integer 434s Coercing from integer to logical 434s Random test #7 434s Adding NAs 434s Random test #8 434s Adding NAs 434s Coercing from double to integer 434s Coercing from integer to logical 434s Random test #9 434s Random test #10 434s Coercing from double to integer 434s Coercing from integer to logical 434s Random test #11 434s Adding NAs 434s Random test #12 434s Adding NAs 434s Coercing from double to integer 434s Coercing from integer to logical 434s Random test #13 434s Random test #14 434s Coercing from double to integer 434s Coercing from integer to logical 434s Random test #15 434s Adding NAs 434s Random test #16 434s Adding NAs 434s Coercing from double to integer 434s Coercing from integer to logical 434s Random test #17 434s Random test #18 434s Coercing from double to integer 434s Coercing from integer to logical 434s Random test #19 434s Adding NAs 434s Random test #20 434s Adding NAs 434s Coercing from double to integer 434s Coercing from integer to logical 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: arm-unknown-linux-gnueabihf (32-bit) 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 434s > library("matrixStats") 434s > 434s > rowMeans_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 434s + res <- rowMeans(x, na.rm = na.rm) 434s + if (!useNames) names(res) <- NULL 434s + res 434s + } 434s > 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > # Subsetted tests 434s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 434s > source("utils/validateIndicesFramework.R") 434s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 434s > storage.mode(x) <- "integer" 434s > 434s > # To check names attribute 434s > dimnames <- list(letters[1:6], LETTERS[1:6]) 434s > 434s > # Test with and without dimnames on x 434s > for (setDimnames in c(TRUE, FALSE)) { 434s + if (setDimnames) dimnames(x) <- dimnames 434s + else dimnames(x) <- NULL 434s + 434s + count <- 0L 434s + for (rows in index_cases) { 434s + for (cols in index_cases) { 434s + count <- count + 1L 434s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 434s + useNames <- c(TRUE, FALSE) 434s + useNames <- useNames[count %% length(useNames) + 1] 434s + 434s + validateIndicesTestMatrix(x, rows, cols, 434s + ftest = rowMeans2, fsure = rowMeans_R, 434s + na.rm = na.rm, useNames = useNames) 434s + validateIndicesTestMatrix(x, rows, cols, 434s + fcoltest = colMeans2, fsure = rowMeans_R, 434s + na.rm = na.rm, useNames = useNames) 434s + } 434s + } 434s + } 434s > 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: arm-unknown-linux-gnueabihf (32-bit) 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 > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 435s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 435s + if (!useNames) names(res) <- NULL 435s + res 435s + } 435s > 435s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 435s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 435s + if (!useNames) names(res) <- NULL 435s + res 435s + } 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Special case: Non-ties 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > cat("Special case: Non-ties:\n") 435s Special case: Non-ties: 435s > for (mode in c("integer", "double")) { 435s + x <- matrix(1:9 + 0.1, nrow = 3, ncol = 3) 435s + storage.mode(x) <- mode 435s + 435s + # To check names attribute 435s + dimnames <- list(letters[1:3], LETTERS[1:3]) 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 + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + 435s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + } 435s + } 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Special case: Ties 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > cat("Special case: Ties:\n") 435s Special case: Ties: 435s > for (mode in c("integer", "double")) { 435s + x <- matrix(1:16 + 0.1, nrow = 4, ncol = 4) 435s + storage.mode(x) <- mode 435s + 435s + # To check names attribute 435s + dimnames <- list(letters[1:4], LETTERS[1:4]) 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 + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + 435s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + } 435s + } 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Special case: Single-element matrix 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > cat("Special case: Single-element matrix:\n") 435s Special case: Single-element matrix: 435s > for (mode in c("integer", "double")) { 435s + x <- matrix(1, nrow = 1, ncol = 1) 435s + storage.mode(x) <- mode 435s + 435s + # To check names attribute 435s + dimnames <- list("a", "A") 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 + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + 435s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + } 435s + } 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Special case: Empty matrix 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > cat("Special case: Empty matrix:\n") 435s Special case: Empty matrix: 435s > for (mode in c("integer", "double")) { 435s + x <- matrix(integer(0), nrow = 0, ncol = 0) 435s + storage.mode(x) <- mode 435s + 435s + y0 <- rowMedians_R(x, na.rm = FALSE) 435s + y1 <- rowMedians(x, na.rm = FALSE) 435s + stopifnot(all.equal(y1, y0)) 435s + 435s + y0 <- colMedians_R(x, na.rm = FALSE) 435s + y1 <- colMedians(x, na.rm = FALSE) 435s + stopifnot(all.equal(y1, y0)) 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Special case: All NAs 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > cat("Special case: All NAs:\n") 435s Special case: All NAs: 435s > for (mode in c("integer", "double")) { 435s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 435s + storage.mode(x) <- mode 435s + 435s + # To check names attribute 435s + dimnames <- list(letters[1:3], LETTERS[1:3]) 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 + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 435s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + 435s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 435s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + } 435s + } 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Special case: All NaNs 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > cat("Special case: All NaNs:\n") 435s Special case: All NaNs: 435s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 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 + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + y0 <- rowMedians_R(x, na.rm = TRUE, useNames = useNames) 435s + y1 <- rowMedians(x, na.rm = TRUE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + 435s + y0 <- colMedians_R(x, na.rm = TRUE, useNames = useNames) 435s + y1 <- colMedians(x, na.rm = TRUE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + } 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Special case: All Infs 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > cat("Special case: All Infs:\n") 435s Special case: All Infs: 435s > x <- matrix(Inf, nrow = 3, ncol = 3) 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 + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + 435s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + } 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Special case: All -Infs 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > cat("Special case: All -Infs:\n") 435s Special case: All -Infs: 435s > x <- matrix(-Inf, nrow = 3, ncol = 3) 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 + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + 435s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + } 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Special case: Infs and -Infs 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > cat("Special case: Infs and -Infs:\n") 435s Special case: Infs and -Infs: 435s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 435s > 435s > # To check names attribute 435s > dimnames <- list(letters[1:4], LETTERS[1:4]) 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 + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + 435s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + } 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Special case: Integer overflow with ties 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > cat("Special case: Integer overflow with ties:\n") 435s Special case: Integer overflow with ties: 435s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 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 + # Check names attribute 435s + for (useNames in c(TRUE, FALSE)) { 435s + y0 <- rowMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- rowMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + 435s + y0 <- colMedians_R(x, na.rm = FALSE, useNames = useNames) 435s + y1 <- colMedians(x, na.rm = FALSE, useNames = useNames) 435s + stopifnot(all.equal(y1, y0)) 435s + } 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Consistency checks 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > set.seed(1) 435s > 435s > cat("Consistency checks:\n") 435s Consistency checks: 435s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 435s > for (kk in seq_len(n_sims)) { 435s + cat("Random test #", kk, "\n", sep = "") 435s + 435s + # Simulate data in a matrix of any shape 435s + dim <- sample(50:200, size = 2) 435s + n <- prod(dim) 435s + x <- rnorm(n, sd = 100) 435s + dim(x) <- dim 435s + 435s + # Add NAs? 435s + if ((kk %% 4) %in% c(3, 0)) { 435s + cat("Adding NAs\n") 435s + nna <- sample(n, size = 1) 435s + na_values <- c(NA_real_, NaN) 435s + t <- sample(na_values, size = nna, replace = TRUE) 435s + x[sample(length(x), size = nna)] <- t 435s + } 435s + 435s + # Integer or double? 435s + if ((kk %% 4) %in% c(2, 0)) { 435s + cat("Coercing to integers\n") 435s + storage.mode(x) <- "integer" 435s + } 435s + 435s + na.rm <- sample(c(TRUE, FALSE), size = 1) 435s + 435s + # rowMedians(): 435s + y0 <- rowMedians_R(x, na.rm = na.rm) 435s + y1 <- rowMedians(x, na.rm = na.rm) 435s + stopifnot(all.equal(y1, y0)) 435s + y2 <- colMedians(t(x), na.rm = na.rm) 435s + stopifnot(all.equal(y2, y0)) 435s + 435s + # colMedians(): 435s + y0 <- colMedians_R(x, na.rm = na.rm) 435s + y1 <- colMedians(x, na.rm = na.rm) 435s + stopifnot(all.equal(y1, y0)) 435s + y2 <- rowMedians(t(x), na.rm = na.rm) 435s + stopifnot(all.equal(y2, y0)) 435s + } # for (kk ...) 435s Random test #1 435s Random test #2 435s Coercing to integers 435s Random test #3 435s Adding NAs 435s Random test #4 435s Adding NAs 435s Coercing to integers 435s Random test #5 435s Random test #6 435s Coercing to integers 435s Random test #7 435s Adding NAs 435s Random test #8 435s Adding NAs 435s Coercing to integers 435s Random test #9 435s Random test #10 435s Coercing to integers 435s Random test #11 435s Adding NAs 435s Random test #12 435s Adding NAs 435s Coercing to integers 435s Random test #13 435s Random test #14 435s Coercing to integers 435s Random test #15 435s Adding NAs 435s Random test #16 435s Adding NAs 435s Coercing to integers 435s Random test #17 435s Random test #18 435s Coercing to integers 435s Random test #19 435s Adding NAs 435s Random test #20 435s Adding NAs 435s Coercing to integers 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: arm-unknown-linux-gnueabihf (32-bit) 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 > rowMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 435s + res <- apply(x, MARGIN = 1L, FUN = median, na.rm = na.rm) 435s + if (!useNames) names(res) <- NULL 435s + res 435s + } 435s > 435s > colMedians_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 435s + res <- apply(x, MARGIN = 2L, FUN = median, na.rm = na.rm) 435s + if (!useNames) names(res) <- NULL 435s + res 435s + } 435s > 435s > 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > # Subsetted tests 435s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 435s > source("utils/validateIndicesFramework.R") 435s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 435s > storage.mode(x) <- "integer" 435s > 435s > # To check names attribute 435s > dimnames <- list(letters[1:6], LETTERS[1:6]) 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 (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 + 435s + validateIndicesTestMatrix(x, rows, cols, 435s + ftest = rowMedians, fsure = rowMedians_R, 435s + na.rm = na.rm, useNames = useNames) 435s + validateIndicesTestMatrix(x, rows, cols, 435s + fcoltest = colMedians, fsure = rowMedians_R, 435s + na.rm = na.rm, useNames = useNames) 435s + } 435s + } 435s + } 436s > 436s 436s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 436s Copyright (C) 2025 The R Foundation for Statistical Computing 436s Platform: arm-unknown-linux-gnueabihf (32-bit) 436s 436s R is free software and comes with ABSOLUTELY NO WARRANTY. 436s You are welcome to redistribute it under certain conditions. 436s Type 'license()' or 'licence()' for distribution details. 436s 436s R is a collaborative project with many contributors. 436s Type 'contributors()' for more information and 436s 'citation()' on how to cite R or R packages in publications. 436s 436s Type 'demo()' for some demos, 'help()' for on-line help, or 436s 'help.start()' for an HTML browser interface to help. 436s Type 'q()' to quit R. 436s 436s > library("matrixStats") 436s > library("stats") 436s > 436s > asWhich <- function(probs, max) { 436s + idx <- as.integer(round(probs * max)) 436s + if (idx < 1L) { 436s + idx <- 1L 436s + } else if (idx > max) { 436s + idx <- max 436s + } 436s + idx 436s + } # asWhich() 436s > 436s > rowOrderStats_R <- function(x, probs, ..., useNames = TRUE) { 436s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 436s + 436s + # Remove Attributes 436s + if (!useNames || length(ans) == 0L) attributes(ans) <- NULL 436s + ans 436s + } # rowOrderStats_R() 436s > 436s > 436s > set.seed(1) 436s > 436s > 436s > # Simulate data in a matrix of any shape 436s > nrow <- 60L 436s > ncol <- 30L 436s > x <- rnorm(nrow * ncol) 436s > dim(x) <- c(nrow, ncol) 436s > probs <- 0.3 436s > which <- asWhich(probs, max = ncol) 436s > 436s > y0 <- rowOrderStats_R(x, probs = probs) 436s > y1 <- rowOrderStats(x, which = which) 436s > stopifnot(all.equal(y1, y0)) 436s > y2 <- colOrderStats(t(x), which = which) 436s > stopifnot(all.equal(y2, y0)) 436s > 436s > 436s > 436s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 436s > # Consistency checks 436s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 436s > for (mode in c("integer", "double")) { 436s + cat("Consistency checks without NAs:\n") 436s + for (kk in 1:3) { 436s + cat("Random test #", kk, "\n", sep = "") 436s + 436s + # Simulate data in a matrix of any shape 436s + nrow <- sample(20L, size = 1L) 436s + ncol <- sample(20L, size = 1L) 436s + x <- rnorm(nrow * ncol) 436s + dim(x) <- c(nrow, ncol) 436s + 436s + cat("mode: ", mode, "\n", sep = "") 436s + storage.mode(x) <- mode 436s + str(x) 436s + 436s + probs <- runif(1) 436s + which <- asWhich(probs, max = ncol) 436s + 436s + y0 <- rowOrderStats_R(x, probs = probs) 436s + y1 <- rowOrderStats(x, which = which) 436s + stopifnot(all.equal(y1, y0)) 436s + y2 <- colOrderStats(t(x), which = which) 436s + stopifnot(all.equal(y2, y0)) 436s + } # for (kk in ...) 436s + } # for (mode ...) 436s Consistency checks without NAs: 436s Random test #1 436s mode: integer 436s int [1:14, 1:6] 0 0 1 0 2 -1 1 0 0 0 ... 436s Random test #2 436s mode: integer 436s int [1:8, 1:13] 0 0 1 -2 0 0 0 0 1 0 ... 436s Random test #3 436s mode: integer 436s int [1:20, 1:17] 0 0 0 0 1 0 1 0 0 -1 ... 436s Consistency checks without NAs: 436s Random test #1 436s mode: double 436s num [1:9, 1:5] -1.4286 -0.00386 -0.70456 -0.29242 -0.49607 ... 436s Random test #2 436s mode: double 436s num [1:11, 1:20] -0.796 0.482 -0.952 0.5 1.242 ... 436s Random test #3 436s mode: double 436s num [1:7, 1:18] 1.553 -2.405 0.167 -0.403 -1.746 ... 436s > 436s > 436s > # Check names attribute 436s > x <- matrix(1:9 + 0.1, nrow = 3L, ncol = 3L) 436s > 436s > probs <- runif(1) 436s > which <- asWhich(probs, max = ncol(x)) 436s > 436s > dimnames <- list(letters[1:3], LETTERS[1:3]) 436s > 436s > # Test with and without dimnames on x 436s > for (setDimnames in c(TRUE, FALSE)) { 436s + if (setDimnames) dimnames(x) <- dimnames 436s + else dimnames(x) <- NULL 436s + # Check names attribute 436s + for (useNames in c(TRUE, FALSE)) { 436s + y0 <- rowOrderStats_R(x, probs = probs, useNames = useNames) 436s + y1 <- rowOrderStats(x, which = which, useNames = useNames) 436s + stopifnot(all.equal(y1, y0)) 436s + y2 <- colOrderStats(t(x), which = which, useNames = useNames) 436s + stopifnot(all.equal(y2, y0)) 436s + } 436s + } 436s > 436s 436s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 436s Copyright (C) 2025 The R Foundation for Statistical Computing 436s Platform: arm-unknown-linux-gnueabihf (32-bit) 436s 436s R is free software and comes with ABSOLUTELY NO WARRANTY. 436s You are welcome to redistribute it under certain conditions. 436s Type 'license()' or 'licence()' for distribution details. 436s 436s R is a collaborative project with many contributors. 436s Type 'contributors()' for more information and 436s 'citation()' on how to cite R or R packages in publications. 436s 436s Type 'demo()' for some demos, 'help()' for on-line help, or 436s 'help.start()' for an HTML browser interface to help. 436s Type 'q()' to quit R. 436s 436s > library("matrixStats") 436s > 436s > rowOrderStats_R <- function(x, probs, ..., useNames = TRUE) { 436s + ans <- apply(x, MARGIN = 1L, FUN = quantile, probs = probs, type = 3L) 436s + 436s + # Remove Attributes 436s + if (!useNames || length(ans) == 0L) attributes(ans) <- NULL 436s + ans 436s + } # rowOrderStats_R() 436s > 436s > 436s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 436s > # Subsetted tests 436s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 436s > source("utils/validateIndicesFramework.R") 436s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 436s > storage.mode(x) <- "integer" 436s > 436s > # To check names attribute 436s > dimnames <- list(letters[1:6], LETTERS[1:6]) 436s > 436s > probs <- 0.3 436s > # Test with and without dimnames on x 436s > for (setDimnames in c(TRUE, FALSE)) { 436s + if (setDimnames) dimnames(x) <- dimnames 436s + else dimnames(x) <- NULL 436s + for (rows in index_cases) { 436s + for (cols in index_cases) { 436s + # Check names attribute 436s + for (useNames in c(TRUE, FALSE)) { 436s + if (is.null(cols)) which <- round(probs * ncol(x)) 436s + else { 436s + xxrows <- rows 436s + suppressWarnings({ 436s + xx <- tryCatch(x[, cols, drop = FALSE], error = function(c) "error") 436s + if (identical(xx, "error")) which <- 0L 436s + else which <- round(probs * ncol(xx)) 436s + }) 436s + } 436s + if (which == 0L) next 436s + 436s + validateIndicesTestMatrix(x, rows, cols, 436s + ftest = rowOrderStats, fsure = rowOrderStats_R, 436s + which = which, probs = probs, useNames = useNames) 436s + validateIndicesTestMatrix(x, rows, cols, 436s + fcoltest = colOrderStats, fsure = rowOrderStats_R, 436s + which = which, probs = probs, useNames = useNames) 436s + } 436s + } 436s + } 436s + } 437s > 437s 437s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 437s Copyright (C) 2025 The R Foundation for Statistical Computing 437s Platform: arm-unknown-linux-gnueabihf (32-bit) 437s 437s R is free software and comes with ABSOLUTELY NO WARRANTY. 437s You are welcome to redistribute it under certain conditions. 437s Type 'license()' or 'licence()' for distribution details. 437s 437s R is a collaborative project with many contributors. 437s Type 'contributors()' for more information and 437s 'citation()' on how to cite R or R packages in publications. 437s 437s Type 'demo()' for some demos, 'help()' for on-line help, or 437s 'help.start()' for an HTML browser interface to help. 437s Type 'q()' to quit R. 437s 437s > library("matrixStats") 437s > 437s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = TRUE) { 437s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 437s + if (!useNames) names(res) <- NULL 437s + res 437s + } 437s > 437s > all.equal.na <- function(target, current, ...) { 437s + # Computations involving NaN may return NaN or NA, cf. ?is.nan 437s + current[is.nan(current)] <- NA_real_ 437s + target[is.nan(target)] <- NA_real_ 437s + all.equal(target, current, ...) 437s + } 437s > 437s > for (mode in c("integer", "double")) { 437s + # Missing values 437s + x <- matrix(c(1, NA, NaN, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 437s + cat("mode: ", mode, "\n", sep = "") 437s + storage.mode(x) <- mode 437s + str(x) 437s + 437s + # To check names attribute 437s + dimnames <- list(letters[1:4], LETTERS[1:2]) 437s + 437s + # Test with and without dimnames on x 437s + for (setDimnames in c(TRUE, FALSE)) { 437s + if (setDimnames) dimnames(x) <- dimnames 437s + else dimnames(x) <- NULL 437s + # Check names attribute 437s + for (useNames in c(TRUE, FALSE)) { 437s + y0 <- rowProds_R(x, na.rm = TRUE, useNames = useNames) 437s + print(y0) 437s + y1 <- rowProds(x, na.rm = TRUE, useNames = useNames) 437s + print(y1) 437s + y2 <- colProds(t(x), na.rm = TRUE, useNames = useNames) 437s + print(y2) 437s + stopifnot(all.equal(y1, y0)) 437s + stopifnot(all.equal(y2, y1)) 437s + 437s + # Missing values 437s + y0 <- rowProds_R(x, na.rm = FALSE, useNames = useNames) 437s + print(y0) 437s + y1 <- rowProds(x, na.rm = FALSE, useNames = useNames) 437s + print(y1) 437s + y2 <- colProds(t(x), na.rm = FALSE, useNames = useNames) 437s + print(y2) 437s + stopifnot(all.equal(y1, y0)) 437s + stopifnot(all.equal(y2, y1)) 437s + 437s + # "Empty" rows 437s + y0 <- rowProds_R(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 437s + print(y0) 437s + y1 <- rowProds(x[integer(0), , drop = FALSE], na.rm = FALSE, useNames = useNames) 437s + print(y1) 437s + y2 <- colProds(t(x[integer(0), , drop = FALSE]), na.rm = FALSE, useNames = useNames) 437s + print(y2) 437s + stopifnot(all.equal.na(y1, y0)) 437s + stopifnot(all.equal(y2, y1)) 437s + stopifnot(length(y1) == 0L) 437s + 437s + # Using product() 437s + y1 <- rowProds(x, method = "expSumLog", na.rm = FALSE, useNames = useNames) 437s + print(y1) 437s + y2 <- colProds(t(x), method = "expSumLog", na.rm = FALSE, useNames = useNames) 437s + print(y2) 437s + stopifnot(all.equal(y2, y1)) 437s + } 437s + } 437s + } # for (mode ...) 437s mode: integer 437s int [1:4, 1:2] 1 NA NA 1 1 0 1 0 437s a b c d 437s 1 0 1 0 437s a b c d 437s 1 0 1 0 437s a b c d 437s 1 0 1 0 437s a b c d 437s 1 NA NA 0 437s a b c d 437s 1 NA NA 0 437s a b c d 437s 1 NA NA 0 437s numeric(0) 437s numeric(0) 437s numeric(0) 437s a b c d 437s 1 NA NA 0 437s a b c d 437s 1 NA NA 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s numeric(0) 437s numeric(0) 437s numeric(0) 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s numeric(0) 437s numeric(0) 437s numeric(0) 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s numeric(0) 437s numeric(0) 437s numeric(0) 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s mode: double 437s num [1:4, 1:2] 1 NA NaN 1 1 0 1 0 437s a b c d 437s 1 0 1 0 437s a b c d 437s 1 0 1 0 437s a b c d 437s 1 0 1 0 437s a b c d 437s 1 NA NaN 0 437s a b c d 437s 1 NA NaN 0 437s a b c d 437s 1 NA NaN 0 437s numeric(0) 437s numeric(0) 437s numeric(0) 437s a b c d 437s 1 NA NA 0 437s a b c d 437s 1 NA NA 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 NA NaN 0 437s [1] 1 NA NaN 0 437s [1] 1 NA NaN 0 437s numeric(0) 437s numeric(0) 437s numeric(0) 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 NA NaN 0 437s [1] 1 NA NaN 0 437s [1] 1 NA NaN 0 437s numeric(0) 437s numeric(0) 437s numeric(0) 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 0 1 0 437s [1] 1 NA NaN 0 437s [1] 1 NA NaN 0 437s [1] 1 NA NaN 0 437s numeric(0) 437s numeric(0) 437s numeric(0) 437s [1] 1 NA NA 0 437s [1] 1 NA NA 0 437s > 437s > 437s > # Bug report 2012-06-25 437s > x <- matrix(c(1, 1, 1, 1, 1, 0, 1, 0), nrow = 4, ncol = 2) 437s > y0 <- rowProds_R(x) 437s > print(y0) 437s [1] 1 0 1 0 437s > y1 <- rowProds(x) 437s > print(y1) 437s [1] 1 0 1 0 437s > y2 <- colProds(t(x)) 437s > print(y2) 437s [1] 1 0 1 0 437s > stopifnot(all.equal.na(y1, y0)) 437s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 437s > stopifnot(all.equal.na(y2, y1)) 437s > # Check names attribute 437s > dimnames(x) <- dimnames 437s > y0 <- rowProds_R(x, useNames = TRUE) 437s > print(y0) 437s a b c d 437s 1 0 1 0 437s > y1 <- rowProds(x, useNames = TRUE) 437s > print(y1) 437s a b c d 437s 1 0 1 0 437s > y2 <- colProds(t(x), useNames = TRUE) 437s > print(y2) 437s a b c d 437s 1 0 1 0 437s > stopifnot(all.equal.na(y1, y0)) 437s > stopifnot(all.equal.na(y1, x[, 1] * x[, 2])) 437s > stopifnot(all.equal.na(y2, y1)) 437s > 437s > # Bug report 2014-03-25 ("all rows contains a zero") 437s > x <- matrix(c(0, 1, 1, 0), nrow = 2, ncol = 2) 437s > # To check names attribute 437s > dimnames <- list(letters[1:2], LETTERS[1:2]) 437s > y0 <- rowProds_R(x) 437s > print(y0) 437s [1] 0 0 437s > y1 <- rowProds(x) 437s > print(y1) 437s [1] 0 0 437s > y2 <- colProds(t(x)) 437s > print(y2) 437s [1] 0 0 437s > stopifnot(all.equal.na(y1, y0)) 437s > stopifnot(all.equal.na(y1, c(0, 0))) 437s > stopifnot(all.equal.na(y2, y1)) 437s > # Check names attribute 437s > dimnames(x) <- dimnames 437s > y0 <- rowProds_R(x, useNames = TRUE) 437s > print(y0) 437s a b 437s 0 0 437s > y1 <- rowProds(x, useNames = TRUE) 437s > print(y1) 437s a b 437s 0 0 437s > y2 <- colProds(t(x), useNames = TRUE) 437s > print(y2) 437s a b 437s 0 0 437s > stopifnot(all.equal.na(y1, y0)) 437s > stopifnot(all.equal.na(y2, y1)) 437s > 437s 437s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 437s Copyright (C) 2025 The R Foundation for Statistical Computing 437s Platform: arm-unknown-linux-gnueabihf (32-bit) 437s 437s R is free software and comes with ABSOLUTELY NO WARRANTY. 437s You are welcome to redistribute it under certain conditions. 437s Type 'license()' or 'licence()' for distribution details. 437s 437s R is a collaborative project with many contributors. 437s Type 'contributors()' for more information and 437s 'citation()' on how to cite R or R packages in publications. 437s 437s Type 'demo()' for some demos, 'help()' for on-line help, or 437s 'help.start()' for an HTML browser interface to help. 437s Type 'q()' to quit R. 437s 438s > library("matrixStats") 438s > 438s > rowProds_R <- function(x, FUN = prod, na.rm = FALSE, ..., useNames = TRUE) { 438s + res <- apply(x, MARGIN = 1L, FUN = FUN, na.rm = na.rm) 438s + if (!useNames) names(res) <- NULL 438s + res 438s + } 438s > 438s > 438s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 438s > # Subsetted tests 438s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 438s > source("utils/validateIndicesFramework.R") 438s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 438s > storage.mode(x) <- "integer" 438s > 438s > # To check names attribute 438s > dimnames <- list(letters[1:6], LETTERS[1:6]) 438s > 438s > # Test with and without dimnames on x 438s > for (setDimnames in c(TRUE, FALSE)) { 438s + if (setDimnames) dimnames(x) <- dimnames 438s + else dimnames(x) <- NULL 438s + for (rows in index_cases) { 438s + for (cols in index_cases) { 438s + for (na.rm in c(TRUE, FALSE)) { 438s + for (useNames in c(TRUE, FALSE)) { 438s + validateIndicesTestMatrix(x, rows, cols, 438s + ftest = rowProds, fsure = rowProds_R, 438s + method = "expSumLog", 438s + FUN = product, na.rm = na.rm, useNames = useNames) 438s + validateIndicesTestMatrix(x, rows, cols, 438s + fcoltest = colProds, fsure = rowProds_R, 438s + method = "expSumLog", 438s + FUN = product, na.rm = na.rm, useNames = useNames) 438s + } 438s + } 438s + } 438s + } 438s + } 439s > 439s 439s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 439s Copyright (C) 2025 The R Foundation for Statistical Computing 439s Platform: arm-unknown-linux-gnueabihf (32-bit) 439s 439s R is free software and comes with ABSOLUTELY NO WARRANTY. 439s You are welcome to redistribute it under certain conditions. 439s Type 'license()' or 'licence()' for distribution details. 439s 439s R is a collaborative project with many contributors. 439s Type 'contributors()' for more information and 439s 'citation()' on how to cite R or R packages in publications. 439s 439s Type 'demo()' for some demos, 'help()' for on-line help, or 439s 'help.start()' for an HTML browser interface to help. 439s Type 'q()' to quit R. 439s 439s > library("matrixStats") 439s > 439s > ## Create isFALSE() if running on an old version of R 439s > if (!exists("isFALSE", mode="function")) { 439s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 439s + } 439s > 439s > rowQuantiles_R <- function(x, probs = c(0, 0.25, 0.50, 0.75, 1), na.rm = FALSE, drop = TRUE, type = 7L, ..., useNames = TRUE) { 439s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 439s + if (!na.rm && any(is.na(x))) { 439s + na_value <- NA_real_ 439s + if (type != 7L) storage.mode(na_value) <- storage.mode(x) 439s + rep(na_value, times = length(probs)) 439s + } else { 439s + as.vector(quantile(x, probs = probs, na.rm = na.rm, type = type, names = FALSE, ...)) 439s + } 439s + }, probs = probs, na.rm = na.rm) 439s + 439s + if (!is.null(dim(q))) q <- t(q) 439s + else dim(q) <- c(nrow(x), length(probs)) 439s + 439s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 439s + rownames(q) <- rownames(x) 439s + if (isFALSE(useNames)) dimnames(q) <- NULL 439s + 439s + if (drop) q <- drop(q) 439s + q 439s + } 439s > 439s > 439s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 439s > # Test with multiple quantiles 439s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 439s > for (mode in c("logical", "integer", "double")) { 439s + cat("mode: ", mode, "\n", sep = "") 439s + x <- matrix(1:40 + 0.1, nrow = 8, ncol = 5) 439s + storage.mode(x) <- mode 439s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 439s + str(x) 439s + 439s + probs <- c(0, 0.5, 1) 439s + # Test with and without dimnames on x 439s + for (setDimnames in c(TRUE, FALSE)) { 439s + if (setDimnames) dimnames(x) <- dimnames 439s + else dimnames(x) <- NULL 439s + # Check names attribute 439s + for (useNames in c(TRUE, FALSE)) { 439s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 439s + print(q0) 439s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 439s + print(q1) 439s + stopifnot(all.equal(q1, q0)) 439s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 439s + stopifnot(all.equal(q2, q0)) 439s + } 439s + } 439s + } # for (mode ...) 439s mode: logical 439s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 439s 0% 50% 100% 439s a 1 1 1 439s b 1 1 1 439s c 1 1 1 439s d 1 1 1 439s e 1 1 1 439s f 1 1 1 439s g 1 1 1 439s h 1 1 1 439s 0% 50% 100% 439s a 1 1 1 439s b 1 1 1 439s c 1 1 1 439s d 1 1 1 439s e 1 1 1 439s f 1 1 1 439s g 1 1 1 439s h 1 1 1 439s [,1] [,2] [,3] 439s [1,] 1 1 1 439s [2,] 1 1 1 439s [3,] 1 1 1 439s [4,] 1 1 1 439s [5,] 1 1 1 439s [6,] 1 1 1 439s [7,] 1 1 1 439s [8,] 1 1 1 439s [,1] [,2] [,3] 439s [1,] 1 1 1 439s [2,] 1 1 1 439s [3,] 1 1 1 439s [4,] 1 1 1 439s [5,] 1 1 1 439s [6,] 1 1 1 439s [7,] 1 1 1 439s [8,] 1 1 1 439s 0% 50% 100% 439s [1,] 1 1 1 439s [2,] 1 1 1 439s [3,] 1 1 1 439s [4,] 1 1 1 439s [5,] 1 1 1 439s [6,] 1 1 1 439s [7,] 1 1 1 439s [8,] 1 1 1 439s 0% 50% 100% 439s [1,] 1 1 1 439s [2,] 1 1 1 439s [3,] 1 1 1 439s [4,] 1 1 1 439s [5,] 1 1 1 439s [6,] 1 1 1 439s [7,] 1 1 1 439s [8,] 1 1 1 439s [,1] [,2] [,3] 439s [1,] 1 1 1 439s [2,] 1 1 1 439s [3,] 1 1 1 439s [4,] 1 1 1 439s [5,] 1 1 1 439s [6,] 1 1 1 439s [7,] 1 1 1 439s [8,] 1 1 1 439s [,1] [,2] [,3] 439s [1,] 1 1 1 439s [2,] 1 1 1 439s [3,] 1 1 1 439s [4,] 1 1 1 439s [5,] 1 1 1 439s [6,] 1 1 1 439s [7,] 1 1 1 439s [8,] 1 1 1 439s mode: integer 439s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 439s 0% 50% 100% 439s a 1 17 33 439s b 2 18 34 439s c 3 19 35 439s d 4 20 36 439s e 5 21 37 439s f 6 22 38 439s g 7 23 39 439s h 8 24 40 439s 0% 50% 100% 439s a 1 17 33 439s b 2 18 34 439s c 3 19 35 439s d 4 20 36 439s e 5 21 37 439s f 6 22 38 439s g 7 23 39 439s h 8 24 40 439s [,1] [,2] [,3] 439s [1,] 1 17 33 439s [2,] 2 18 34 439s [3,] 3 19 35 439s [4,] 4 20 36 439s [5,] 5 21 37 439s [6,] 6 22 38 439s [7,] 7 23 39 439s [8,] 8 24 40 439s [,1] [,2] [,3] 439s [1,] 1 17 33 439s [2,] 2 18 34 439s [3,] 3 19 35 439s [4,] 4 20 36 439s [5,] 5 21 37 439s [6,] 6 22 38 439s [7,] 7 23 39 439s [8,] 8 24 40 439s 0% 50% 100% 439s [1,] 1 17 33 439s [2,] 2 18 34 439s [3,] 3 19 35 439s [4,] 4 20 36 439s [5,] 5 21 37 439s [6,] 6 22 38 439s [7,] 7 23 39 439s [8,] 8 24 40 439s 0% 50% 100% 439s [1,] 1 17 33 439s [2,] 2 18 34 439s [3,] 3 19 35 439s [4,] 4 20 36 439s [5,] 5 21 37 439s [6,] 6 22 38 439s [7,] 7 23 39 439s [8,] 8 24 40 439s [,1] [,2] [,3] 439s [1,] 1 17 33 439s [2,] 2 18 34 439s [3,] 3 19 35 439s [4,] 4 20 36 439s [5,] 5 21 37 439s [6,] 6 22 38 439s [7,] 7 23 39 439s [8,] 8 24 40 439s [,1] [,2] [,3] 439s [1,] 1 17 33 439s [2,] 2 18 34 439s [3,] 3 19 35 439s [4,] 4 20 36 439s [5,] 5 21 37 439s [6,] 6 22 38 439s [7,] 7 23 39 439s [8,] 8 24 40 439s mode: double 439s 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 ... 439s 0% 50% 100% 439s a 1.1 17.1 33.1 439s b 2.1 18.1 34.1 439s c 3.1 19.1 35.1 439s d 4.1 20.1 36.1 439s e 5.1 21.1 37.1 439s f 6.1 22.1 38.1 439s g 7.1 23.1 39.1 439s h 8.1 24.1 40.1 439s 0% 50% 100% 439s a 1.1 17.1 33.1 439s b 2.1 18.1 34.1 439s c 3.1 19.1 35.1 439s d 4.1 20.1 36.1 439s e 5.1 21.1 37.1 439s f 6.1 22.1 38.1 439s g 7.1 23.1 39.1 439s h 8.1 24.1 40.1 439s [,1] [,2] [,3] 439s [1,] 1.1 17.1 33.1 439s [2,] 2.1 18.1 34.1 439s [3,] 3.1 19.1 35.1 439s [4,] 4.1 20.1 36.1 439s [5,] 5.1 21.1 37.1 439s [6,] 6.1 22.1 38.1 439s [7,] 7.1 23.1 39.1 439s [8,] 8.1 24.1 40.1 439s [,1] [,2] [,3] 439s [1,] 1.1 17.1 33.1 439s [2,] 2.1 18.1 34.1 439s [3,] 3.1 19.1 35.1 439s [4,] 4.1 20.1 36.1 439s [5,] 5.1 21.1 37.1 439s [6,] 6.1 22.1 38.1 439s [7,] 7.1 23.1 39.1 439s [8,] 8.1 24.1 40.1 439s 0% 50% 100% 439s [1,] 1.1 17.1 33.1 439s [2,] 2.1 18.1 34.1 439s [3,] 3.1 19.1 35.1 439s [4,] 4.1 20.1 36.1 439s [5,] 5.1 21.1 37.1 439s [6,] 6.1 22.1 38.1 439s [7,] 7.1 23.1 39.1 439s [8,] 8.1 24.1 40.1 439s 0% 50% 100% 439s [1,] 1.1 17.1 33.1 439s [2,] 2.1 18.1 34.1 439s [3,] 3.1 19.1 35.1 439s [4,] 4.1 20.1 36.1 439s [5,] 5.1 21.1 37.1 439s [6,] 6.1 22.1 38.1 439s [7,] 7.1 23.1 39.1 439s [8,] 8.1 24.1 40.1 439s [,1] [,2] [,3] 439s [1,] 1.1 17.1 33.1 439s [2,] 2.1 18.1 34.1 439s [3,] 3.1 19.1 35.1 439s [4,] 4.1 20.1 36.1 439s [5,] 5.1 21.1 37.1 439s [6,] 6.1 22.1 38.1 439s [7,] 7.1 23.1 39.1 439s [8,] 8.1 24.1 40.1 439s [,1] [,2] [,3] 439s [1,] 1.1 17.1 33.1 439s [2,] 2.1 18.1 34.1 439s [3,] 3.1 19.1 35.1 439s [4,] 4.1 20.1 36.1 439s [5,] 5.1 21.1 37.1 439s [6,] 6.1 22.1 38.1 439s [7,] 7.1 23.1 39.1 439s [8,] 8.1 24.1 40.1 439s > 439s > 439s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 439s > # Test with a single quantile 439s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 439s > for (mode in c("logical", "integer", "double")) { 439s + cat("mode: ", mode, "\n", sep = "") 439s + x <- matrix(1:40, nrow = 8, ncol = 5) 439s + storage.mode(x) <- mode 439s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 439s + str(x) 439s + 439s + probs <- c(0.5) 439s + # Test with and without dimnames on x 439s + for (setDimnames in c(TRUE, FALSE)) { 439s + if (setDimnames) dimnames(x) <- dimnames 439s + else dimnames(x) <- NULL 439s + # Check names attribute 439s + for (useNames in c(TRUE, FALSE)) { 439s + q0 <- rowQuantiles_R(x, probs = probs, useNames = useNames) 439s + print(q0) 439s + q1 <- rowQuantiles(x, probs = probs, useNames = useNames) 439s + print(q1) 439s + stopifnot(all.equal(q1, q0)) 439s + q2 <- colQuantiles(t(x), probs = probs, useNames = useNames) 439s + stopifnot(all.equal(q2, q0)) 439s + } 439s + } 439s + } # for (mode ...) 439s mode: logical 439s logi [1:8, 1:5] TRUE TRUE TRUE TRUE TRUE TRUE ... 439s a b c d e f g h 439s 1 1 1 1 1 1 1 1 439s a b c d e f g h 439s 1 1 1 1 1 1 1 1 439s [1] 1 1 1 1 1 1 1 1 439s [1] 1 1 1 1 1 1 1 1 439s [1] 1 1 1 1 1 1 1 1 439s [1] 1 1 1 1 1 1 1 1 439s [1] 1 1 1 1 1 1 1 1 439s [1] 1 1 1 1 1 1 1 1 439s mode: integer 439s int [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 439s a b c d e f g h 439s 17 18 19 20 21 22 23 24 439s a b c d e f g h 439s 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s mode: double 439s num [1:8, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 439s a b c d e f g h 439s 17 18 19 20 21 22 23 24 439s a b c d e f g h 439s 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s [1] 17 18 19 20 21 22 23 24 439s > 439s > 439s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 439s > # Consistency checks 439s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 439s > set.seed(1) 439s > 439s > probs <- seq(from = 0, to = 1, by = 0.25) 439s > 439s > cat("Consistency checks:\n") 439s Consistency checks: 439s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 6L else 24L 439s > for (kk in seq_len(n_sims)) { 439s + cat("Random test #", kk, "\n", sep = "") 439s + 439s + # Simulate data in a matrix of any shape 439s + dim <- sample(20:60, size = 2L) 439s + n <- prod(dim) 439s + x <- rnorm(n, sd = 100) 439s + dim(x) <- dim 439s + dimnames <- lapply(dim(x), FUN = function(n) rep(letters, length.out = n)) 439s + 439s + # Add NAs? 439s + has_na <- ((kk %% 2) == 0L) 439s + if (has_na) { 439s + cat("Adding NAs\n") 439s + nna <- sample(n, size = 1) 439s + na_values <- c(NA_real_, NaN) 439s + t <- sample(na_values, size = nna, replace = TRUE) 439s + x[sample(length(x), size = nna)] <- t 439s + } 439s + 439s + # Logical, integer, or double? 439s + mode <- "numeric" 439s + if ((kk %% 6) %in% 1:2) { 439s + cat("Coercing to logical\n") 439s + mode <- "logical" 439s + } else if ((kk %% 6) %in% 3:4) { 439s + cat("Coercing to integers\n") 439s + mode <- "integer" 439s + } 439s + storage.mode(x) <- mode 439s + 439s + str(x) 439s + 439s + # rowQuantiles(): 439s + for (type in 1:9) { 439s + cat(sprintf("type=%d, has_na=%s:\n", type, has_na)) 439s + # Test with and without dimnames on x 439s + for (setDimnames in c(TRUE, FALSE)) { 439s + if (setDimnames) dimnames(x) <- dimnames 439s + else dimnames(x) <- NULL 439s + # Check names attribute 439s + for (useNames in c(TRUE, FALSE)) { 439s + q0 <- rowQuantiles_R(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 439s + q1 <- rowQuantiles(x, probs = probs, na.rm = has_na, type = type, useNames = useNames) 439s + stopifnot(all.equal(q1, q0)) 439s + q2 <- colQuantiles(t(x), probs = probs, na.rm = has_na, type = type, useNames = useNames) 439s + stopifnot(all.equal(q2, q0)) 439s + } 439s + } 439s + } 439s + } # for (kk ...) 439s Random test #1 439s Coercing to logical 439s logi [1:23, 1:58] TRUE TRUE TRUE TRUE TRUE TRUE ... 439s type=1, has_na=FALSE: 439s type=2, has_na=FALSE: 439s type=3, has_na=FALSE: 439s type=4, has_na=FALSE: 439s type=5, has_na=FALSE: 439s type=6, has_na=FALSE: 439s type=7, has_na=FALSE: 439s type=8, has_na=FALSE: 439s type=9, has_na=FALSE: 439s Random test #2 439s Adding NAs 439s Coercing to logical 439s logi [1:58, 1:33] TRUE TRUE TRUE TRUE TRUE NA ... 439s type=1, has_na=TRUE: 439s type=2, has_na=TRUE: 439s type=3, has_na=TRUE: 439s type=4, has_na=TRUE: 439s type=5, has_na=TRUE: 440s type=6, has_na=TRUE: 440s type=7, has_na=TRUE: 440s type=8, has_na=TRUE: 440s type=9, has_na=TRUE: 440s Random test #3 440s Coercing to integers 440s int [1:28, 1:60] 119 -164 115 -129 209 -175 2 -32 120 -28 ... 440s type=1, has_na=FALSE: 440s type=2, has_na=FALSE: 440s type=3, has_na=FALSE: 440s type=4, has_na=FALSE: 440s type=5, has_na=FALSE: 440s type=6, has_na=FALSE: 440s type=7, has_na=FALSE: 440s type=8, has_na=FALSE: 440s type=9, has_na=FALSE: 440s Random test #4 440s Adding NAs 440s Coercing to integers 440s int [1:54, 1:35] 147 11 116 -50 NA -69 132 NA 114 NA ... 440s type=1, has_na=TRUE: 440s type=2, has_na=TRUE: 440s type=3, has_na=TRUE: 440s type=4, has_na=TRUE: 440s type=5, has_na=TRUE: 440s type=6, has_na=TRUE: 441s type=7, has_na=TRUE: 441s type=8, has_na=TRUE: 441s type=9, has_na=TRUE: 441s Random test #5 441s num [1:39, 1:53] 5.94 -27.16 -30.78 173 126.05 ... 441s type=1, has_na=FALSE: 441s type=2, has_na=FALSE: 441s type=3, has_na=FALSE: 441s type=4, has_na=FALSE: 441s type=5, has_na=FALSE: 441s type=6, has_na=FALSE: 441s type=7, has_na=FALSE: 441s type=8, has_na=FALSE: 441s type=9, has_na=FALSE: 441s Random test #6 441s Adding NAs 441s num [1:46, 1:22] 197 -107 15 148 -110 ... 441s type=1, has_na=TRUE: 441s type=2, has_na=TRUE: 441s type=3, has_na=TRUE: 441s type=4, has_na=TRUE: 441s type=5, has_na=TRUE: 442s type=6, has_na=TRUE: 442s type=7, has_na=TRUE: 442s type=8, has_na=TRUE: 442s type=9, has_na=TRUE: 442s Random test #7 442s Coercing to logical 442s logi [1:21, 1:51] TRUE TRUE TRUE TRUE TRUE TRUE ... 442s type=1, has_na=FALSE: 442s type=2, has_na=FALSE: 442s type=3, has_na=FALSE: 442s type=4, has_na=FALSE: 442s type=5, has_na=FALSE: 442s type=6, has_na=FALSE: 442s type=7, has_na=FALSE: 442s type=8, has_na=FALSE: 442s type=9, has_na=FALSE: 442s Random test #8 442s Adding NAs 442s Coercing to logical 442s logi [1:33, 1:53] NA NA TRUE TRUE TRUE TRUE ... 442s type=1, has_na=TRUE: 442s type=2, has_na=TRUE: 442s type=3, has_na=TRUE: 442s type=4, has_na=TRUE: 442s type=5, has_na=TRUE: 442s type=6, has_na=TRUE: 442s type=7, has_na=TRUE: 442s type=8, has_na=TRUE: 442s type=9, has_na=TRUE: 442s Random test #9 442s Coercing to integers 442s int [1:53, 1:24] -73 10 -73 -5 44 -107 -100 95 58 -50 ... 442s type=1, has_na=FALSE: 442s type=2, has_na=FALSE: 443s type=3, has_na=FALSE: 443s type=4, has_na=FALSE: 443s type=5, has_na=FALSE: 443s type=6, has_na=FALSE: 443s type=7, has_na=FALSE: 443s type=8, has_na=FALSE: 443s type=9, has_na=FALSE: 443s Random test #10 443s Adding NAs 443s Coercing to integers 443s int [1:44, 1:20] NA -140 NA -57 -252 NA NA 20 NA NA ... 443s type=1, has_na=TRUE: 443s type=2, has_na=TRUE: 443s type=3, has_na=TRUE: 443s type=4, has_na=TRUE: 443s type=5, has_na=TRUE: 443s type=6, has_na=TRUE: 443s type=7, has_na=TRUE: 443s type=8, has_na=TRUE: 443s type=9, has_na=TRUE: 443s Random test #11 443s num [1:54, 1:23] -160.87 74.13 196.08 7.27 4.92 ... 443s type=1, has_na=FALSE: 443s type=2, has_na=FALSE: 443s type=3, has_na=FALSE: 444s type=4, has_na=FALSE: 444s type=5, has_na=FALSE: 444s type=6, has_na=FALSE: 444s type=7, has_na=FALSE: 444s type=8, has_na=FALSE: 444s type=9, has_na=FALSE: 444s Random test #12 444s Adding NAs 444s num [1:59, 1:27] -139.2 -86.3 NA -40.7 NA ... 444s type=1, has_na=TRUE: 444s type=2, has_na=TRUE: 444s type=3, has_na=TRUE: 444s type=4, has_na=TRUE: 444s type=5, has_na=TRUE: 444s type=6, has_na=TRUE: 444s type=7, has_na=TRUE: 444s type=8, has_na=TRUE: 444s type=9, has_na=TRUE: 445s Random test #13 445s Coercing to logical 445s logi [1:53, 1:60] TRUE TRUE TRUE TRUE TRUE TRUE ... 445s type=1, has_na=FALSE: 445s type=2, has_na=FALSE: 445s type=3, has_na=FALSE: 445s type=4, has_na=FALSE: 445s type=5, has_na=FALSE: 445s type=6, has_na=FALSE: 445s type=7, has_na=FALSE: 445s type=8, has_na=FALSE: 445s type=9, has_na=FALSE: 445s Random test #14 445s Adding NAs 445s Coercing to logical 445s logi [1:22, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 445s type=1, has_na=TRUE: 445s type=2, has_na=TRUE: 445s type=3, has_na=TRUE: 445s type=4, has_na=TRUE: 445s type=5, has_na=TRUE: 445s type=6, has_na=TRUE: 445s type=7, has_na=TRUE: 445s type=8, has_na=TRUE: 445s type=9, has_na=TRUE: 445s Random test #15 445s Coercing to integers 445s int [1:20, 1:34] 78 -41 183 190 -71 37 0 -4 -86 27 ... 445s type=1, has_na=FALSE: 445s type=2, has_na=FALSE: 445s type=3, has_na=FALSE: 445s type=4, has_na=FALSE: 445s type=5, has_na=FALSE: 445s type=6, has_na=FALSE: 445s type=7, has_na=FALSE: 446s type=8, has_na=FALSE: 446s type=9, has_na=FALSE: 446s Random test #16 446s Adding NAs 446s Coercing to integers 446s int [1:42, 1:37] NA 12 -15 41 -28 17 NA -74 NA NA ... 446s type=1, has_na=TRUE: 446s type=2, has_na=TRUE: 446s type=3, has_na=TRUE: 446s type=4, has_na=TRUE: 446s type=5, has_na=TRUE: 446s type=6, has_na=TRUE: 446s type=7, has_na=TRUE: 446s type=8, has_na=TRUE: 446s type=9, has_na=TRUE: 446s Random test #17 446s num [1:42, 1:29] -50.51 -6.51 -117.59 135.58 226.87 ... 446s type=1, has_na=FALSE: 446s type=2, has_na=FALSE: 446s type=3, has_na=FALSE: 446s type=4, has_na=FALSE: 446s type=5, has_na=FALSE: 446s type=6, has_na=FALSE: 446s type=7, has_na=FALSE: 446s type=8, has_na=FALSE: 446s type=9, has_na=FALSE: 446s Random test #18 446s Adding NAs 446s num [1:57, 1:39] 223 156.8 -44.6 -127.5 -147.7 ... 446s type=1, has_na=TRUE: 447s type=2, has_na=TRUE: 447s type=3, has_na=TRUE: 447s type=4, has_na=TRUE: 447s type=5, has_na=TRUE: 447s type=6, has_na=TRUE: 447s type=7, has_na=TRUE: 447s type=8, has_na=TRUE: 447s type=9, has_na=TRUE: 447s Random test #19 447s Coercing to logical 447s logi [1:52, 1:57] TRUE TRUE TRUE TRUE TRUE TRUE ... 447s type=1, has_na=FALSE: 447s type=2, has_na=FALSE: 447s type=3, has_na=FALSE: 447s type=4, has_na=FALSE: 447s type=5, has_na=FALSE: 447s type=6, has_na=FALSE: 447s type=7, has_na=FALSE: 447s type=8, has_na=FALSE: 448s type=9, has_na=FALSE: 448s Random test #20 448s Adding NAs 448s Coercing to logical 448s logi [1:25, 1:48] NA TRUE NA NA NA NA ... 448s type=1, has_na=TRUE: 448s type=2, has_na=TRUE: 448s type=3, has_na=TRUE: 448s type=4, has_na=TRUE: 448s type=5, has_na=TRUE: 448s type=6, has_na=TRUE: 448s type=7, has_na=TRUE: 448s type=8, has_na=TRUE: 448s type=9, has_na=TRUE: 448s Random test #21 448s Coercing to integers 448s int [1:53, 1:27] 3 -30 203 -49 19 -45 -138 28 46 -44 ... 448s type=1, has_na=FALSE: 448s type=2, has_na=FALSE: 448s type=3, has_na=FALSE: 448s type=4, has_na=FALSE: 448s type=5, has_na=FALSE: 448s type=6, has_na=FALSE: 448s type=7, has_na=FALSE: 448s type=8, has_na=FALSE: 448s type=9, has_na=FALSE: 448s Random test #22 448s Adding NAs 448s Coercing to integers 448s int [1:48, 1:36] -131 NA NA -201 45 -17 NA 57 NA NA ... 448s type=1, has_na=TRUE: 448s type=2, has_na=TRUE: 449s type=3, has_na=TRUE: 449s type=4, has_na=TRUE: 449s type=5, has_na=TRUE: 449s type=6, has_na=TRUE: 449s type=7, has_na=TRUE: 449s type=8, has_na=TRUE: 449s type=9, has_na=TRUE: 449s Random test #23 449s num [1:23, 1:43] -99.2 -68.8 -86.7 -104.2 48 ... 449s type=1, has_na=FALSE: 449s type=2, has_na=FALSE: 449s type=3, has_na=FALSE: 449s type=4, has_na=FALSE: 449s type=5, has_na=FALSE: 449s type=6, has_na=FALSE: 449s type=7, has_na=FALSE: 449s type=8, has_na=FALSE: 449s type=9, has_na=FALSE: 449s Random test #24 449s Adding NAs 449s num [1:53, 1:29] NaN -67.6 10.8 -88.4 130.1 ... 449s type=1, has_na=TRUE: 449s type=2, has_na=TRUE: 449s type=3, has_na=TRUE: 449s type=4, has_na=TRUE: 449s type=5, has_na=TRUE: 450s type=6, has_na=TRUE: 450s type=7, has_na=TRUE: 450s type=8, has_na=TRUE: 450s type=9, has_na=TRUE: 450s > 450s > 450s > 450s > for (mode in c("logical", "integer", "double")) { 450s + naValue <- NA_real_ 450s + storage.mode(naValue) <- mode 450s + 450s + someValue <- 1 450s + storage.mode(someValue) <- mode 450s + 450s + for (type in 1:9) { 450s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 450s + # All NA 450s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 450s + x <- matrix(naValue, nrow = 3L, ncol = 4L) 450s + dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 450s + # Test with and without dimnames on x 450s + for (setDimnames in c(TRUE, FALSE)) { 450s + if (setDimnames) dimnames(x) <- dimnames 450s + else dimnames(x) <- NULL 450s + # Check names attribute 450s + for (useNames in c(TRUE, FALSE)) { 450s + qr0 <- rowQuantiles_R(x, type = type, useNames = useNames) 450s + 450s + qr <- rowQuantiles(x, type = type, useNames = useNames) 450s + stopifnot(identical(qr, qr0)) 450s + 450s + # x <- matrix(naValue, nrow = 4L, ncol = 3L) 450s + qc <- colQuantiles(t(x), type = type, useNames = useNames) 450s + 450s + stopifnot(identical(qc, qr)) 450s + } 450s + } 450s + 450s + 450s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 450s + # Empty matrices 450s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 450s + probs <- c(0, 0.25, 0.75, 1) 450s + x <- matrix(naValue, nrow = 0L, ncol = 0L) 450s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 450s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 450s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 450s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 450s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 450s + 450s + x <- matrix(naValue, nrow = 2L, ncol = 0L) 450s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 450s + q <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 450s + stopifnot(identical(dim(q), c(nrow(x), length(probs)))) 450s + 450s + x <- matrix(naValue, nrow = 0L, ncol = 2L) 450s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 450s + q <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 450s + stopifnot(identical(dim(q), c(ncol(x), length(probs)))) 450s + 450s + 450s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 450s + # Single column matrices 450s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 450s + probs <- c(0, 0.25, 0.75, 1) 450s + x <- matrix(someValue, nrow = 2L, ncol = 1L) 450s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 450s + qr <- rowQuantiles(x, probs = probs, type = type, useNames = TRUE) 450s + print(qr) 450s + 450s + x <- matrix(someValue, nrow = 1L, ncol = 2L) 450s + dimnames(x) <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 450s + qc <- colQuantiles(x, probs = probs, type = type, useNames = TRUE) 450s + print(qc) 450s + 450s + stopifnot(identical(qc, qr)) 450s + } 450s + } 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 450s 0% 25% 75% 100% 450s a 1 1 1 1 450s b 1 1 1 1 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: arm-unknown-linux-gnueabihf (32-bit) 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 > ## Create isFALSE() if running on an old version of R 450s > if (!exists("isFALSE", mode="function")) { 450s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 450s + } 450s > 450s > rowQuantiles_R <- function(x, probs, na.rm = FALSE, drop = TRUE, ..., useNames = TRUE) { 450s + q <- apply(x, MARGIN = 1L, FUN = function(x, probs, na.rm) { 450s + if (!na.rm && any(is.na(x))) { 450s + na_value <- NA_real_ 450s + storage.mode(na_value) <- storage.mode(x) 450s + rep(na_value, times = length(probs)) 450s + 450s + } else { 450s + as.vector(quantile(x, probs = probs, na.rm = na.rm, names = FALSE, ...)) 450s + } 450s + }, probs = probs, na.rm = na.rm) 450s + 450s + if (!is.null(dim(q))) q <- t(q) 450s + else dim(q) <- c(nrow(x), length(probs)) 450s + 450s + colnames(q) <- matrixStats:::quantile_probs_names(probs) 450s + rownames(q) <- rownames(x) 450s + if (isFALSE(useNames)) dimnames(q) <- NULL 450s + 450s + if (drop) q <- drop(q) 450s + q 450s + } 450s > 450s > 450s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 450s > # Subsetted tests 450s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 450s > source("utils/validateIndicesFramework.R") 450s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 450s > dimnames <- lapply(dim(x), FUN = function(n) letters[seq_len(n)]) 450s > probs <- c(0, 0.25, 0.75, 1) 450s > # Test with and without dimnames on x 450s > for (setDimnames in c(TRUE, FALSE)) { 450s + if (setDimnames) dimnames(x) <- dimnames 450s + else dimnames(x) <- NULL 450s + 450s + count <- 0L 450s + for (rows in index_cases) { 450s + for (cols in index_cases) { 450s + count <- count + 1L 450s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 450s + useNames <- c(TRUE, FALSE) 450s + useNames <- useNames[count %% length(useNames) + 1] 450s + 450s + validateIndicesTestMatrix(x, rows, cols, 450s + ftest = rowQuantiles, fsure = rowQuantiles_R, 450s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 450s + validateIndicesTestMatrix(x, rows, cols, 450s + fcoltest = colQuantiles, fsure = rowQuantiles_R, 450s + probs = probs, na.rm = na.rm, drop = FALSE, useNames = useNames) 450s + } 450s + } 450s + } 451s > 451s > 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: arm-unknown-linux-gnueabihf (32-bit) 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 > rowMins_R <- function(x, ..., useNames = TRUE) { 452s + suppressWarnings({ 452s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 452s + }) 452s + if (!useNames) names(res) <- NULL 452s + res 452s + } # rowMins_R() 452s > 452s > rowMaxs_R <- function(x, ..., useNames = TRUE) { 452s + suppressWarnings({ 452s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 452s + }) 452s + if (!useNames) names(res) <- NULL 452s + res 452s + } # rowMaxs_R() 452s > 452s > rowRanges_R <- function(x, ..., useNames = TRUE) { 452s + suppressWarnings({ 452s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 452s + }) 452s + 452s + # Preserve rownames attribute 452s + dim <- c(dim(x)[1], 2L) 452s + if (!isTRUE(all.equal(dim(ans), dim))) { 452s + dim(ans) <- dim 452s + rownames <- rownames(x) 452s + if (!is.null(dimnames)) rownames(ans) <- rownames 452s + } 452s + if (!useNames) dimnames(ans) <- NULL 452s + ans 452s + } # rowRanges_R() 452s > 452s > 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > # With and without some NAs 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > for (mode in c("integer", "double")) { 452s + cat("mode: ", mode, "\n", sep = "") 452s + 452s + for (add_na in c(FALSE, TRUE)) { 452s + cat("add_na = ", add_na, "\n", sep = "") 452s + 452s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 452s + if (add_na) { 452s + x[3:7, c(2, 4)] <- NA_real_ 452s + } 452s + storage.mode(x) <- mode 452s + str(x) 452s + 452s + # To check names attribute 452s + dimnames <- list(letters[1:10], LETTERS[1:5]) 452s + 452s + # Test with and without dimnames on x 452s + for (setDimnames in c(TRUE, FALSE)) { 452s + if (setDimnames) dimnames(x) <- dimnames 452s + else dimnames(x) <- NULL 452s + # Row/column extremes 452s + for (na.rm in c(FALSE, TRUE)) { 452s + # Check names attribute 452s + for (useNames in c(TRUE, FALSE)) { 452s + cat("na.rm = ", na.rm, "\n", sep = "") 452s + 452s + # Ranges 452s + cat("range:\n") 452s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 452s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 452s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 452s + stopifnot(all.equal(r1, r2)) 452s + stopifnot(all.equal(r1, r0)) 452s + 452s + # Min 452s + cat("min:\n") 452s + m0 <- rowMins_R(x, na.rm = na.rm, useNames = useNames) 452s + m1 <- rowMins(x, na.rm = na.rm, useNames = useNames) 452s + m2 <- colMins(t(x), na.rm = na.rm, useNames = useNames) 452s + stopifnot(all.equal(m1, m2)) 452s + stopifnot(all.equal(m1, m0)) 452s + 452s + # Max 452s + cat("max:\n") 452s + m0 <- rowMaxs_R(x, na.rm = na.rm, useNames = useNames) 452s + m1 <- rowMaxs(x, na.rm = na.rm, useNames = useNames) 452s + m2 <- colMaxs(t(x), na.rm = na.rm, useNames = useNames) 452s + stopifnot(all.equal(m1, m2)) 452s + stopifnot(all.equal(m1, m0)) 452s + } 452s + } 452s + } 452s + } # for (add_na ...) 452s + } # for (mode ...) 452s mode: integer 452s add_na = FALSE 452s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s add_na = TRUE 452s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s mode: double 452s add_na = FALSE 452s 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 ... 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s add_na = TRUE 452s 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 ... 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = FALSE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s na.rm = TRUE 452s range: 452s min: 452s max: 452s > 452s > 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > # All NAs 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > for (mode in c("integer", "double")) { 452s + cat("mode: ", mode, "\n", sep = "") 452s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 452s + storage.mode(x) <- mode 452s + str(x) 452s + 452s + # Test with and without dimnames on x 452s + for (setDimnames in c(TRUE, FALSE)) { 452s + if (setDimnames) dimnames(x) <- dimnames 452s + else dimnames(x) <- NULL 452s + for (na.rm in c(FALSE, TRUE)) { 452s + # Check names attribute 452s + for (useNames in c(TRUE, FALSE)) { 452s + cat("na.rm = ", na.rm, "\n", sep = "") 452s + r0 <- rowRanges_R(x, na.rm = na.rm, useNames = useNames) 452s + r1 <- rowRanges(x, na.rm = na.rm, useNames = useNames) 452s + r2 <- colRanges(t(x), na.rm = na.rm, useNames = useNames) 452s + stopifnot(all.equal(r1, r2)) 452s + stopifnot(all.equal(r1, r0)) 452s + } 452s + } 452s + } 452s + } # for (mode ...) 452s mode: integer 452s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 452s na.rm = FALSE 452s na.rm = FALSE 452s na.rm = TRUE 452s na.rm = TRUE 452s na.rm = FALSE 452s na.rm = FALSE 452s na.rm = TRUE 452s na.rm = TRUE 452s mode: double 452s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 452s na.rm = FALSE 452s na.rm = FALSE 452s na.rm = TRUE 452s na.rm = TRUE 452s na.rm = FALSE 452s na.rm = FALSE 452s na.rm = TRUE 452s na.rm = TRUE 452s > 452s > 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > # Special cases 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > # Nx0 matrix 452s > x <- matrix(double(0L), nrow = 5L, ncol = 0L) 452s > r0 <- rowRanges_R(x) 452s > #r1 <- rowRanges(x) 452s > #r_truth <- matrix(c(Inf, -Inf), nrow = nrow(x), ncol = 2L, byrow = TRUE) 452s > #stopifnot(all.equal(r1, r_truth)) 452s > 452s > # 0xN matrix 452s > x <- t(x) 452s > #r1 <- colRanges(x) 452s > #stopifnot(all.equal(r1, r_truth)) 452s > 452s > # Nx1 matrix 452s > x <- matrix(1:5, nrow = 5L, ncol = 1L) 452s > # To check names attribute 452s > dimnames <- list(letters[1:5], "A") 452s > r1 <- rowRanges(x) 452s > r_truth <- matrix(1:5, nrow = nrow(x), ncol = 2L, byrow = FALSE) 452s > stopifnot(all.equal(r1, r_truth)) 452s > # Check names attribute 452s > dimnames(x) <- dimnames 452s > r0 <- rowRanges_R(x, useNames = TRUE) 452s > r1 <- rowRanges(x, useNames = TRUE) 452s > stopifnot(all.equal(r1, r0)) 452s > dimnames(x) <- NULL 452s > 452s > # 1xN matrix 452s > x <- t(x) 452s > r1 <- colRanges(x) 452s > stopifnot(all.equal(r1, r_truth)) 452s > # Check names attribute 452s > dimnames(x) <- list("a", LETTERS[1:5]) 452s > r1 <- colRanges(x, useNames = TRUE) 452s > stopifnot(identical(rownames(r1), colnames(x))) 452s > 452s > 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > # Additional tests with NA_integer_, NA_real, NaN, -Inf, +Inf 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > x <- matrix(1:12, nrow = 4L, ncol = 3L) 452s > 452s > na_list <- list( 452s + "integer" = matrix(1:12, nrow = 4L, ncol = 3L), 452s + "integer w/ NA" = matrix(NA_integer_, nrow = 4L, ncol = 3L), 452s + "real" = matrix(as.double(1:12), nrow = 4L, ncol = 3L), 452s + "real w/ NA" = matrix(NA_real_, nrow = 4L, ncol = 3L) 452s + ) 452s > 452s > na <- na_list[["real"]] 452s > na[2, 2] <- NA 452s > na_list[["real + NA cell"]] <- na 452s > 452s > na <- na_list[["real"]] 452s > na[2, ] <- NA 452s > na_list[["real + NA row"]] <- na 452s > 452s > na <- na_list[["real"]] 452s > na[2, ] <- NaN 452s > na_list[["real + NaN row"]] <- na 452s > 452s > na <- na_list[["real"]] 452s > na[2, 2] <- Inf 452s > na_list[["real + Inf cell"]] <- na 452s > 452s > na <- na_list[["real"]] 452s > na[2, ] <- Inf 452s > na_list[["real + Inf row"]] <- na 452s > 452s > na <- na_list[["real"]] 452s > na[2, 2] <- NaN 452s > na_list[["real + NaN cell"]] <- na 452s > 452s > na <- na_list[["real w/ NA"]] 452s > na[2, 2] <- NaN 452s > na_list[["real w/ NA + NaN cell"]] <- na 452s > 452s > na <- na_list[["real w/ NA"]] 452s > na[2, ] <- NaN 452s > na_list[["real w/ NA + NaN row"]] <- na 452s > 452s > # To check names attribute 452s > dimnames <- list(letters[1:4], LETTERS[1:3]) 452s > 452s > # Test with and without dimnames on x 452s > for (setDimnames in c(TRUE, FALSE)) { 452s + if (setDimnames) dimnames(x) <- dimnames 452s + else dimnames(x) <- NULL 452s + for (na.rm in c(FALSE, TRUE)) { 452s + for (name in names(na_list)) { 452s + # Check names attribute 452s + for (useNames in c(TRUE, FALSE)) { 452s + na <- na_list[[name]] 452s + cat(sprintf("%s (%s) w/ na.rm = %s:\n", name, typeof(na), na.rm)) 452s + print(na) 452s + 452s + cat(" min:\n") 452s + y0 <- rowMins_R(na, na.rm = na.rm, useNames = useNames) 452s + str(y0) 452s + y1 <- rowMins(na, na.rm = na.rm, useNames = useNames) 452s + str(y1) 452s + stopifnot(all.equal(y1, y0)) 452s + y1c <- colMins(t(na), na.rm = na.rm, useNames = useNames) 452s + str(y1c) 452s + stopifnot(all.equal(y1c, y1)) 452s + 452s + cat(" max:\n") 452s + y0 <- rowMaxs_R(na, na.rm = na.rm, useNames = useNames) 452s + str(y0) 452s + y1 <- rowMaxs(na, na.rm = na.rm, useNames = useNames) 452s + str(y1) 452s + stopifnot(all.equal(y1, y0)) 452s + y1c <- colMaxs(t(na), na.rm = na.rm, useNames = useNames) 452s + str(y1c) 452s + stopifnot(all.equal(y1c, y1)) 452s + 452s + cat(" range:\n") 452s + y0 <- rowRanges_R(na, na.rm = na.rm, useNames = useNames) 452s + str(y0) 452s + y1 <- rowRanges(na, na.rm = na.rm, useNames = useNames) 452s + str(y1) 452s + stopifnot(all.equal(y1, y0)) 452s + y1c <- colRanges(t(na), na.rm = na.rm, useNames = useNames) 452s + str(y1c) 452s + stopifnot(all.equal(y1c, y1)) 452s + } 452s + } # for (name ...) 452s + } # for (na.rm ...) 452s + } 452s integer (integer) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s max: 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s range: 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s integer (integer) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s max: 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s range: 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s integer w/ NA (integer) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s max: 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s range: 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s integer w/ NA (integer) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s max: 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s range: 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s real (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real w/ NA (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s max: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s range: 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s real w/ NA (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s max: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s range: 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s real + NA cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NA 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s max: 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s range: 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s real + NA cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NA 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s max: 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s range: 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s real + NA row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NA NA NA 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s max: 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s range: 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s real + NA row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NA NA NA 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s max: 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s range: 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s real + NaN row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NaN NaN NaN 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s max: 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s range: 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s real + NaN row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NaN NaN NaN 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s max: 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s range: 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s real + Inf cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 Inf 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s real + Inf cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 Inf 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s real + Inf row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] Inf Inf Inf 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + Inf row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] Inf Inf Inf 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + NaN cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NaN 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s max: 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s range: 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s real + NaN cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NaN 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s max: 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s range: 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NaN NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s max: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s range: 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NaN NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s max: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s range: 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s real w/ NA + NaN row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NaN NaN NaN 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s max: 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s range: 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s real w/ NA + NaN row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NaN NaN NaN 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s max: 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s range: 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s integer (integer) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s max: 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s range: 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s integer (integer) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s max: 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s range: 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s integer w/ NA (integer) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s integer w/ NA (integer) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real w/ NA (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real w/ NA (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real + NA cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NA 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real + NA cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NA 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real + NA row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NA NA NA 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + NA row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NA NA NA 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + NaN row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NaN NaN NaN 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + NaN row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NaN NaN NaN 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + Inf cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 Inf 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s real + Inf cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 Inf 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s real + Inf row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] Inf Inf Inf 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + Inf row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] Inf Inf Inf 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + NaN cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NaN 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real + NaN cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NaN 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NaN NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NaN NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real w/ NA + NaN row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NaN NaN NaN 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real w/ NA + NaN row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NaN NaN NaN 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s integer (integer) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s max: 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s range: 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s integer (integer) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s max: 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s range: 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s integer w/ NA (integer) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s max: 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s range: 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s integer w/ NA (integer) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s max: 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s int [1:4] NA NA NA NA 452s range: 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s int [1:4, 1:2] NA NA NA NA NA NA NA NA 452s real (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real w/ NA (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s max: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s range: 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s real w/ NA (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s max: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s range: 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s real + NA cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NA 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s max: 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s range: 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s real + NA cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NA 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s max: 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s range: 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s real + NA row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NA NA NA 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s max: 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s range: 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s real + NA row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NA NA NA 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s num [1:4] 1 NA 3 4 452s max: 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s num [1:4] 9 NA 11 12 452s range: 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s num [1:4, 1:2] 1 NA 3 4 9 NA 11 12 452s real + NaN row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NaN NaN NaN 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s max: 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s range: 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s real + NaN row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NaN NaN NaN 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s max: 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s range: 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s real + Inf cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 Inf 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s real + Inf cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 Inf 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s real + Inf row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] Inf Inf Inf 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + Inf row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] Inf Inf Inf 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + NaN cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NaN 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s max: 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s range: 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s real + NaN cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NaN 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s num [1:4] 1 NaN 3 4 452s max: 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s num [1:4] 9 NaN 11 12 452s range: 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s num [1:4, 1:2] 1 NaN 3 4 9 NaN 11 12 452s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NaN NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s max: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s range: 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s real w/ NA + NaN cell (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NaN NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s max: 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s num [1:4] NA NA NA NA 452s range: 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s num [1:4, 1:2] NA NA NA NA NA NA NA NA 452s real w/ NA + NaN row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NaN NaN NaN 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s max: 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s range: 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s real w/ NA + NaN row (double) w/ na.rm = FALSE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NaN NaN NaN 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s max: 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s num [1:4] NA NaN NA NA 452s range: 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s num [1:4, 1:2] NA NaN NA NA NA NaN NA NA 452s integer (integer) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s max: 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s range: 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s integer (integer) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s int [1:4] 1 2 3 4 452s max: 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s int [1:4] 9 10 11 12 452s range: 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s int [1:4, 1:2] 1 2 3 4 9 10 11 12 452s integer w/ NA (integer) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s integer w/ NA (integer) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 6 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real w/ NA (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real w/ NA (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NA NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real + NA cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NA 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real + NA cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NA 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real + NA row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NA NA NA 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + NA row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NA NA NA 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + NaN row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NaN NaN NaN 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + NaN row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] NaN NaN NaN 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s num [1:4] 9 -Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + Inf cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 Inf 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s real + Inf cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 Inf 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s num [1:4, 1:2] 1 2 3 4 9 ... 452s real + Inf row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] Inf Inf Inf 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + Inf row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] Inf Inf Inf 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s num [1:4] 1 Inf 3 4 452s max: 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s num [1:4] 9 Inf 11 12 452s range: 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s num [1:4, 1:2] 1 Inf 3 4 9 ... 452s real + NaN cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NaN 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real + NaN cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] 1 5 9 452s [2,] 2 NaN 10 452s [3,] 3 7 11 452s [4,] 4 8 12 452s min: 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s num [1:4] 1 2 3 4 452s max: 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s num [1:4] 9 10 11 12 452s range: 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s num [1:4, 1:2] 1 2 3 4 9 10 11 12 452s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NaN NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real w/ NA + NaN cell (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NA NaN NA 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real w/ NA + NaN row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NaN NaN NaN 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s real w/ NA + NaN row (double) w/ na.rm = TRUE: 452s [,1] [,2] [,3] 452s [1,] NA NA NA 452s [2,] NaN NaN NaN 452s [3,] NA NA NA 452s [4,] NA NA NA 452s min: 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s num [1:4] Inf Inf Inf Inf 452s max: 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s num [1:4] -Inf -Inf -Inf -Inf 452s range: 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 452s num [1:4, 1:2] Inf Inf Inf Inf -Inf ... 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: arm-unknown-linux-gnueabihf (32-bit) 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 > rowMins_R <- function(x, ..., useNames = TRUE) { 452s + suppressWarnings({ 452s + res <- apply(x, MARGIN = 1L, FUN = min, ...) 452s + }) 452s + if (!useNames) names(res) <- NULL 452s + res 452s + } # rowMins_R() 452s > 452s > rowMaxs_R <- function(x, ..., useNames = TRUE) { 452s + suppressWarnings({ 452s + res <- apply(x, MARGIN = 1L, FUN = max, ...) 452s + }) 452s + if (!useNames) names(res) <- NULL 452s + res 452s + } # rowMaxs_R() 452s > 452s > rowRanges_R <- function(x, ..., useNames = TRUE) { 452s + suppressWarnings({ 452s + ans <- t(apply(x, MARGIN = 1L, FUN = range, ...)) 452s + }) 452s + 452s + # Preserve rownames attribute 452s + dim <- c(dim(x)[1], 2L) 452s + if (!isTRUE(all.equal(dim(ans), dim))) { 452s + dim(ans) <- dim 452s + rownames <- rownames(x) 452s + if (!is.null(dimnames)) rownames(ans) <- rownames 452s + } 452s + if (!useNames) dimnames(ans) <- NULL 452s + ans 452s + } # rowRanges_R() 452s > 452s > 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > # Subsetted tests 452s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 452s > source("utils/validateIndicesFramework.R") 452s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 452s > storage.mode(x) <- "integer" 452s > 452s > # To check rownames/names attributes 452s > dimnames <- list(letters[1:6], LETTERS[1:6]) 452s > 452s > # Test with and without dimnames on x 452s > for (setDimnames in c(TRUE, FALSE)) { 452s + if (setDimnames) dimnames(x) <- dimnames 452s + else dimnames(x) <- NULL 452s + 452s + count <- 0L 452s + for (rows in index_cases) { 452s + for (cols in index_cases) { 452s + count <- count + 1L 452s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 452s + useNames <- c(TRUE, FALSE) 452s + useNames <- useNames[count %% length(useNames) + 1] 452s + 452s + validateIndicesTestMatrix(x, rows, cols, 452s + ftest = rowRanges, fsure = rowRanges_R, 452s + na.rm = na.rm, useNames = useNames) 452s + validateIndicesTestMatrix(x, rows, cols, 452s + ftest = rowMins, fsure = rowMins_R, 452s + na.rm = na.rm, useNames = useNames) 452s + validateIndicesTestMatrix(x, rows, cols, 452s + ftest = rowMaxs, fsure = rowMaxs_R, 452s + na.rm = na.rm, useNames = useNames) 452s + 452s + validateIndicesTestMatrix(x, rows, cols, 452s + fcoltest = colRanges, fsure = rowRanges_R, 452s + na.rm = na.rm, useNames = useNames) 452s + validateIndicesTestMatrix(x, rows, cols, 452s + fcoltest = colMins, fsure = rowMins_R, 452s + na.rm = na.rm, useNames = useNames) 452s + validateIndicesTestMatrix(x, rows, cols, 452s + fcoltest = colMaxs, fsure = rowMaxs_R, 452s + na.rm = na.rm, useNames = useNames) 452s + } 452s + } 452s + } 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: arm-unknown-linux-gnueabihf (32-bit) 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 > dense_rank <- function(x) match(x, table = sort(unique(x))) 454s > 454s > rowRanks_R <- function(x, ties.method, ..., useNames = TRUE) { 454s + if (ties.method == "dense") { 454s + res <- t(apply(x, MARGIN = 1L, FUN = dense_rank)) 454s + } else { 454s + res <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", ties.method = ties.method)) 454s + } 454s + 454s + # Preserve dimnames attribute? 454s + dim(res) <- dim(x) 454s + dimnames(res) <- if (useNames) dimnames(x) else NULL 454s + 454s + res 454s + } 454s > 454s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = TRUE) { 454s + if (ties.method == "dense") { 454s + res <- t(apply(x, MARGIN = 2L, FUN = dense_rank)) 454s + } else { 454s + res <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 454s + } 454s + 454s + # Preserve dimnames attribute? 454s + tx <- t(x) 454s + dim(res) <- dim(tx) 454s + dimnames(res) <- if (useNames) dimnames(tx) else NULL 454s + 454s + if (preserveShape) res <- t(res) 454s + res 454s + } 454s > 454s > set.seed(1) 454s > 454s > cat("Consistency checks:\n") 454s Consistency checks: 454s > xs <- vector("list", length = 4L) 454s > for (kk in 1:4) { 454s + 454s + # Simulate data in a matrix of any shape 454s + dim <- sample(40:80, size = 2L) 454s + n <- prod(dim) 454s + x <- rnorm(n, sd = 10) 454s + dim(x) <- dim 454s + 454s + # Add NAs? 454s + if ((kk %% 4) %in% c(3, 0)) { 454s + cat("Adding NAs\n") 454s + nna <- sample(n, size = 1L) 454s + x[sample(length(x), size = nna)] <- NA_real_ 454s + } 454s + 454s + # Integer or double? 454s + if ((kk %% 4) %in% c(2, 0)) { 454s + cat("Coercing to integers\n") 454s + storage.mode(x) <- "integer" 454s + } 454s + 454s + xs[[kk]] <- x 454s + } # for (kk ...) 454s Coercing to integers 454s Adding NAs 454s Adding NAs 454s Coercing to integers 454s > str(xs) 454s List of 4 454s $ : num [1:43, 1:78] 13.3 12.72 4.15 -15.4 -9.29 ... 454s $ : int [1:46, 1:61] 2 11 -16 -5 19 5 26 -13 1 -9 ... 454s $ : num [1:42, 1:47] NA -22.3 NA NA NA ... 454s $ : int [1:42, 1:78] NA NA NA NA NA NA NA NA NA NA ... 454s > 454s > for (kk in 1:4) { 454s + cat("Random test #", kk, "\n", sep = "") 454s + x <- xs[[kk]] 454s + tx <- t(x) 454s + 454s + for (ties in c("max", "min", "average", "first", "last", "dense")) { 454s + cat(sprintf("ties.method = %s\n", ties)) 454s + # rowRanks(): 454s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 454s + y2 <- rowRanks_R(x, ties.method = ties) 454s + stopifnot(identical(y1, y2)) 454s + 454s + y3 <- matrixStats::colRanks(tx, ties.method = ties) 454s + stopifnot(identical(y1, y3)) 454s + 454s + # colRanks(): 454s + y1 <- matrixStats::colRanks(x, ties.method = ties) 454s + y2 <- colRanks_R(x, ties.method = ties) 454s + stopifnot(identical(y1, y2)) 454s + 454s + y3 <- matrixStats::rowRanks(tx, ties.method = ties) 454s + stopifnot(identical(y1, y3)) 454s + } 454s + } # for (kk ...) 454s Random test #1 454s ties.method = max 454s ties.method = min 454s ties.method = average 454s ties.method = first 454s ties.method = last 454s ties.method = dense 454s Random test #2 454s ties.method = max 454s ties.method = min 454s ties.method = average 454s ties.method = first 454s ties.method = last 454s ties.method = dense 454s Random test #3 454s ties.method = max 454s ties.method = min 454s ties.method = average 454s ties.method = first 454s ties.method = last 454s ties.method = dense 454s Random test #4 454s ties.method = max 454s ties.method = min 454s ties.method = average 454s ties.method = first 454s ties.method = last 454s ties.method = dense 454s > 454s > # Note, below we know ties.method %in% c("min", "max", "average") is correct 454s > 454s > cat("Consistency checks for random:\n") 454s Consistency checks for random: 454s > tolerance <- 0.1 454s > nsamples <- 10000 454s > for (kk in 1:4) { 454s + cat("Random test #", kk, "\n", sep = "") 454s + x <- xs[[kk]] 454s + tx <- t(x) 454s + 454s + for (ties in c("random")) { 454s + cat(sprintf("ties.method = %s\n", ties)) 454s + 454s + ## rowRanks(): 454s + y0 <- rowRanks_R(x, ties.method = ties) 454s + y1 <- matrixStats::rowRanks(x, ties.method = ties) 454s + 454s + ## Assert symmetric rank differences 454s + d <- y1 - y0 454s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 454s + 454s + ## Assert within [min, max] 454s + y2min <- matrixStats::rowRanks(x, ties.method = "min") 454s + y2max <- matrixStats::rowRanks(x, ties.method = "max") 454s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 454s + ## Assert near average 454s + y1list <- replicate(nsamples, matrixStats::rowRanks(x, ties.method = ties), simplify = FALSE) 454s + y1mean <- Reduce(`+`, y1list) / nsamples 454s + y2avg <- matrixStats::rowRanks(x, ties.method = "average") 454s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 454s + 454s + ## colRanks(): 454s + y0 <- colRanks_R(x, ties.method = ties) 454s + y1 <- matrixStats::colRanks(x, ties.method = ties) 454s + 454s + ## Assert symmetric rank differences 454s + d <- y1 - y0 454s + stopifnot(all(rowSums(d) == 0, na.rm = TRUE)) 454s + 454s + ## Assert within [min, max] 454s + y2min <- matrixStats::colRanks(x, ties.method = "min") 454s + y2max <- matrixStats::colRanks(x, ties.method = "max") 454s + stopifnot(all(y1 >= y2min, na.rm = TRUE) && all(y1 <= y2max, na.rm = TRUE)) 454s + y1list <- replicate(nsamples, matrixStats::colRanks(x, ties.method = ties), simplify = FALSE) 454s + y1mean <- Reduce(`+`, y1list) / nsamples 454s + ## Assert near average 454s + y2avg <- matrixStats::colRanks(x, ties.method = "average") 454s + stopifnot(all(abs(y1mean - y2avg) < tolerance, na.rm = TRUE)) 454s + } 454s + } # for (kk ...) 454s Random test #1 454s ties.method = random 457s Random test #2 457s ties.method = random 460s Random test #3 460s ties.method = random 460s Random test #4 460s ties.method = random 461s > 461s > 461s > ## Exception handling 461s > x <- matrix(1:12, nrow = 3L, ncol = 4L) 461s > y <- try(rowRanks(x, ties.method = "unknown"), silent = TRUE) 461s > stopifnot(inherits(y, "try-error")) 461s > 461s > y <- try(colRanks(x, ties.method = "unknown"), silent = TRUE) 461s > stopifnot(inherits(y, "try-error")) 461s > 461s > dimnames <- list(letters[1:3], LETTERS[1:4]) 461s > for (mode in c("integer", "double")){ 461s + storage.mode(x) <- mode 461s + # Test with and without dimnames on x 461s + for (setDimnames in c(TRUE, FALSE)) { 461s + if (setDimnames) dimnames(x) <- dimnames 461s + else dimnames(x) <- NULL 461s + # Check names attribute 461s + for (useNames in c(TRUE, FALSE)) { 461s + for (ties in c("max", "min", "average", "first", "last", "dense", "random")) { 461s + cat(sprintf("ties.method = %s\n", ties)) 461s + # rowRanks(): 461s + y1 <- matrixStats::rowRanks(x, ties.method = ties, useNames = useNames) 461s + y2 <- rowRanks_R(x, ties.method = ties, useNames = useNames) 461s + stopifnot(identical(y1, y2)) 461s + 461s + y3 <- matrixStats::colRanks(t(x), ties.method = ties, useNames = useNames) 461s + stopifnot(identical(y1, y3)) 461s + 461s + # colRanks(): 461s + y1 <- matrixStats::colRanks(x, ties.method = ties, useNames = useNames) 461s + y2 <- colRanks_R(x, ties.method = ties, useNames = useNames) 461s + stopifnot(identical(y1, y2)) 461s + 461s + y3 <- matrixStats::rowRanks(t(x), ties.method = ties, useNames = useNames) 461s + stopifnot(identical(y1, y3)) 461s + 461s + # Check preserveShape 461s + y1 <- matrixStats::colRanks(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 461s + y2 <- colRanks_R(x, ties.method = ties, preserveShape = TRUE, useNames = useNames) 461s + stopifnot(identical(y1, y2)) 461s + } 461s + } 461s + } 461s + } 461s ties.method = max 461s ties.method = min 461s ties.method = average 461s ties.method = first 461s ties.method = last 461s ties.method = dense 461s ties.method = random 461s ties.method = max 461s ties.method = min 461s ties.method = average 461s ties.method = first 461s ties.method = last 461s ties.method = dense 461s ties.method = random 461s ties.method = max 461s ties.method = min 461s ties.method = average 461s ties.method = first 461s ties.method = last 461s ties.method = dense 461s ties.method = random 461s ties.method = max 461s ties.method = min 461s ties.method = average 461s ties.method = first 461s ties.method = last 461s ties.method = dense 461s ties.method = random 461s ties.method = max 461s ties.method = min 461s ties.method = average 461s ties.method = first 461s ties.method = last 461s ties.method = dense 461s ties.method = random 461s ties.method = max 461s ties.method = min 461s ties.method = average 461s ties.method = first 461s ties.method = last 461s ties.method = dense 461s ties.method = random 461s ties.method = max 461s ties.method = min 461s ties.method = average 461s ties.method = first 461s ties.method = last 461s ties.method = dense 461s ties.method = random 461s ties.method = max 461s ties.method = min 461s ties.method = average 461s ties.method = first 461s ties.method = last 461s ties.method = dense 461s ties.method = random 461s > 461s 461s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 461s Copyright (C) 2025 The R Foundation for Statistical Computing 461s Platform: arm-unknown-linux-gnueabihf (32-bit) 461s 461s R is free software and comes with ABSOLUTELY NO WARRANTY. 461s You are welcome to redistribute it under certain conditions. 461s Type 'license()' or 'licence()' for distribution details. 461s 461s R is a collaborative project with many contributors. 461s Type 'contributors()' for more information and 461s 'citation()' on how to cite R or R packages in publications. 461s 461s Type 'demo()' for some demos, 'help()' for on-line help, or 461s 'help.start()' for an HTML browser interface to help. 461s Type 'q()' to quit R. 461s 462s > library("matrixStats") 462s > 462s > rowRanks_R <- function(x, ties.method = "average", ..., useNames = TRUE) { 462s + ans <- t(apply(x, MARGIN = 1L, FUN = rank, na.last = "keep", 462s + ties.method = ties.method)) 462s + 462s + # Preserve dimnames attribute? 462s + dim(ans) <- dim(x) 462s + dimnames(ans) <- if (useNames) dimnames(x) else NULL 462s + 462s + ans 462s + } 462s > 462s > colRanks_R <- function(x, ties.method, preserveShape = FALSE, ..., useNames = TRUE) { 462s + ans <- t(apply(x, MARGIN = 2L, FUN = rank, na.last = "keep", ties.method = ties.method)) 462s + 462s + # Preserve dimnames attribute? 462s + tx <- t(x) 462s + dim(ans) <- dim(tx) 462s + dimnames(ans) <- if (useNames) dimnames(tx) else NULL 462s + 462s + if (preserveShape) ans <- t(ans) 462s + ans 462s + } 462s > 462s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 462s > # Subsetted tests 462s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 462s > source("utils/validateIndicesFramework.R") 462s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 462s > storage.mode(x) <- "integer" 462s > 462s > # To check dimnames attribute 462s > dimnames <- list(letters[1:6], LETTERS[1:6]) 462s > 462s > colRanks_R_t <- function(x, rows, cols, ..., useNames = TRUE) { 462s + t(colRanks(t(x), rows = cols, cols = rows, preserveShape = TRUE, ..., useNames = useNames)) 462s + } 462s > 462s > # Test with and without dimnames on x 462s > for (setDimnames in c(TRUE, FALSE)) { 462s + if (setDimnames) dimnames(x) <- dimnames 462s + else dimnames(x) <- NULL 462s + 462s + count <- 0L 462s + for (rows in index_cases) { 462s + for (cols in index_cases) { 462s + count <- count + 1L 462s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 462s + useNames <- c(TRUE, FALSE) 462s + useNames <- useNames[count %% length(useNames) + 1] 462s + 462s + validateIndicesTestMatrix(x, rows, cols, 462s + ftest = rowRanks, fsure = rowRanks_R, 462s + ties.method = "average", useNames = useNames) 462s + 462s + validateIndicesTestMatrix(x, rows, cols, 462s + ftest = colRanks_R_t, fsure = rowRanks_R, 462s + ties.method = "average", useNames = useNames) 462s + 462s + for (perserveShape in c(TRUE, FALSE)) { 462s + validateIndicesTestMatrix(x, rows, cols, 462s + ftest = colRanks, fsure = colRanks_R, 462s + ties.method = "average", perserveShape = perserveShape, 462s + useNames = useNames) 462s + } 462s + } 462s + } 462s + } 463s > 463s 463s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 463s Copyright (C) 2025 The R Foundation for Statistical Computing 463s Platform: arm-unknown-linux-gnueabihf (32-bit) 463s 463s R is free software and comes with ABSOLUTELY NO WARRANTY. 463s You are welcome to redistribute it under certain conditions. 463s Type 'license()' or 'licence()' for distribution details. 463s 463s R is a collaborative project with many contributors. 463s Type 'contributors()' for more information and 463s 'citation()' on how to cite R or R packages in publications. 463s 463s Type 'demo()' for some demos, 'help()' for on-line help, or 463s 'help.start()' for an HTML browser interface to help. 463s Type 'q()' to quit R. 463s 463s > library("matrixStats") 463s > 463s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 463s > options(matrixStats.center.onUse = "ignore") 463s > 463s > ## Create isFALSE() if running on an old version of R 463s > if (!exists("isFALSE", mode="function")) { 463s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 463s + } 463s > 463s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 463s + suppressWarnings({ 463s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 463s + }) 463s + stopifnot(!any(is.infinite(sigma))) 463s + 463s + # Keep naming support consistency same as rowSds() 463s + if (is.null(center) || ncol(x) <= 1L) { 463s + if (isFALSE(useNames)) names(sigma) <- NULL 463s + } 463s + else if (isFALSE(useNames)) names(sigma) <- NULL 463s + sigma 463s + } 463s > 463s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 463s + suppressWarnings({ 463s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 463s + }) 463s + stopifnot(!any(is.infinite(sigma))) 463s + 463s + # Keep naming support consistency same as colSds() 463s + if (is.null(center) || nrow(x) <= 1L) { 463s + if (isFALSE(useNames)) names(sigma) <- NULL 463s + } 463s + if (isFALSE(useNames)) names(sigma) <- NULL 463s + sigma 463s + } 463s > 463s > 463s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 463s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 463s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 463s + stopifnot(!any(is.infinite(sigma))) 463s + sigma 463s + } 463s > 463s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 463s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 463s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 463s + stopifnot(!any(is.infinite(sigma))) 463s + sigma 463s + } 463s > 463s > 463s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 463s > # With and without some NAs 463s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 463s > for (mode in c("integer", "double")) { 463s + for (add_na in c(FALSE, TRUE)) { 463s + cat("add_na = ", add_na, "\n", sep = "") 463s + 463s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 463s + if (add_na) { 463s + x[3:7, c(2, 4)] <- NA_real_ 463s + } 463s + cat("mode: ", mode, "\n", sep = "") 463s + storage.mode(x) <- mode 463s + str(x) 463s + 463s + # To check names attribute 463s + dimnames <- list(letters[1:10], LETTERS[1:5]) 463s + 463s + # Test with and without dimnames on x 463s + for (setDimnames in c(TRUE, FALSE)) { 463s + if (setDimnames) dimnames(x) <- dimnames 463s + else dimnames(x) <- NULL 463s + # Row/column ranges 463s + for (na.rm in c(FALSE, TRUE)) { 463s + # Check names attribute 463s + for (useNames in c(TRUE, FALSE)) { 463s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 463s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 463s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 463s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 463s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 463s + stopifnot(all.equal(r1, r2)) 463s + stopifnot(all.equal(r1, r0)) 463s + stopifnot(all.equal(r2, r0)) 463s + stopifnot(all.equal(r1b, r2b)) 463s + stopifnot( 463s + !any(is.infinite(r1)), 463s + !any(is.infinite(r2)), 463s + !any(is.infinite(r1b)), 463s + !any(is.infinite(r2b)) 463s + ) 463s + } 463s + } 463s + } 463s + } # for (add_na ...) 463s + } 463s add_na = FALSE 463s mode: integer 463s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 463s add_na = TRUE 463s mode: integer 463s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 463s add_na = FALSE 463s mode: double 463s 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 ... 463s add_na = TRUE 463s mode: double 463s 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 ... 463s > 463s > 463s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 463s > # All NAs 463s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 463s > for (mode in c("integer", "double")) { 463s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 463s + cat("mode: ", mode, "\n", sep = "") 463s + storage.mode(x) <- mode 463s + str(x) 463s + 463s + # Test with and without dimnames on x 463s + for (setDimnames in c(TRUE, FALSE)) { 463s + if (setDimnames) dimnames(x) <- dimnames 463s + else dimnames(x) <- NULL 463s + # Row/column ranges 463s + for (na.rm in c(FALSE, TRUE)) { 463s + # Check names attribute 463s + for (useNames in c(TRUE, FALSE)) { 463s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 463s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 463s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 463s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 463s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 463s + stopifnot(all.equal(r1, r2)) 463s + stopifnot(all.equal(r1, r0)) 463s + stopifnot(all.equal(r2, r0)) 463s + stopifnot(all.equal(r1b, r2b)) 463s + stopifnot( 463s + !any(is.infinite(r1)), 463s + !any(is.infinite(r2)), 463s + !any(is.infinite(r1b)), 463s + !any(is.infinite(r2b)) 463s + ) 463s + } 463s + } 463s + } 463s + } 463s mode: integer 463s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 463s mode: double 463s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 463s > 463s > 463s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 463s > # A 1x1 matrix 463s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 463s > x <- matrix(0, nrow = 1L, ncol = 1L) 463s > dimnames <- list("a", "A") 463s > for (na.rm in c(FALSE, TRUE)) { 463s + cat("na.rm = ", na.rm, "\n", sep = "") 463s + 463s + # Test with and without dimnames on x 463s + for (setDimnames in c(TRUE, FALSE)) { 463s + if (setDimnames) dimnames(x) <- dimnames 463s + else dimnames(x) <- NULL 463s + # Row/column ranges 463s + for (na.rm in c(FALSE, TRUE)) { 463s + # Check names attribute 463s + for (useNames in c(TRUE, FALSE)) { 463s + r0 <- rowSds_R(x, na.rm = na.rm, useNames = useNames) 463s + r1 <- rowSds(x, na.rm = na.rm, useNames = useNames) 463s + r1b <- rowSds_center(x, na.rm = na.rm, useNames = useNames) 463s + r2 <- colSds(t(x), na.rm = na.rm, useNames = useNames) 463s + r2b <- colSds_center(t(x), na.rm = na.rm, useNames = useNames) 463s + stopifnot(all.equal(r1, r2)) 463s + stopifnot(all.equal(r1, r0)) 463s + stopifnot(all.equal(r2, r0)) 463s + stopifnot(all.equal(r1b, r2b)) 463s + stopifnot( 463s + !any(is.infinite(r1)), 463s + !any(is.infinite(r2)), 463s + !any(is.infinite(r1b)), 463s + !any(is.infinite(r2b)) 463s + ) 463s + } 463s + } 463s + } 463s + } 463s na.rm = FALSE 463s na.rm = TRUE 463s > 463s 463s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 463s Copyright (C) 2025 The R Foundation for Statistical Computing 463s Platform: arm-unknown-linux-gnueabihf (32-bit) 463s 463s R is free software and comes with ABSOLUTELY NO WARRANTY. 463s You are welcome to redistribute it under certain conditions. 463s Type 'license()' or 'licence()' for distribution details. 463s 463s R is a collaborative project with many contributors. 463s Type 'contributors()' for more information and 463s 'citation()' on how to cite R or R packages in publications. 463s 463s Type 'demo()' for some demos, 'help()' for on-line help, or 463s 'help.start()' for an HTML browser interface to help. 463s Type 'q()' to quit R. 463s 463s > library("matrixStats") 463s > 463s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 463s > options(matrixStats.center.onUse = "ignore") 463s > 463s > ## Create isFALSE() if running on an old version of R 463s > if (!exists("isFALSE", mode="function")) { 463s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 463s + } 463s > 463s > rowSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 463s + suppressWarnings({ 463s + sigma <- apply(x, MARGIN = 1L, FUN = sd, na.rm = na.rm) 463s + }) 463s + stopifnot(!any(is.infinite(sigma))) 463s + 463s + # Keep naming support consistency same as rowSds() 463s + if (is.null(center) || ncol(x) <= 1L) { 463s + if (isFALSE(useNames)) names(sigma) <- NULL 463s + } 463s + else if (isFALSE(useNames)) names(sigma) <- NULL 463s + sigma 463s + } 463s > 463s > colSds_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 463s + suppressWarnings({ 463s + sigma <- apply(x, MARGIN = 2L, FUN = sd, na.rm = na.rm) 463s + }) 463s + stopifnot(!any(is.infinite(sigma))) 463s + 463s + # Keep naming support consistency same as colSds() 463s + if (is.null(center) || nrow(x) <= 1L) { 463s + if (isFALSE(useNames)) names(sigma) <- NULL 463s + } 463s + else if (isFALSE(useNames)) names(sigma) <- NULL 463s + sigma 463s + } 463s > 463s > 463s > rowSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 463s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 463s + sigma <- rowSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 463s + stopifnot(!any(is.infinite(sigma))) 463s + sigma 463s + } 463s > 463s > colSds_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 463s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 463s + sigma <- colSds(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 463s + stopifnot(!any(is.infinite(sigma))) 463s + sigma 463s + } 463s > 463s > 463s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 463s > # Subsetted tests 463s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 463s > source("utils/validateIndicesFramework.R") 463s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 463s > storage.mode(x) <- "integer" 463s > 463s > # To check names attribute 463s > dimnames <- list(letters[1:6], LETTERS[1:6]) 463s > 463s > # Test with and without dimnames on x 463s > for (setDimnames in c(TRUE, FALSE)) { 463s + if (setDimnames) dimnames(x) <- dimnames 463s + else dimnames(x) <- NULL 463s + 463s + count <- 0L 463s + for (rows in index_cases) { 463s + for (cols in index_cases) { 463s + count <- count + 1L 463s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 463s + useNames <- c(TRUE, FALSE) 463s + useNames <- useNames[count %% length(useNames) + 1] 463s + 463s + validateIndicesTestMatrix(x, rows, cols, 463s + ftest = rowSds, fsure = rowSds_R, 463s + na.rm = na.rm, useNames = useNames) 463s + validateIndicesTestMatrix(x, rows, cols, 463s + ftest = rowSds_center, fsure = rowSds_R, 463s + na.rm = na.rm, center = TRUE, useNames = useNames) 463s + 463s + validateIndicesTestMatrix(x, rows, cols, 463s + fcoltest = colSds, fsure = rowSds_R, 463s + na.rm = na.rm, useNames = useNames) 463s + validateIndicesTestMatrix(x, rows, cols, 463s + fcoltest = colSds_center, fsure = rowSds_R, 463s + na.rm = na.rm, center = TRUE, useNames = useNames) 463s + } 463s + } 463s + } 464s > 464s 464s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 464s Copyright (C) 2025 The R Foundation for Statistical Computing 464s Platform: arm-unknown-linux-gnueabihf (32-bit) 464s 464s R is free software and comes with ABSOLUTELY NO WARRANTY. 464s You are welcome to redistribute it under certain conditions. 464s Type 'license()' or 'licence()' for distribution details. 464s 464s R is a collaborative project with many contributors. 464s Type 'contributors()' for more information and 464s 'citation()' on how to cite R or R packages in publications. 464s 464s Type 'demo()' for some demos, 'help()' for on-line help, or 464s 'help.start()' for an HTML browser interface to help. 464s Type 'q()' to quit R. 464s 464s > library("matrixStats") 464s > 464s > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 464s + ## FIXME: sum() may overflow for integers, whereas 464s + ## base::rowSums() doesn't. What should rowSums2() do? 464s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 464s + res <- rowSums(x, na.rm = na.rm) 464s + if (!useNames) names(res) <- NULL 464s + res 464s + } 464s > 464s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 464s + ## FIXME: sum() may overflow for integers, whereas 464s + ## base::colSums() doesn't. What should colSums2() do? 464s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 464s + res <- colSums(x, na.rm = na.rm) 464s + if (!useNames) names(res) <- NULL 464s + res 464s + } 464s > 464s > for (mode in c("integer", "logical", "double")) { 464s + x <- matrix(-4:4, nrow = 3, ncol = 3) 464s + storage.mode(x) <- mode 464s + if (mode == "double") x <- x + 0.1 464s + 464s + # To check names attribute 464s + dimnames <- list(letters[1:3], LETTERS[1:3]) 464s + 464s + # Test with and without dimnames on x 464s + for (setDimnames in c(TRUE, FALSE)) { 464s + if (setDimnames) dimnames(x) <- dimnames 464s + else dimnames(x) <- NULL 464s + # Check names attribute 464s + for (useNames in c(TRUE, FALSE)) { 464s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + 464s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + } 464s + } 464s + } 464s > 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > # Special case: Single-element matrix 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > cat("Special case: Single-element matrix:\n") 464s Special case: Single-element matrix: 464s > for (mode in c("integer", "logical", "double")) { 464s + x <- matrix(1, nrow = 1, ncol = 1) 464s + storage.mode(x) <- mode 464s + 464s + # To check names attribute 464s + dimnames <- list("a", "A") 464s + 464s + # Test with and without dimnames on x 464s + for (setDimnames in c(TRUE, FALSE)) { 464s + if (setDimnames) dimnames(x) <- dimnames 464s + else dimnames(x) <- NULL 464s + # Check names attribute 464s + for (useNames in c(TRUE, FALSE)) { 464s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + 464s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + } 464s + } 464s + } 464s > 464s > 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > # Special case: Empty matrix 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > cat("Special case: Empty matrix:\n") 464s Special case: Empty matrix: 464s > for (mode in c("integer", "logical", "double")) { 464s + x <- matrix(integer(0), nrow = 0, ncol = 0) 464s + storage.mode(x) <- mode 464s + 464s + y0 <- rowSums2_R(x, na.rm = FALSE) 464s + y1 <- rowSums2(x, na.rm = FALSE) 464s + stopifnot(all.equal(y1, y0)) 464s + 464s + y0 <- colSums2_R(x, na.rm = FALSE) 464s + y1 <- colSums2(x, na.rm = FALSE) 464s + stopifnot(all.equal(y1, y0)) 464s + } 464s > 464s > 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > # Special case: All NAs 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > cat("Special case: All NAs:\n") 464s Special case: All NAs: 464s > for (mode in c("integer", "logical", "double")) { 464s + x <- matrix(NA_integer_, nrow = 3, ncol = 3) 464s + storage.mode(x) <- mode 464s + 464s + # To check names attribute 464s + dimnames <- list(letters[1:3], LETTERS[1:3]) 464s + 464s + # Test with and without dimnames on x 464s + for (setDimnames in c(TRUE, FALSE)) { 464s + if (setDimnames) dimnames(x) <- dimnames 464s + else dimnames(x) <- NULL 464s + # Check names attribute 464s + for (useNames in c(TRUE, FALSE)) { 464s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 464s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + 464s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 464s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + } 464s + } 464s + } 464s > 464s > 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > # Special case: All NaNs 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > cat("Special case: All NaNs:\n") 464s Special case: All NaNs: 464s > x <- matrix(NA_real_, nrow = 3, ncol = 3) 464s > 464s > # Test with and without dimnames on x 464s > for (setDimnames in c(TRUE, FALSE)) { 464s + if (setDimnames) dimnames(x) <- dimnames 464s + else dimnames(x) <- NULL 464s + # Check names attribute 464s + for (useNames in c(TRUE, FALSE)) { 464s + y0 <- rowSums2_R(x, na.rm = TRUE, useNames = useNames) 464s + y1 <- rowSums2(x, na.rm = TRUE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + 464s + y0 <- colSums2_R(x, na.rm = TRUE, useNames = useNames) 464s + y1 <- colSums2(x, na.rm = TRUE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + } 464s + } 464s > 464s > 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > # Special case: All Infs 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > cat("Special case: All Infs:\n") 464s Special case: All Infs: 464s > x <- matrix(Inf, nrow = 3, ncol = 3) 464s > 464s > # Test with and without dimnames on x 464s > for (setDimnames in c(TRUE, FALSE)) { 464s + if (setDimnames) dimnames(x) <- dimnames 464s + else dimnames(x) <- NULL 464s + # Check names attribute 464s + for (useNames in c(TRUE, FALSE)) { 464s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + 464s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + } 464s + } 464s > 464s > 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > # Special case: All -Infs 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > cat("Special case: All -Infs:\n") 464s Special case: All -Infs: 464s > x <- matrix(-Inf, nrow = 3, ncol = 3) 464s > 464s > # Test with and without dimnames on x 464s > for (setDimnames in c(TRUE, FALSE)) { 464s + if (setDimnames) dimnames(x) <- dimnames 464s + else dimnames(x) <- NULL 464s + # Check names attribute 464s + for (useNames in c(TRUE, FALSE)) { 464s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + 464s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + } 464s + } 464s > 464s > 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > # Special case: Infs and -Infs 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > cat("Special case: Infs and -Infs:\n") 464s Special case: Infs and -Infs: 464s > x <- matrix(c(-Inf, +Inf), nrow = 4, ncol = 4) 464s > 464s > # To check names attribute 464s > dimnames <- list(letters[1:4], LETTERS[1:4]) 464s > 464s > # Test with and without dimnames on x 464s > for (setDimnames in c(TRUE, FALSE)) { 464s + if (setDimnames) dimnames(x) <- dimnames 464s + else dimnames(x) <- NULL 464s + # Check names attribute 464s + for (useNames in c(TRUE, FALSE)) { 464s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + 464s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + } 464s + } 464s > 464s > 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > # Special case: NaNs and NAs 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > cat("Special case: Infs and -Infs:\n") 464s Special case: Infs and -Infs: 464s > x <- matrix(c(NaN, NA_real_), nrow = 4, ncol = 4) 464s > 464s > y0 <- rowSums(x, na.rm = FALSE) 464s > str(y0) 464s num [1:4] NaN NA NaN NA 464s > stopifnot(all(is.na(y0)), length(unique(y0)) >= 1L) 464s > y1 <- rowSums2(x, na.rm = FALSE) 464s > str(y0) 464s num [1:4] NaN NA NaN NA 464s > stopifnot(all(is.na(y1)), length(unique(y1)) >= 1L) 464s > stopifnot(all.equal(y1, y0)) 464s > 464s > y0 <- colSums(x, na.rm = FALSE) 464s > stopifnot(all(is.na(y0)), length(unique(y0)) == 1L) 464s > y1 <- colSums2(x, na.rm = FALSE) 464s > stopifnot(all(is.na(y1)), length(unique(y1)) == 1L) 464s > ## NOTE, due to compiler optimization, it is not guaranteed that NA is 464s > ## returned here (as one would expect). NaN might very well be returned, 464s > ## when both NA and NaN are involved. This is an accepted feature in R, 464s > ## which is documented in help("is.nan"). See also 464s > ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 464s > ## Thus, we cannot guarantee that y1 is identical to y0. 464s > 464s > 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > # Special case: Integer overflow with ties 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > cat("Special case: Integer overflow with ties:\n") 464s Special case: Integer overflow with ties: 464s > x <- matrix(.Machine$integer.max, nrow = 4, ncol = 4) 464s > 464s > # Test with and without dimnames on x 464s > for (setDimnames in c(TRUE, FALSE)) { 464s + if (setDimnames) dimnames(x) <- dimnames 464s + else dimnames(x) <- NULL 464s + # Check names attribute 464s + for (useNames in c(TRUE, FALSE)) { 464s + y0 <- rowSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- rowSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + 464s + y0 <- colSums2_R(x, na.rm = FALSE, useNames = useNames) 464s + y1 <- colSums2(x, na.rm = FALSE, useNames = useNames) 464s + stopifnot(all.equal(y1, y0)) 464s + } 464s + } 464s > 464s > 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > # Consistency checks 464s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 464s > set.seed(1) 464s > 464s > cat("Consistency checks:\n") 464s Consistency checks: 464s > n_sims <- if (Sys.getenv("_R_CHECK_USE_VALGRIND_") != "") 4L else 20L 464s > for (kk in seq_len(n_sims)) { 464s + cat("Random test #", kk, "\n", sep = "") 464s + 464s + # Simulate data in a matrix of any shape 464s + dim <- sample(50:200, size = 2) 464s + n <- prod(dim) 464s + x <- rnorm(n, sd = 100) 464s + dim(x) <- dim 464s + 464s + # Add NAs? 464s + if ((kk %% 4) %in% c(3, 0)) { 464s + cat("Adding NAs\n") 464s + nna <- sample(n, size = 1) 464s + na_values <- c(NA_real_, NaN) 464s + t <- sample(na_values, size = nna, replace = TRUE) 464s + x[sample(length(x), size = nna)] <- t 464s + } 464s + 464s + # Mode? 464s + modes <- "double" 464s + if ((kk %% 4) %in% c(2, 0)) { 464s + modes <- c("integer", "logical") 464s + } 464s + 464s + for (mode in modes) { 464s + if (mode != "double") { 464s + cat(sprintf("Coercing from %s to %s\n", storage.mode(x), mode)) 464s + storage.mode(x) <- mode 465s + } 465s + 465s + na.rm <- sample(c(TRUE, FALSE), size = 1) 465s + 465s + # rowSums2(): 465s + y0 <- rowSums2_R(x, na.rm = na.rm) 465s + y1 <- rowSums2(x, na.rm = na.rm) 465s + stopifnot(all.equal(y1, y0)) 465s + y2 <- colSums2(t(x), na.rm = na.rm) 465s + stopifnot(all.equal(y2, y0)) 465s + 465s + # colSums2(): 465s + y0 <- colSums2_R(x, na.rm = na.rm) 465s + y1 <- colSums2(x, na.rm = na.rm) 465s + stopifnot(all.equal(y1, y0)) 465s + y2 <- rowSums2(t(x), na.rm = na.rm) 465s + stopifnot(all.equal(y2, y0)) 465s + } 465s + } # for (kk ...) 465s Random test #1 465s Random test #2 465s Coercing from double to integer 465s Coercing from integer to logical 465s Random test #3 465s Adding NAs 465s Random test #4 465s Adding NAs 465s Coercing from double to integer 465s Coercing from integer to logical 465s Random test #5 465s Random test #6 465s Coercing from double to integer 465s Coercing from integer to logical 465s Random test #7 465s Adding NAs 465s Random test #8 465s Adding NAs 465s Coercing from double to integer 465s Coercing from integer to logical 465s Random test #9 465s Random test #10 465s Coercing from double to integer 465s Coercing from integer to logical 465s Random test #11 465s Adding NAs 465s Random test #12 465s Adding NAs 465s Coercing from double to integer 465s Coercing from integer to logical 465s Random test #13 465s Random test #14 465s Coercing from double to integer 465s Coercing from integer to logical 465s Random test #15 465s Adding NAs 465s Random test #16 465s Adding NAs 465s Coercing from double to integer 465s Coercing from integer to logical 465s Random test #17 465s Random test #18 465s Coercing from double to integer 465s Coercing from integer to logical 465s Random test #19 465s Adding NAs 465s Random test #20 465s Adding NAs 465s Coercing from double to integer 465s Coercing from integer to logical 465s > 465s 465s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 465s Copyright (C) 2025 The R Foundation for Statistical Computing 465s Platform: arm-unknown-linux-gnueabihf (32-bit) 465s 465s R is free software and comes with ABSOLUTELY NO WARRANTY. 465s You are welcome to redistribute it under certain conditions. 465s Type 'license()' or 'licence()' for distribution details. 465s 465s R is a collaborative project with many contributors. 465s Type 'contributors()' for more information and 465s 'citation()' on how to cite R or R packages in publications. 465s 465s Type 'demo()' for some demos, 'help()' for on-line help, or 465s 'help.start()' for an HTML browser interface to help. 465s Type 'q()' to quit R. 465s 465s > library("matrixStats") 465s > 465s > rowSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 465s + ## FIXME: sum() may overflow for integers, whereas 465s + ## base::rowSums() doesn't. What should rowSums2() do? 465s + ## apply(x, MARGIN = 1L, FUN = sum, na.rm = na.rm) 465s + res <- rowSums(x, na.rm = na.rm) 465s + if (!useNames) names(res) <- NULL 465s + res 465s + } 465s > 465s > colSums2_R <- function(x, na.rm = FALSE, ..., useNames = TRUE) { 465s + ## FIXME: sum() may overflow for integers, whereas 465s + ## base::colSums() doesn't. What should colSums2() do? 465s + ## apply(x, MARGIN = 2L, FUN = sum, na.rm = na.rm) 465s + res <- colSums(x, na.rm = na.rm) 465s + if (!useNames) names(res) <- NULL 465s + res 465s + } 465s > 465s > 465s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 465s > # Subsetted tests 465s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 465s > source("utils/validateIndicesFramework.R") 465s > x <- matrix(runif(6 * 6, min = -3, max = 3), nrow = 6, ncol = 6) 465s > storage.mode(x) <- "integer" 465s > 465s > # To check names attribute 465s > dimnames <- list(letters[1:6], LETTERS[1:6]) 465s > 465s > # Test with and without dimnames on x 465s > for (setDimnames in c(TRUE, FALSE)) { 465s + if (setDimnames) dimnames(x) <- dimnames 465s + else dimnames(x) <- NULL 465s + for (rows in index_cases) { 465s + for (cols in index_cases) { 465s + for (na.rm in c(TRUE, FALSE)) { 465s + for (useNames in c(TRUE, FALSE)) { 465s + validateIndicesTestMatrix(x, rows, cols, 465s + ftest = rowSums2, fsure = rowSums2_R, 465s + na.rm = na.rm, useNames = useNames) 465s + validateIndicesTestMatrix(x, rows, cols, 465s + fcoltest = colSums2, fsure = rowSums2_R, 465s + na.rm = na.rm, useNames = useNames) 465s + } 465s + } 465s + } 465s + } 465s + } 465s > 466s 466s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 466s Copyright (C) 2025 The R Foundation for Statistical Computing 466s Platform: arm-unknown-linux-gnueabihf (32-bit) 466s 466s R is free software and comes with ABSOLUTELY NO WARRANTY. 466s You are welcome to redistribute it under certain conditions. 466s Type 'license()' or 'licence()' for distribution details. 466s 466s R is a collaborative project with many contributors. 466s Type 'contributors()' for more information and 466s 'citation()' on how to cite R or R packages in publications. 466s 466s Type 'demo()' for some demos, 'help()' for on-line help, or 466s 'help.start()' for an HTML browser interface to help. 466s Type 'q()' to quit R. 466s 466s > library("matrixStats") 466s > 466s > nrow <- 6L 466s > ncol <- 5L 466s > data <- matrix(0:4, nrow = nrow, ncol = ncol) 466s > 466s > # To check names attribute 466s > dimnames <- list(letters[1:6], LETTERS[1:5]) 466s > 466s > modes <- c("integer", "logical", "raw") 466s > for (mode in modes) { 466s + cat(sprintf("Mode: %s...\n", mode)) 466s + 466s + x <- data 466s + if (mode == "logical") x <- x - 2L 466s + if (mode != "raw") x[c(2,5,7)] <- NA_integer_ 466s + storage.mode(x) <- mode 466s + print(x) 466s + 466s + unique_values <- unique(as.vector(x)) 466s + nbr_of_unique_values <- length(unique_values) 466s + 466s + y <- rowTabulates(x) 466s + print(y) 466s + stopifnot( 466s + identical(dim(y), c(nrow, nbr_of_unique_values)), 466s + all(y >= 0) 466s + ) 466s + if (mode != "raw") { 466s + y0 <- t(table(x, row(x), useNA = "always")[, seq_len(nrow(x))]) 466s + stopifnot(all(y == y0)) 466s + } 466s + # Check names attribute 466s + dimnames(x) <- dimnames 466s + y1 <- rowTabulates(x, useNames = FALSE) 466s + stopifnot(all.equal(y1, y)) 466s + y <- rowTabulates(x, useNames = TRUE) 466s + stopifnot(identical(rownames(y), rownames(x))) 466s + dimnames(x) <- NULL 466s + 466s + y <- colTabulates(x) 466s + print(y) 466s + stopifnot( 466s + identical(dim(y), c(ncol, nbr_of_unique_values)), 466s + all(y >= 0) 466s + ) 466s + if (mode != "raw") { 466s + y0 <- t(table(x, col(x), useNA = "always")[, seq_len(ncol(x))]) 466s + stopifnot(all(y == y0)) 466s + } 466s + # Check names attribute 466s + dimnames(x) <- dimnames 466s + y1 <- colTabulates(x, useNames = FALSE) 466s + stopifnot(all.equal(y1, y)) 466s + y <- colTabulates(x, useNames = TRUE) 466s + stopifnot(identical(rownames(y), colnames(x))) 466s + dimnames(x) <- NULL 466s + 466s + # Count only certain values 466s + if (mode == "integer") { 466s + subset <- c(0:2, NA_integer_) 466s + } else if (mode == "logical") { 466s + subset <- c(TRUE, FALSE, NA) 466s + } else { 466s + subset <- c(0:2) 466s + } 466s + y <- rowTabulates(x, values = subset) 466s + print(y) 466s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 466s + # Check names attribute 466s + dimnames(x) <- dimnames 466s + y1 <- rowTabulates(x, values = subset, useNames = FALSE) 466s + stopifnot(all.equal(y1, y)) 466s + y <- rowTabulates(x, values = subset, useNames = TRUE) 466s + stopifnot(identical(rownames(y), rownames(x))) 466s + dimnames(x) <- NULL 466s + 466s + y <- colTabulates(x, values = subset) 466s + print(y) 466s + stopifnot(identical(dim(y), c(ncol, length(subset)))) 466s + # Check names attribute 466s + dimnames(x) <- dimnames 466s + y1 <- colTabulates(x, values = subset, useNames = FALSE) 466s + stopifnot(all.equal(y1, y)) 466s + y <- colTabulates(x, values = subset, useNames = TRUE) 466s + stopifnot(identical(rownames(y), colnames(x))) 466s + dimnames(x) <- NULL 466s + 466s + # Raw 466s + if (mode %in% c("integer", "raw")) { 466s + subset <- c(0:2) 466s + 466s + y <- rowTabulates(x, values = as.raw(subset)) 466s + print(y) 466s + stopifnot(identical(dim(y), c(nrow, length(subset)))) 466s + # Check names attribute 466s + dimnames(x) <- dimnames 466s + y1 <- rowTabulates(x, values = as.raw(subset), useNames = FALSE) 466s + stopifnot(all.equal(y1, y)) 466s + y3 <- rowTabulates(x, values = as.raw(subset), useNames = TRUE) 466s + stopifnot(identical(rownames(y3), rownames(x))) 466s + dimnames(x) <- NULL 466s + 466s + y2 <- colTabulates(t(x), values = as.raw(subset)) 466s + print(y2) 466s + stopifnot( 466s + identical(dim(y2), c(nrow, length(subset))), 466s + identical(y2, y) 466s + ) 466s + # Check names attribute 466s + dimnames(x) <- dimnames 466s + y1 <- colTabulates(t(x), values = as.raw(subset), useNames = FALSE) 466s + stopifnot(all.equal(y1, y)) 466s + y <- colTabulates(t(x), values = as.raw(subset), useNames = TRUE) 466s + stopifnot(identical(rownames(y), colnames(t(x)))) 466s + dimnames(x) <- NULL 466s + } 466s + 466s + cat(sprintf("Mode: %s...done\n", mode)) 466s + } # for (mode ...) 466s Mode: integer... 466s [,1] [,2] [,3] [,4] [,5] 466s [1,] 0 NA 2 3 4 466s [2,] NA 2 3 4 0 466s [3,] 2 3 4 0 1 466s [4,] 3 4 0 1 2 466s [5,] NA 0 1 2 3 466s [6,] 0 1 2 3 4 466s 0 1 2 3 4 466s [1,] 1 0 1 1 1 1 466s [2,] 1 0 1 1 1 1 466s [3,] 1 1 1 1 1 0 466s [4,] 1 1 1 1 1 0 466s [5,] 1 1 1 1 0 1 466s [6,] 1 1 1 1 1 0 466s 0 1 2 3 4 466s [1,] 2 0 1 1 0 2 466s [2,] 1 1 1 1 1 1 466s [3,] 1 1 2 1 1 0 466s [4,] 1 1 1 2 1 0 466s [5,] 1 1 1 1 2 0 466s 0 1 2 466s [1,] 1 0 1 1 466s [2,] 1 0 1 1 466s [3,] 1 1 1 0 466s [4,] 1 1 1 0 466s [5,] 1 1 1 1 466s [6,] 1 1 1 0 466s 0 1 2 466s [1,] 2 0 1 2 466s [2,] 1 1 1 1 466s [3,] 1 1 2 0 466s [4,] 1 1 1 0 466s [5,] 1 1 1 0 466s 0x0 0x1 0x2 466s [1,] 1 0 1 466s [2,] 1 0 1 466s [3,] 1 1 1 466s [4,] 1 1 1 466s [5,] 1 1 1 466s [6,] 1 1 1 466s 0x0 0x1 0x2 466s [1,] 1 0 1 466s [2,] 1 0 1 466s [3,] 1 1 1 466s [4,] 1 1 1 466s [5,] 1 1 1 466s [6,] 1 1 1 466s Mode: integer...done 466s Mode: logical... 466s [,1] [,2] [,3] [,4] [,5] 466s [1,] TRUE NA FALSE TRUE TRUE 466s [2,] NA FALSE TRUE TRUE TRUE 466s [3,] FALSE TRUE TRUE TRUE TRUE 466s [4,] TRUE TRUE TRUE TRUE FALSE 466s [5,] NA TRUE TRUE FALSE TRUE 466s [6,] TRUE TRUE FALSE TRUE TRUE 466s FALSE TRUE 466s [1,] 1 3 1 466s [2,] 1 3 1 466s [3,] 1 4 0 466s [4,] 1 4 0 466s [5,] 1 3 1 466s [6,] 1 4 0 466s FALSE TRUE 466s [1,] 1 3 2 466s [2,] 1 4 1 466s [3,] 2 4 0 466s [4,] 1 5 0 466s [5,] 1 5 0 466s TRUE FALSE 466s [1,] 3 1 1 466s [2,] 3 1 1 466s [3,] 4 1 0 466s [4,] 4 1 0 466s [5,] 3 1 1 466s [6,] 4 1 0 466s TRUE FALSE 466s [1,] 3 1 2 466s [2,] 4 1 1 466s [3,] 4 2 0 466s [4,] 5 1 0 466s [5,] 5 1 0 466s Mode: logical...done 466s Mode: raw... 466s [,1] [,2] [,3] [,4] [,5] 466s [1,] 00 01 02 03 04 466s [2,] 01 02 03 04 00 466s [3,] 02 03 04 00 01 466s [4,] 03 04 00 01 02 466s [5,] 04 00 01 02 03 466s [6,] 00 01 02 03 04 466s 0x0 0x1 0x2 0x3 0x4 466s [1,] 1 1 1 1 1 466s [2,] 1 1 1 1 1 466s [3,] 1 1 1 1 1 466s [4,] 1 1 1 1 1 466s [5,] 1 1 1 1 1 466s [6,] 1 1 1 1 1 466s 0x0 0x1 0x2 0x3 0x4 466s [1,] 2 1 1 1 1 466s [2,] 1 2 1 1 1 466s [3,] 1 1 2 1 1 466s [4,] 1 1 1 2 1 466s [5,] 1 1 1 1 2 466s 0 1 2 466s [1,] 1 1 1 466s [2,] 1 1 1 466s [3,] 1 1 1 466s [4,] 1 1 1 466s [5,] 1 1 1 466s [6,] 1 1 1 466s 0 1 2 466s [1,] 2 1 1 466s [2,] 1 2 1 466s [3,] 1 1 2 466s [4,] 1 1 1 466s [5,] 1 1 1 466s 0x0 0x1 0x2 466s [1,] 1 1 1 466s [2,] 1 1 1 466s [3,] 1 1 1 466s [4,] 1 1 1 466s [5,] 1 1 1 466s [6,] 1 1 1 466s 0x0 0x1 0x2 466s [1,] 1 1 1 466s [2,] 1 1 1 466s [3,] 1 1 1 466s [4,] 1 1 1 466s [5,] 1 1 1 466s [6,] 1 1 1 466s Mode: raw...done 466s > 466s 466s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 466s Copyright (C) 2025 The R Foundation for Statistical Computing 466s Platform: arm-unknown-linux-gnueabihf (32-bit) 466s 466s R is free software and comes with ABSOLUTELY NO WARRANTY. 466s You are welcome to redistribute it under certain conditions. 466s Type 'license()' or 'licence()' for distribution details. 466s 466s R is a collaborative project with many contributors. 466s Type 'contributors()' for more information and 466s 'citation()' on how to cite R or R packages in publications. 466s 466s Type 'demo()' for some demos, 'help()' for on-line help, or 466s 'help.start()' for an HTML browser interface to help. 466s Type 'q()' to quit R. 466s 466s > library("matrixStats") 466s > 466s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 466s > # Subsetted tests 466s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 466s > source("utils/validateIndicesFramework.R") 466s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 466s > storage.mode(x) <- "integer" 466s > 466s > # To check names attribute 466s > dimnames <- list(letters[1:6], LETTERS[1:6]) 466s > 466s > # Test with and without dimnames on x 466s > for (setDimnames in c(TRUE, FALSE)) { 466s + if (setDimnames) dimnames(x) <- dimnames 466s + else dimnames(x) <- NULL 466s + 466s + count <- 0L 466s + for (rows in index_cases) { 466s + for (cols in index_cases) { 466s + count <- count + 1L 466s + useNames <- c(TRUE, FALSE) 466s + useNames <- useNames[count %% length(useNames) + 1] 466s + 466s + validateIndicesTestMatrix(x, rows, cols, 466s + ftest = rowTabulates, fsure = rowTabulates, useNames = useNames) 466s + validateIndicesTestMatrix(x, rows, cols, 466s + ftest = rowTabulates, fsure = rowTabulates, 466s + values = 1:3, useNames = useNames) 466s + 466s + validateIndicesTestMatrix(x, rows, cols, 466s + ftest = colTabulates, fsure = colTabulates, useNames = useNames) 466s + validateIndicesTestMatrix(x, rows, cols, 466s + ftest = colTabulates, fsure = colTabulates, 466s + values = 1:3, useNames = useNames) 466s + } 466s + } 466s + } 467s > 467s 467s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 467s Copyright (C) 2025 The R Foundation for Statistical Computing 467s Platform: arm-unknown-linux-gnueabihf (32-bit) 467s 467s R is free software and comes with ABSOLUTELY NO WARRANTY. 467s You are welcome to redistribute it under certain conditions. 467s Type 'license()' or 'licence()' for distribution details. 467s 467s R is a collaborative project with many contributors. 467s Type 'contributors()' for more information and 467s 'citation()' on how to cite R or R packages in publications. 467s 467s Type 'demo()' for some demos, 'help()' for on-line help, or 467s 'help.start()' for an HTML browser interface to help. 467s Type 'q()' to quit R. 467s 468s > library("matrixStats") 468s > 468s > fcns <- list( 468s + rowVarDiffs = list(rowVarDiffs, colVarDiffs), 468s + rowSdDiffs = list(rowSdDiffs, colSdDiffs), 468s + rowMadDiffs = list(rowMadDiffs, colMadDiffs), 468s + rowIQRDiffs = list(rowIQRDiffs, colIQRDiffs) 468s + ) 468s > 468s > for (fcn in names(fcns)) { 468s + cat(sprintf("%s()...\n", fcn)) 468s + row_fcn <- fcns[[fcn]][[1L]] 468s + col_fcn <- fcns[[fcn]][[2L]] 468s + 468s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 468s + # With and without some NAs 468s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 468s + for (mode in c("integer", "double")) { 468s + for (add_na in c(FALSE, TRUE)) { 468s + cat("add_na = ", add_na, "\n", sep = "") 468s + 468s + x <- matrix(1:50 + 0.1, nrow = 10L, ncol = 5L) 468s + if (add_na) { 468s + x[3:7, c(2, 4)] <- NA_real_ 468s + } 468s + cat("mode: ", mode, "\n", sep = "") 468s + storage.mode(x) <- mode 468s + str(x) 468s + 468s + # To check names attribute 468s + dimnames <- list(letters[1:10], LETTERS[1:5]) 468s + 468s + # Test with and without dimnames on x 468s + for (setDimnames in c(TRUE, FALSE)) { 468s + if (setDimnames) dimnames(x) <- dimnames 468s + else dimnames(x) <- NULL 468s + # Row/column ranges 468s + for (na.rm in c(FALSE, TRUE)) { 468s + # Check names attribute 468s + for (useNames in c(TRUE, FALSE)) { 468s + cat("na.rm = ", na.rm, "\n", sep = "") 468s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 468s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 468s + stopifnot(all.equal(r1, r2)) 468s + } 468s + } 468s + } 468s + } # for (add_na ...) 468s + } 468s + 468s + 468s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 468s + # All NAs 468s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 468s + for (mode in c("integer", "double")) { 468s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 468s + cat("mode: ", mode, "\n", sep = "") 468s + storage.mode(x) <- mode 468s + str(x) 468s + 468s + # Test with and without dimnames on x 468s + for (setDimnames in c(TRUE, FALSE)) { 468s + if (setDimnames) dimnames(x) <- dimnames 468s + else dimnames(x) <- NULL 468s + # Row/column ranges 468s + for (na.rm in c(FALSE, TRUE)) { 468s + # Check names attribute 468s + for (useNames in c(TRUE, FALSE)) { 468s + cat("na.rm = ", na.rm, "\n", sep = "") 468s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 468s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 468s + stopifnot(all.equal(r1, r2)) 468s + } 468s + } 468s + } 468s + } 468s + 468s + 468s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 468s + # A 1x1 matrix 468s + # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 468s + x <- matrix(0, nrow = 1L, ncol = 1L) 468s + dimnames <- list("a", "A") 468s + # Test with and without dimnames on x 468s + for (setDimnames in c(TRUE, FALSE)) { 468s + if (setDimnames) dimnames(x) <- dimnames 468s + else dimnames(x) <- NULL 468s + # Row/column ranges 468s + for (na.rm in c(FALSE, TRUE)) { 468s + # Check names attribute 468s + for (useNames in c(TRUE, FALSE)) { 468s + cat("na.rm = ", na.rm, "\n", sep = "") 468s + r1 <- row_fcn(x, na.rm = na.rm, useNames = useNames) 468s + r2 <- col_fcn(t(x), na.rm = na.rm, useNames = useNames) 468s + stopifnot(all.equal(r1, r2)) 468s + } 468s + } 468s + } 468s + 468s + cat(sprintf("%s()...DONE\n", fcn)) 468s + } # for (fcn ...) 468s rowVarDiffs()... 468s add_na = FALSE 468s mode: integer 468s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = TRUE 468s mode: integer 468s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = FALSE 468s mode: double 468s 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 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = TRUE 468s mode: double 468s 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 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s mode: integer 468s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s mode: double 468s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s rowVarDiffs()...DONE 468s rowSdDiffs()... 468s add_na = FALSE 468s mode: integer 468s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = TRUE 468s mode: integer 468s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = FALSE 468s mode: double 468s 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 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = TRUE 468s mode: double 468s 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 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s mode: integer 468s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s mode: double 468s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s rowSdDiffs()...DONE 468s rowMadDiffs()... 468s add_na = FALSE 468s mode: integer 468s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = TRUE 468s mode: integer 468s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = FALSE 468s mode: double 468s 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 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = TRUE 468s mode: double 468s 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 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s mode: integer 468s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s mode: double 468s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s rowMadDiffs()...DONE 468s rowIQRDiffs()... 468s add_na = FALSE 468s mode: integer 468s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = TRUE 468s mode: integer 468s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = FALSE 468s mode: double 468s 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 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s add_na = TRUE 468s mode: double 468s 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 ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s mode: integer 468s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s mode: double 468s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s na.rm = FALSE 468s na.rm = FALSE 468s na.rm = TRUE 468s na.rm = TRUE 468s rowIQRDiffs()...DONE 468s > 468s 468s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 468s Copyright (C) 2025 The R Foundation for Statistical Computing 468s Platform: arm-unknown-linux-gnueabihf (32-bit) 468s 468s R is free software and comes with ABSOLUTELY NO WARRANTY. 468s You are welcome to redistribute it under certain conditions. 468s Type 'license()' or 'licence()' for distribution details. 468s 468s R is a collaborative project with many contributors. 468s Type 'contributors()' for more information and 468s 'citation()' on how to cite R or R packages in publications. 468s 468s Type 'demo()' for some demos, 'help()' for on-line help, or 468s 'help.start()' for an HTML browser interface to help. 468s Type 'q()' to quit R. 468s 468s > library("matrixStats") 468s > 468s > fcns <- list( 468s + madDiff = c(rowMadDiffs, colMadDiffs), 468s + iqrDiff = c(rowIQRDiffs, colIQRDiffs) 468s + ) 468s > 468s > 468s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 468s > # Subsetted tests 468s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 468s > source("utils/validateIndicesFramework.R") 468s > # To check names attribute 468s > dimnames <- list(letters[1:6], LETTERS[1:6]) 468s > trim <- runif(1, min = 0, max = 0.5) 468s > for (fcn in names(fcns)) { 468s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 468s + row_fcn <- fcns[[fcn]][[1L]] 468s + col_fcn <- fcns[[fcn]][[2L]] 468s + 468s + for (mode in c("numeric", "integer")) { 468s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 468s + storage.mode(x) <- mode 468s + if (mode == "numeric") x[1:2, 3:4] <- Inf 468s + 468s + # Test with and without dimnames on x 468s + for (setDimnames in c(TRUE, FALSE)) { 468s + if (setDimnames) dimnames(x) <- dimnames 468s + else dimnames(x) <- NULL 468s + 468s + count <- 0L 468s + for (diff in 1:2) { 468s + for (rows in index_cases) { 468s + for (cols in index_cases) { 468s + count <- count + 1L 468s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 468s + useNames <- c(TRUE, FALSE) 468s + useNames <- useNames[count %% length(useNames) + 1] 468s + validateIndicesTestMatrix(x, rows, cols, 468s + ftest = row_fcn, fsure = row_fcn, 468s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 468s + validateIndicesTestMatrix(x, rows, cols, 468s + fcoltest = col_fcn, fsure = row_fcn, 468s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 468s + } 468s + } 468s + } 468s + } 468s + } 468s + cat(sprintf("%s()...DONE\n", fcn)) 468s + } 468s subsetted tests on madDiff()... 471s madDiff()...DONE 471s subsetted tests on iqrDiff()... 473s iqrDiff()...DONE 473s > 473s 473s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 473s Copyright (C) 2025 The R Foundation for Statistical Computing 473s Platform: arm-unknown-linux-gnueabihf (32-bit) 473s 473s R is free software and comes with ABSOLUTELY NO WARRANTY. 473s You are welcome to redistribute it under certain conditions. 473s Type 'license()' or 'licence()' for distribution details. 473s 473s R is a collaborative project with many contributors. 473s Type 'contributors()' for more information and 473s 'citation()' on how to cite R or R packages in publications. 473s 473s Type 'demo()' for some demos, 'help()' for on-line help, or 473s 'help.start()' for an HTML browser interface to help. 473s Type 'q()' to quit R. 473s 473s > library("matrixStats") 473s > 473s > fcns <- list( 473s + varDiff = c(rowVarDiffs, colVarDiffs), 473s + sdDiff = c(rowSdDiffs, colSdDiffs) 473s + ) 473s > 473s > 473s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 473s > # Subsetted tests 473s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 473s > source("utils/validateIndicesFramework.R") 473s > # To check names attribute 473s > dimnames <- list(letters[1:6], LETTERS[1:6]) 473s > trim <- runif(1, min = 0, max = 0.5) 473s > for (fcn in names(fcns)) { 473s + cat(sprintf("subsetted tests on %s()...\n", fcn)) 473s + row_fcn <- fcns[[fcn]][[1L]] 473s + col_fcn <- fcns[[fcn]][[2L]] 473s + 473s + for (mode in c("numeric", "integer")) { 473s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 473s + storage.mode(x) <- mode 473s + if (mode == "numeric") x[1:2, 3:4] <- Inf 473s + 473s + # Test with and without dimnames on x 473s + for (setDimnames in c(TRUE, FALSE)) { 473s + if (setDimnames) dimnames(x) <- dimnames 473s + else dimnames(x) <- NULL 473s + 473s + count <- 0L 473s + for (diff in 1:2) { 473s + for (rows in index_cases) { 473s + for (cols in index_cases) { 473s + count <- count + 1L 473s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 473s + useNames <- c(TRUE, FALSE) 473s + useNames <- useNames[count %% length(useNames) + 1] 473s + 473s + validateIndicesTestMatrix(x, rows, cols, 473s + ftest = row_fcn, fsure = row_fcn, 473s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 473s + validateIndicesTestMatrix(x, rows, cols, 473s + fcoltest = col_fcn, fsure = row_fcn, 473s + na.rm = na.rm, diff = diff, trim = trim, useNames = useNames) 473s + } 473s + } 473s + } 473s + } 473s + } 473s + cat(sprintf("%s()...DONE\n", fcn)) 473s + } 473s subsetted tests on varDiff()... 475s varDiff()...DONE 475s subsetted tests on sdDiff()... 477s sdDiff()...DONE 477s > 477s 477s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 477s Copyright (C) 2025 The R Foundation for Statistical Computing 477s Platform: arm-unknown-linux-gnueabihf (32-bit) 477s 477s R is free software and comes with ABSOLUTELY NO WARRANTY. 477s You are welcome to redistribute it under certain conditions. 477s Type 'license()' or 'licence()' for distribution details. 477s 477s R is a collaborative project with many contributors. 477s Type 'contributors()' for more information and 477s 'citation()' on how to cite R or R packages in publications. 477s 477s Type 'demo()' for some demos, 'help()' for on-line help, or 477s 'help.start()' for an HTML browser interface to help. 477s Type 'q()' to quit R. 477s 477s > library("matrixStats") 477s > 477s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 477s > options(matrixStats.center.onUse = "ignore") 477s > options(matrixStats.vars.formula.freq = Inf) 477s > 477s > ## Create isFALSE() if running on an old version of R 477s > if (!exists("isFALSE", mode="function")) { 477s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 477s + } 477s > 477s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 477s + suppressWarnings({ 477s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 477s + }) 477s + stopifnot(!any(is.infinite(res))) 477s + 477s + # Keep naming support consistency same as rowVars() 477s + if (is.null(center) || ncol(x) <= 1L) { 477s + if (isFALSE(useNames)) names(res) <- NULL 477s + } 477s + else if (isFALSE(useNames)) names(res) <- NULL 477s + res 477s + } 477s > 477s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 477s + suppressWarnings({ 477s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 477s + }) 477s + stopifnot(!any(is.infinite(res))) 477s + 477s + # Keep naming support consistency same as colVars() 477s + if (is.null(center) || ncol(x) <= 1L) { 477s + if (isFALSE(useNames)) names(res) <- NULL 477s + } 477s + else if (isFALSE(useNames)) names(res) <- NULL 477s + res 477s + } 477s > 477s > 477s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 477s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 477s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 477s + stopifnot(!any(is.infinite(res))) 477s + res 477s + } 477s > 477s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 477s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 477s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 477s + stopifnot(!any(is.infinite(res))) 477s + res 477s + } 477s > 477s > rowVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = TRUE) { 477s + x <- sweep(x, MARGIN = 1, STATS = as.array(center), FUN = "-") 477s + x[is.infinite(center), ] <- NaN 477s + res <- rowVars(x, rows = rows, cols = cols, center = rep(0, times = nrow(x)), na.rm = na.rm, useNames = useNames) 477s + stopifnot(!any(is.infinite(res))) 477s + res 477s + } 477s > 477s > colVars_center_naive <- function(x, rows = NULL, cols = NULL, center = NULL, na.rm = FALSE, ..., useNames = TRUE) { 477s + x <- sweep(x, MARGIN = 2, STATS = as.array(center), FUN = "-") 477s + x[, is.infinite(center)] <- NaN 477s + res <- colVars(x, rows = rows, cols = cols, center = rep(0, times = ncol(x)), na.rm = na.rm, useNames = useNames) 477s + stopifnot(!any(is.infinite(res))) 477s + res 477s + } 477s > 477s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 477s > # With and without some NAs or Infs 477s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 477s > for (mode in c("integer", "double")) { 477s + if (mode == "integer") { 477s + specials <- c(0L, NA_integer_) 477s + delta <- 0L 477s + } else { 477s + specials <- c(0, NA_real_, Inf) 477s + delta <- 0.1 477s + } 477s + 477s + for (special in specials) { 477s + cat("special = ", special, "\n", sep = "") 477s + x <- matrix(1:50 + delta, nrow = 10L, ncol = 5L) 477s + x[3:7, c(2, 4)] <- special 477s + cat("mode: ", mode, "\n", sep = "") 477s + str(x) 477s + stopifnot(storage.mode(x) == mode) 477s + 477s + # To check names attribute 477s + dimnames <- list(letters[1:10], LETTERS[1:5]) 477s + 477s + # Test with and without dimnames on x 477s + for (setDimnames in c(TRUE, FALSE)) { 477s + if (setDimnames) dimnames(x) <- dimnames 477s + else dimnames(x) <- NULL 477s + # Row/column variance 477s + for (na.rm in c(FALSE, TRUE)) { 477s + # Check names attribute 477s + for (useNames in c(TRUE, FALSE)) { 477s + cat("na.rm = ", na.rm, "\n", sep = "") 477s + center <- rowMeans(x, na.rm = na.rm) 477s + 477s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 477s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 477s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 477s + r1c <- rowVars(x, center = center, na.rm = na.rm, useNames = useNames) 477s + 477s + tx <- t(x) 477s + r2 <- colVars(tx, na.rm = na.rm, useNames = useNames) 477s + r2b <- colVars_center(tx, na.rm = na.rm, useNames = useNames) 477s + r2c <- colVars(tx, center = center, na.rm = na.rm, useNames = useNames) 477s + tx <- NULL 477s + 477s + stopifnot(all.equal(r1, r2)) 477s + stopifnot(all.equal(r1, r0)) 477s + stopifnot(all.equal(r1b, r1c)) 477s + stopifnot(all.equal(r2, r0)) 477s + stopifnot(all.equal(r2b, r2c)) 477s + 477s + center <- colMeans(x, na.rm = na.rm) 477s + 477s + r3 <- colVars(x, center = center, na.rm = na.rm, useNames = useNames) 477s + r3b <- colVars_center_naive(x, center = center, na.rm = na.rm, useNames = useNames) 477s + r3c <- rowVars(t(x), center = center, na.rm = na.rm, useNames = useNames) 477s + r3d <- rowVars_center_naive(t(x), center = center, na.rm = na.rm, useNames = useNames) 477s + stopifnot(all.equal(r3b, r3)) 477s + stopifnot(all.equal(r3c, r3)) 477s + stopifnot(all.equal(r3d, r3)) 477s + 477s + stopifnot( 477s + !any(is.infinite(r0)), 477s + !any(is.infinite(r1)), 477s + !any(is.infinite(r2)), 477s + !any(is.infinite(r3)), 477s + !any(is.infinite(r1b)), 477s + !any(is.infinite(r1c)), 477s + !any(is.infinite(r2b)), 477s + !any(is.infinite(r2c)), 477s + !any(is.infinite(r3b)), 477s + !any(is.infinite(r3c)), 477s + !any(is.infinite(r3d)) 477s + ) 477s + } 477s + } 477s + } 477s + } # for (special ...) 477s + } 477s special = 0 477s mode: integer 477s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 477s na.rm = FALSE 477s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s special = NA 478s mode: integer 478s int [1:10, 1:5] 1 2 3 4 5 6 7 8 9 10 ... 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s special = 0 478s mode: double 478s 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 ... 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s special = NA 478s mode: double 478s 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 ... 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s special = Inf 478s mode: double 478s 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 ... 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s > 478s > 478s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478s > # All NAs 478s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478s > for (mode in c("integer", "double")) { 478s + x <- matrix(NA_real_, nrow = 10L, ncol = 5L) 478s + cat("mode: ", mode, "\n", sep = "") 478s + storage.mode(x) <- mode 478s + str(x) 478s + 478s + # Test with and without dimnames on x 478s + for (setDimnames in c(TRUE, FALSE)) { 478s + if (setDimnames) dimnames(x) <- dimnames 478s + else dimnames(x) <- NULL 478s + # Row/column variance 478s + for (na.rm in c(FALSE, TRUE)) { 478s + # Check names attribute 478s + for (useNames in c(TRUE, FALSE)) { 478s + cat("na.rm = ", na.rm, "\n", sep = "") 478s + 478s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 478s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 478s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 478s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 478s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 478s + stopifnot(all.equal(r1, r2)) 478s + stopifnot(all.equal(r1, r0)) 478s + stopifnot(all.equal(r2, r0)) 478s + stopifnot(all.equal(r1b, r2b)) 478s + stopifnot( 478s + !any(is.infinite(r0)), 478s + !any(is.infinite(r1)), 478s + !any(is.infinite(r2)), 478s + !any(is.infinite(r1b)), 478s + !any(is.infinite(r2b)) 478s + ) 478s + } 478s + } 478s + } 478s + } 478s mode: integer 478s int [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s mode: double 478s num [1:10, 1:5] NA NA NA NA NA NA NA NA NA NA ... 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s > 478s > 478s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478s > # A 1x1 matrix 478s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478s > x <- matrix(0, nrow = 1L, ncol = 1L) 478s > dimnames <- list("a", "A") 478s > # Test with and without dimnames on x 478s > for (setDimnames in c(TRUE, FALSE)) { 478s + if (setDimnames) dimnames(x) <- dimnames 478s + else dimnames(x) <- NULL 478s + # Row/column variance 478s + for (na.rm in c(FALSE, TRUE)) { 478s + # Check names attribute 478s + for (useNames in c(TRUE, FALSE)) { 478s + cat("na.rm = ", na.rm, "\n", sep = "") 478s + 478s + r0 <- rowVars_R(x, na.rm = na.rm, useNames = useNames) 478s + r1 <- rowVars(x, na.rm = na.rm, useNames = useNames) 478s + r1b <- rowVars_center(x, na.rm = na.rm, useNames = useNames) 478s + r2 <- colVars(t(x), na.rm = na.rm, useNames = useNames) 478s + r2b <- colVars_center(t(x), na.rm = na.rm, useNames = useNames) 478s + stopifnot(all.equal(r1, r2)) 478s + stopifnot(all.equal(r1, r0)) 478s + stopifnot(all.equal(r2, r0)) 478s + stopifnot(all.equal(r1b, r2b)) 478s + stopifnot( 478s + !any(is.infinite(r0)), 478s + !any(is.infinite(r1)), 478s + !any(is.infinite(r2)), 478s + !any(is.infinite(r1b)), 478s + !any(is.infinite(r2b)) 478s + ) 478s + } 478s + } 478s + } 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s na.rm = FALSE 478s na.rm = FALSE 478s na.rm = TRUE 478s na.rm = TRUE 478s > 478s > 478s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478s > # center and .dim 478s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478s > m <- matrix(1:12, nrow = 3L, ncol = 4L) 478s > a <- array(m, dim = c(3, 2, 2)) 478s > stopifnot(prod(dim(a)) == prod(dim(m))) 478s > 478s > y0 <- rowVars(m, dim. = dim(m)) 478s > print(y0) 478s [1] 15 15 15 478s > y1 <- rowVars(a, dim. = dim(m)) 478s > print(y1) 478s [1] 15 15 15 478s > stopifnot(identical(y1, y0)) 478s > stopifnot( 478s + !any(is.infinite(y0)), 478s + !any(is.infinite(y1)) 478s + ) 478s > 478s > mu <- rowMeans(m) 478s > y0 <- rowVars(m, center = mu, dim. = dim(m)) 478s > print(y0) 478s [1] 15 15 15 478s > y1 <- rowVars(a, center = mu, dim. = dim(m)) 478s > print(y1) 478s [1] 15 15 15 478s > stopifnot(identical(y1, y0)) 478s > stopifnot( 478s + !any(is.infinite(y0)), 478s + !any(is.infinite(y1)) 478s + ) 478s > 478s > 478s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478s > # Corner cases 478s > # https://github.com/HenrikBengtsson/matrixStats/issues/195 478s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478s > x <- matrix(c(1,2,3,4), nrow = 2L, ncol = 2L) 478s > x[1,1] <- NA_real_ 478s > x[1,2] <- Inf 478s > 478s > center <- colMeans2(x, na.rm = TRUE) 478s > y <- colVars(x, center = center, na.rm = TRUE) 478s > stopifnot(!any(is.infinite(y))) 478s > 478s > x <- t(x) 478s > center <- rowMeans2(x, na.rm = TRUE) 478s > y <- rowVars(x, center = center, na.rm = TRUE) 478s > stopifnot(!any(is.infinite(y))) 478s > 478s 478s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 478s Copyright (C) 2025 The R Foundation for Statistical Computing 478s Platform: arm-unknown-linux-gnueabihf (32-bit) 478s 478s R is free software and comes with ABSOLUTELY NO WARRANTY. 478s You are welcome to redistribute it under certain conditions. 478s Type 'license()' or 'licence()' for distribution details. 478s 478s R is a collaborative project with many contributors. 478s Type 'contributors()' for more information and 478s 'citation()' on how to cite R or R packages in publications. 478s 478s Type 'demo()' for some demos, 'help()' for on-line help, or 478s 'help.start()' for an HTML browser interface to help. 478s Type 'q()' to quit R. 478s 478s > library("matrixStats") 478s > 478s > ## Always allow testing of the 'center' argument (as long as it's not defunct) 478s > options(matrixStats.center.onUse = "ignore") 478s > 478s > ## Create isFALSE() if running on an old version of R 478s > if (!exists("isFALSE", mode="function")) { 478s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 478s + } 478s > 478s > rowVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 478s + suppressWarnings({ 478s + res <- apply(x, MARGIN = 1L, FUN = var, na.rm = na.rm) 478s + }) 478s + stopifnot(!any(is.infinite(res))) 478s + 478s + # Keep naming support consistency same as rowVars() 478s + if (is.null(center) || ncol(x) <= 1L) { 478s + if (isFALSE(useNames)) names(res) <- NULL 478s + } 478s + else if (isFALSE(useNames)) names(res) <- NULL 478s + res 478s + } 478s > 478s > colVars_R <- function(x, na.rm = FALSE, center = NULL, ..., useNames = TRUE) { 478s + suppressWarnings({ 478s + res <- apply(x, MARGIN = 2L, FUN = var, na.rm = na.rm) 478s + }) 478s + stopifnot(!any(is.infinite(res))) 478s + 478s + # Keep naming support consistency same as colVars() 478s + if (is.null(center) || nrow(x) <= 1L) { 478s + if (isFALSE(useNames)) names(res) <- NULL 478s + } 478s + else if (isFALSE(useNames)) names(res) <- NULL 478s + res 478s + } 478s > 478s > 478s > rowVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 478s + center <- rowWeightedMeans(x, cols = cols, na.rm = na.rm, useNames = FALSE) 478s + res <- rowVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 478s + stopifnot(!any(is.infinite(res))) 478s + res 478s + } 478s > 478s > colVars_center <- function(x, rows = NULL, cols = NULL, na.rm = FALSE, ..., useNames = TRUE) { 478s + center <- colWeightedMeans(x, rows = rows, na.rm = na.rm, useNames = FALSE) 478s + res <- colVars(x, rows = rows, cols = cols, center = center, na.rm = na.rm, useNames = useNames) 478s + stopifnot(!any(is.infinite(res))) 478s + res 478s + } 478s > 478s > 478s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478s > # Subsetted tests 478s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 478s > source("utils/validateIndicesFramework.R") 478s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 478s > storage.mode(x) <- "integer" 478s > 478s > # To check names attribute 478s > dimnames <- list(letters[1:6], LETTERS[1:6]) 478s > 478s > # Test with and without dimnames on x 478s > for (setDimnames in c(TRUE, FALSE)) { 478s + if (setDimnames) dimnames(x) <- dimnames 478s + else dimnames(x) <- NULL 478s + 478s + count <- 0L 478s + for (rows in index_cases) { 478s + for (cols in index_cases) { 478s + count <- count + 1L 478s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 478s + useNames <- c(TRUE, FALSE) 478s + useNames <- useNames[count %% length(useNames) + 1] 478s + 478s + validateIndicesTestMatrix(x, rows, cols, 478s + ftest = rowVars, fsure = rowVars_R, 478s + na.rm = na.rm, useNames = useNames) 478s + validateIndicesTestMatrix(x, rows, cols, 478s + ftest = rowVars_center, fsure = rowVars_R, 478s + na.rm = na.rm, center = TRUE, useNames = useNames) 478s + 478s + validateIndicesTestMatrix(x, rows, cols, 478s + fcoltest = colVars, fsure = rowVars_R, 478s + na.rm = na.rm, useNames = useNames) 478s + validateIndicesTestMatrix(x, rows, cols, 478s + fcoltest = colVars_center, fsure = rowVars_R, 478s + na.rm = na.rm, center = TRUE, useNames = useNames) 478s + } 478s + } 478s + } 479s > 479s 479s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 479s Copyright (C) 2025 The R Foundation for Statistical Computing 479s Platform: arm-unknown-linux-gnueabihf (32-bit) 479s 479s R is free software and comes with ABSOLUTELY NO WARRANTY. 479s You are welcome to redistribute it under certain conditions. 479s Type 'license()' or 'licence()' for distribution details. 479s 479s R is a collaborative project with many contributors. 479s Type 'contributors()' for more information and 479s 'citation()' on how to cite R or R packages in publications. 479s 479s Type 'demo()' for some demos, 'help()' for on-line help, or 479s 'help.start()' for an HTML browser interface to help. 479s Type 'q()' to quit R. 479s 479s > library("matrixStats") 479s > 479s > ## Create isFALSE() if running on an old version of R 479s > if (!exists("isFALSE", mode="function")) { 479s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 479s + } 479s > 479s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 479s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 479s + 479s + # Keep naming support consistency same as rowWeightedMeans() 479s + idxs <- which(is.na(w) | w != 0) 479s + nw <- length(idxs) 479s + if (na.rm) na.rm <- anyMissing(x) 479s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 479s + if (!useNames) names(res) <- NULL 479s + } 479s + else if (isFALSE(useNames)) names(res) <- NULL 479s + 479s + res 479s + } 479s > 479s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 479s + res <- apply(x, MARGIN = 2L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 479s + 479s + # Keep naming support consistency same as colWeightedMeans() 479s + idxs <- which(is.na(w) | w != 0) 479s + nw <- length(idxs) 479s + if (!is.null(w) && nw == 0L) { 479s + if (!useNames) names(res) <- NULL 479s + } 479s + else if (isFALSE(useNames)) names(res) <- NULL 479s + 479s + res 479s + } 479s > 479s > set.seed(1) 479s > 479s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 479s > print(x) 479s [,1] [,2] [,3] [,4] 479s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 479s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 479s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 479s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 479s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 479s > 479s > # To check names attribute 479s > dimnames <- list(letters[1:5], LETTERS[1:4]) 479s > 479s > # Non-weighted row averages 479s > x_est0 <- rowMeans(x) 479s > x_est1 <- rowWeightedMeans(x) 479s > print(x_est1) 479s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > x_est2 <- colWeightedMeans(t(x)) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > # Check names attribute 479s > dimnames(x) <- dimnames 479s > x_est1 <- rowWeightedMeans(x, useNames = FALSE) 479s > x_est2 <- colWeightedMeans(t(x), useNames = FALSE) 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > x_est0 <- rowMeans(x) 479s > x_est1 <- rowWeightedMeans(x, useNames = TRUE) 479s > x_est2 <- colWeightedMeans(t(x), useNames = TRUE) 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > dimnames(x) <- NULL 479s > 479s > 479s > # Weighted row averages (uniform weights) 479s > w <- rep(2.5, times = ncol(x)) 479s > x_est0 <- rowMeans(x) 479s > x_est1 <- rowWeightedMeans(x, w = w) 479s > print(x_est1) 479s [1] 0.004981341 0.261181337 0.056322931 0.194395865 0.435737906 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > x_est2 <- colWeightedMeans(t(x), w = w) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > # Test with and without dimnames on x 479s > for (setDimnames in c(TRUE, FALSE)) { 479s + if (setDimnames) dimnames(x) <- dimnames 479s + else dimnames(x) <- NULL 479s + # Check names attribute 479s + for (useNames in c(TRUE, FALSE)) { 479s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 479s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 479s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + } 479s + } 479s > 479s > 479s > # Weighted row averages (excluding some columns) 479s > w <- c(1, 1, 0, 1) 479s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 479s > x_est1 <- rowWeightedMeans(x, w = w) 479s > print(x_est1) 479s [1] -0.4972853 0.2182940 0.2821774 0.9974278 0.2060069 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > x_est2 <- colWeightedMeans(t(x), w = w) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > # Test with and without dimnames on x 479s > for (setDimnames in c(TRUE, FALSE)) { 479s + if (setDimnames) dimnames(x) <- dimnames 479s + else dimnames(x) <- NULL 479s + # Check names attribute 479s + for (useNames in c(TRUE, FALSE)) { 479s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 479s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 479s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + } 479s + } 479s > 479s > 479s > # Weighted row averages (excluding some columns) 479s > w <- c(0, 1, 0, 0) 479s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 479s > x_est1 <- rowWeightedMeans(x, w = w) 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > x_est2 <- colWeightedMeans(t(x), w = w) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > # Test with and without dimnames on x 479s > for (setDimnames in c(TRUE, FALSE)) { 479s + if (setDimnames) dimnames(x) <- dimnames 479s + else dimnames(x) <- NULL 479s + # Check names attribute 479s + for (useNames in c(TRUE, FALSE)) { 479s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 479s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 479s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + } 479s + } 479s > 479s > 479s > # Weighted row averages (all zero weights) 479s > w <- c(0, 0, 0, 0) 479s > x_est0 <- rowMeans(x[, (w == 1), drop = FALSE]) 479s > x_est1 <- rowWeightedMeans(x, w = w) 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > x_est2 <- colWeightedMeans(t(x), w = w) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > # Test with and without dimnames on x 479s > for (setDimnames in c(TRUE, FALSE)) { 479s + if (setDimnames) dimnames(x) <- dimnames 479s + else dimnames(x) <- NULL 479s + # Check names attribute 479s + for (useNames in c(TRUE, FALSE)) { 479s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 479s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 479s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + } 479s + } 479s > 479s > 479s > # Weighted averages by rows and columns 479s > w <- 1:4 479s > x_est1 <- rowWeightedMeans(x, w = w) 479s > print(x_est1) 479s [1] 0.20882185 0.22632701 0.25526439 -0.06123714 0.54691290 479s > x_est2 <- colWeightedMeans(t(x), w = w) 479s > stopifnot(all.equal(x_est2, x_est1)) 479s > # Test with and without dimnames on x 479s > for (setDimnames in c(TRUE, FALSE)) { 479s + if (setDimnames) dimnames(x) <- dimnames 479s + else dimnames(x) <- NULL 479s + # Check names attribute 479s + for (useNames in c(TRUE, FALSE)) { 479s + x_est0 <- rowWeightedMeans_R(x, w = w, useNames = useNames) 479s + x_est1 <- rowWeightedMeans(x, w = w, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + x_est0 <- colWeightedMeans_R(t(x), w = w, useNames = useNames) 479s + x_est1 <- colWeightedMeans(t(x), w = w, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + } 479s + } 479s > 479s > 479s > x[sample(length(x), size = 0.3 * length(x))] <- NA 479s > print(x) 479s [,1] [,2] [,3] [,4] 479s [1,] -0.6264538 NA 1.5117812 -0.04493361 479s [2,] 0.1836433 NA NA -0.01619026 479s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 479s [4,] 1.5952808 NA -2.2146999 0.82122120 479s [5,] 0.3295078 NA NA 0.59390132 479s > 479s > # Non-weighted row averages with missing values 479s > x_est0 <- rowMeans(x, na.rm = TRUE) 479s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE) 479s > print(x_est1) 479s [1] 0.28013125 0.08372653 0.05632293 0.06726737 0.46170455 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > # Check names attribute 479s > dimnames(x) <- dimnames 479s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = FALSE) 479s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = FALSE) 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > x_est0 <- rowMeans(x, na.rm = TRUE) 479s > x_est1 <- rowWeightedMeans(x, na.rm = TRUE, useNames = TRUE) 479s > x_est2 <- colWeightedMeans(t(x), na.rm = TRUE, useNames = TRUE) 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > dimnames(x) <- NULL 479s > 479s > 479s > # Weighted row averages with missing values 479s > x_est0 <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = TRUE) 479s > print(x_est0) 479s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 479s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 479s > print(x_est1) 479s [1] 0.46614441 0.02377645 0.25526439 -0.22049176 0.54102261 479s > stopifnot(all.equal(x_est1, x_est0)) 479s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 479s > stopifnot(all.equal(x_est2, x_est0)) 479s > # Test with and without dimnames on x 479s > for (setDimnames in c(TRUE, FALSE)) { 479s + if (setDimnames) dimnames(x) <- dimnames 479s + else dimnames(x) <- NULL 479s + # Check names attribute 479s + for (useNames in c(TRUE, FALSE)) { 479s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 479s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 479s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + } 479s + } 479s > 479s > 479s > # Weighted averages by rows and columns 479s > w <- 1:4 479s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 479s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 479s > stopifnot(all.equal(x_est2, x_est1)) 479s > # Test with and without dimnames on x 479s > for (setDimnames in c(TRUE, FALSE)) { 479s + if (setDimnames) dimnames(x) <- dimnames 479s + else dimnames(x) <- NULL 479s + # Check names attribute 479s + for (useNames in c(TRUE, FALSE)) { 479s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 479s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 479s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + } 479s + } 479s > 479s > 479s > # w contains missing value 479s > w[1] <- NA_integer_ 479s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE) 479s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = TRUE) 479s > stopifnot(all.equal(x_est2, x_est1)) 479s > # Test with and without dimnames on x 479s > for (setDimnames in c(TRUE, FALSE)) { 479s + if (setDimnames) dimnames(x) <- dimnames 479s + else dimnames(x) <- NULL 479s + # Check names attribute 479s + for (useNames in c(TRUE, FALSE)) { 479s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = TRUE, useNames = useNames) 479s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = TRUE, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 479s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = TRUE, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + } 479s + } 479s > 479s > x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE) 479s > x_est2 <- colWeightedMeans(t(x), w = w, na.rm = FALSE) 479s > stopifnot(all.equal(x_est2, x_est1)) 479s > # Test with and without dimnames on x 479s > for (setDimnames in c(TRUE, FALSE)) { 479s + if (setDimnames) dimnames(x) <- dimnames 479s + else dimnames(x) <- NULL 479s + # Check names attribute 479s + for (useNames in c(TRUE, FALSE)) { 479s + x_est0 <- rowWeightedMeans_R(x, w = w, na.rm = FALSE, useNames = useNames) 479s + x_est1 <- rowWeightedMeans(x, w = w, na.rm = FALSE, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + x_est0 <- colWeightedMeans_R(t(x), w = w, na.rm = FALSE, useNames = useNames) 479s + x_est1 <- colWeightedMeans(t(x), w = w, na.rm = FALSE, useNames = useNames) 479s + stopifnot(all.equal(x_est1, x_est0)) 479s + } 479s + } 479s > 480s 480s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 480s Copyright (C) 2025 The R Foundation for Statistical Computing 480s Platform: arm-unknown-linux-gnueabihf (32-bit) 480s 480s R is free software and comes with ABSOLUTELY NO WARRANTY. 480s You are welcome to redistribute it under certain conditions. 480s Type 'license()' or 'licence()' for distribution details. 480s 480s R is a collaborative project with many contributors. 480s Type 'contributors()' for more information and 480s 'citation()' on how to cite R or R packages in publications. 480s 480s Type 'demo()' for some demos, 'help()' for on-line help, or 480s 'help.start()' for an HTML browser interface to help. 480s Type 'q()' to quit R. 480s 480s > library("matrixStats") 480s > 480s > ## Create isFALSE() if running on an old version of R 480s > if (!exists("isFALSE", mode="function")) { 480s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 480s + } 480s > 480s > rowWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 480s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 480s + 480s + # Keep naming support consistency same as rowWeightedMeans() 480s + idxs <- which(is.na(w) | w != 0) 480s + nw <- length(idxs) 480s + if (na.rm) na.rm <- anyMissing(x) 480s + if ((!is.null(w) && nw == 0L) || isFALSE(na.rm)) { 480s + if (!useNames) names(res) <- NULL 480s + } 480s + else if (isFALSE(useNames)) names(res) <- NULL 480s + 480s + res 480s + } 480s > 480s > colWeightedMeans_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 480s + res <- apply(x, MARGIN = 1L, FUN = weighted.mean, w = w, na.rm = na.rm, ...) 480s + 480s + # Keep naming support consistency same as colWeightedMeans() 480s + idxs <- which(is.na(w) | w != 0) 480s + nw <- length(idxs) 480s + if (!is.null(w) && nw == 0L) { 480s + if (!useNames) names(res) <- NULL 480s + } 480s + else if (isFALSE(useNames)) names(res) <- NULL 480s + 480s + res 480s + } 480s > 480s > 480s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 480s > # Subsetted tests 480s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 480s > source("utils/validateIndicesFramework.R") 480s > # To check names attribute 480s > dimnames <- list(letters[1:6], LETTERS[1:6]) 480s > for (mode in c("numeric", "integer", "logical")) { 480s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 480s + w <- runif(6, min = 0, max = 6) 480s + storage.mode(x) <- mode 480s + storage.mode(w) <- if (mode == "logical") "integer" else mode 480s + if (mode == "numeric") w[1] <- Inf 480s + 480s + # Test with and without dimnames on x 480s + for (setDimnames in c(TRUE, FALSE)) { 480s + if (setDimnames) dimnames(x) <- dimnames 480s + else dimnames(x) <- NULL 480s + 480s + count <- 0L 480s + for (rows in index_cases) { 480s + for (cols in index_cases) { 480s + count <- count + 1L 480s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 480s + useNames <- c(TRUE, FALSE) 480s + useNames <- useNames[count %% length(useNames) + 1] 480s + 480s + validateIndicesTestMatrix_w(x, w, rows, cols, 480s + ftest = rowWeightedMeans, fsure = rowWeightedMeans_R, 480s + na.rm = na.rm, useNames = useNames) 480s + validateIndicesTestMatrix_w(x, w, rows, cols, 480s + fcoltest = colWeightedMeans, fsure = colWeightedMeans_R, 480s + na.rm = na.rm, useNames = useNames) 480s + } 480s + } 480s + } 480s + } 481s > 481s 481s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 481s Copyright (C) 2025 The R Foundation for Statistical Computing 481s Platform: arm-unknown-linux-gnueabihf (32-bit) 481s 481s R is free software and comes with ABSOLUTELY NO WARRANTY. 481s You are welcome to redistribute it under certain conditions. 481s Type 'license()' or 'licence()' for distribution details. 481s 481s R is a collaborative project with many contributors. 481s Type 'contributors()' for more information and 481s 'citation()' on how to cite R or R packages in publications. 481s 481s Type 'demo()' for some demos, 'help()' for on-line help, or 481s 'help.start()' for an HTML browser interface to help. 481s Type 'q()' to quit R. 481s 481s > library("matrixStats") 481s > 481s > ## Create isFALSE() if running on an old version of R 481s > if (!exists("isFALSE", mode="function")) { 481s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 481s + } 481s > 481s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 481s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 481s + 481s + # Keep naming support consistency same as rowWeightedMedians() 481s + if (!is.null(w)) { 481s + if (isFALSE(useNames)) names(res) <- NULL 481s + } 481s + else if (!useNames) names(res) <- NULL 481s + 481s + res 481s + } 481s > 481s > colWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 481s + res <- apply(x, MARGIN = 2L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 481s + 481s + # Keep naming support consistency same as colWeightedMedians() 481s + if (!is.null(w)) { 481s + if (isFALSE(useNames)) names(res) <- NULL 481s + } 481s + else if (!useNames) names(res) <- NULL 481s + 481s + res 481s + } 481s > 481s > set.seed(1) 481s > 481s > x <- matrix(rnorm(20), nrow = 5, ncol = 4) 481s > print(x) 481s [,1] [,2] [,3] [,4] 481s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 481s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 481s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 481s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 481s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 481s > 481s > # To check names attribute 481s > dimnames <- list(letters[1:5], LETTERS[1:4]) 481s > 481s > # Non-weighted row medians 481s > x_est0 <- rowMedians(x) 481s > x_est1 <- rowWeightedMedians(x) 481s > stopifnot(all.equal(x_est1, x_est0)) 481s > x_est2 <- colWeightedMedians(t(x)) 481s > stopifnot(all.equal(x_est2, x_est0)) 481s > # Test with and without dimnames on x 481s > for (setDimnames in c(TRUE, FALSE)) { 481s + if (setDimnames) dimnames(x) <- dimnames 481s + else dimnames(x) <- NULL 481s + # Check names attribute 481s + for (useNames in c(TRUE, FALSE)) { 481s + x_est0 <- rowMedians(x, useNames = useNames) 481s + x_est1 <- rowWeightedMedians(x, useNames = useNames) 481s + x_est2 <- colWeightedMedians(t(x), useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + stopifnot(all.equal(x_est2, x_est0)) 481s + } 481s + } 481s > 481s > 481s > # Weighted row medians (uniform weights) 481s > w <- rep(2.5, times = ncol(x)) 481s > x_est0 <- rowMedians(x) 481s > x_est1 <- rowWeightedMedians(x, w = w) 481s > stopifnot(all.equal(x_est1, x_est0)) 481s > x_est2 <- colWeightedMedians(t(x), w = w) 481s > stopifnot(all.equal(x_est2, x_est0)) 481s > # Test with and without dimnames on x 481s > for (setDimnames in c(TRUE, FALSE)) { 481s + if (setDimnames) dimnames(x) <- dimnames 481s + else dimnames(x) <- NULL 481s + # Check names attribute 481s + for (useNames in c(TRUE, FALSE)) { 481s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 481s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 481s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + } 481s + } 481s > 481s > 481s > # Weighted row medians (excluding some columns) 481s > w <- c(1, 1, 0, 1) 481s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 481s > x_est1 <- rowWeightedMedians(x, w = w) 481s > stopifnot(all.equal(x_est1, x_est0)) 481s > x_est2 <- colWeightedMedians(t(x), w = w) 481s > stopifnot(all.equal(x_est2, x_est0)) 481s > # Test with and without dimnames on x 481s > for (setDimnames in c(TRUE, FALSE)) { 481s + if (setDimnames) dimnames(x) <- dimnames 481s + else dimnames(x) <- NULL 481s + # Check names attribute 481s + for (useNames in c(TRUE, FALSE)) { 481s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 481s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 481s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + } 481s + } 481s > 481s > # Weighted row medians (excluding some columns) 481s > w <- c(0, 1, 0, 0) 481s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 481s > x_est1 <- rowWeightedMedians(x, w = w) 481s > stopifnot(all.equal(x_est1, x_est0)) 481s > x_est2 <- colWeightedMedians(t(x), w = w) 481s > stopifnot(all.equal(x_est2, x_est0)) 481s > # Test with and without dimnames on x 481s > for (setDimnames in c(TRUE, FALSE)) { 481s + if (setDimnames) dimnames(x) <- dimnames 481s + else dimnames(x) <- NULL 481s + # Check names attribute 481s + for (useNames in c(TRUE, FALSE)) { 481s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 481s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 481s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + } 481s + } 481s > 481s > # Weighted row medians (all zero weights) 481s > w <- c(0, 0, 0, 0) 481s > x_est0 <- rowMedians(x[, (w == 1), drop = FALSE]) 481s > x_est1 <- rowWeightedMedians(x, w = w) 481s > stopifnot(all.equal(x_est1, x_est0)) 481s > x_est2 <- colWeightedMedians(t(x), w = w) 481s > stopifnot(all.equal(x_est2, x_est0)) 481s > # Test with and without dimnames on x 481s > for (setDimnames in c(TRUE, FALSE)) { 481s + if (setDimnames) dimnames(x) <- dimnames 481s + else dimnames(x) <- NULL 481s + # Check names attribute 481s + for (useNames in c(TRUE, FALSE)) { 481s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 481s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 481s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + } 481s + } 481s > 481s > # Weighted medians by rows and columns 481s > w <- 1:4 481s > x_est1 <- rowWeightedMedians(x, w = w) 481s > x_est2 <- colWeightedMedians(t(x), w = w) 481s > stopifnot(all.equal(x_est2, x_est1)) 481s > # Test with and without dimnames on x 481s > for (setDimnames in c(TRUE, FALSE)) { 481s + if (setDimnames) dimnames(x) <- dimnames 481s + else dimnames(x) <- NULL 481s + # Check names attribute 481s + for (useNames in c(TRUE, FALSE)) { 481s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 481s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 481s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + } 481s + } 481s > 481s > 481s > # Weighted row medians with missing values 481s > x_est0 <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = TRUE) 481s > print(x_est0) 481s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 481s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 481s > print(x_est1) 481s [1] -0.04493361 0.23519330 0.73832471 0.65759463 0.59390132 481s > stopifnot(all.equal(x_est1, x_est0)) 481s > x_est2 <- colWeightedMedians(t(x), w = w) 481s > stopifnot(all.equal(x_est2, x_est0)) 481s > # Test with and without dimnames on x 481s > for (setDimnames in c(TRUE, FALSE)) { 481s + if (setDimnames) dimnames(x) <- dimnames 481s + else dimnames(x) <- NULL 481s + # Check names attribute 481s + for (useNames in c(TRUE, FALSE)) { 481s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 481s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 481s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + } 481s + } 481s > 481s > # Weighted medians by rows and columns 481s > w <- 1:4 481s > x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE) 481s > x_est2 <- colWeightedMedians(t(x), w = w, na.rm = TRUE) 481s > stopifnot(all.equal(x_est2, x_est1)) 481s > # Test with and without dimnames on x 481s > for (setDimnames in c(TRUE, FALSE)) { 481s + if (setDimnames) dimnames(x) <- dimnames 481s + else dimnames(x) <- NULL 481s + # Check names attribute 481s + for (useNames in c(TRUE, FALSE)) { 481s + x_est0 <- rowWeightedMedians_R(x, w = w, na.rm = TRUE, useNames = useNames) 481s + x_est1 <- rowWeightedMedians(x, w = w, na.rm = TRUE, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + x_est0 <- colWeightedMedians_R(t(x), w = w, na.rm = TRUE, useNames = useNames) 481s + x_est1 <- colWeightedMedians(t(x), w = w, na.rm = TRUE, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + } 481s + } 481s > 481s > 481s > # Inf weight 481s > x <- matrix(1:2, nrow = 1, ncol = 2) 481s > w <- c(7, Inf) 481s > x_est1 <- rowWeightedMedians(x, w = w) 481s > x_est2 <- colWeightedMedians(t(x), w = w) 481s > stopifnot(identical(2, x_est1)) 481s > stopifnot(identical(2, x_est2)) 481s > # Test with and without dimnames on x 481s > dimnames <- list("a", LETTERS[1:2]) 481s > for (setDimnames in c(TRUE, FALSE)) { 481s + if (setDimnames) dimnames(x) <- dimnames 481s + else dimnames(x) <- NULL 481s + # Check names attribute 481s + for (useNames in c(TRUE, FALSE)) { 481s + x_est0 <- rowWeightedMedians_R(x, w = w, useNames = useNames) 481s + x_est1 <- rowWeightedMedians(x, w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + x_est0 <- colWeightedMedians_R(t(x), w = w, useNames = useNames) 481s + x_est1 <- colWeightedMedians(t(x), w = w, useNames = useNames) 481s + stopifnot(all.equal(x_est1, x_est0)) 481s + } 481s + } 481s > 481s 481s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 481s Copyright (C) 2025 The R Foundation for Statistical Computing 481s Platform: arm-unknown-linux-gnueabihf (32-bit) 481s 481s R is free software and comes with ABSOLUTELY NO WARRANTY. 481s You are welcome to redistribute it under certain conditions. 481s Type 'license()' or 'licence()' for distribution details. 481s 481s R is a collaborative project with many contributors. 481s Type 'contributors()' for more information and 481s 'citation()' on how to cite R or R packages in publications. 481s 481s Type 'demo()' for some demos, 'help()' for on-line help, or 481s 'help.start()' for an HTML browser interface to help. 481s Type 'q()' to quit R. 481s 481s > library("matrixStats") 481s > 481s > ## Create isFALSE() if running on an old version of R 481s > if (!exists("isFALSE", mode="function")) { 481s + isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x 481s + } 481s > 481s > rowWeightedMedians_R <- function(x, w, na.rm = FALSE, ..., useNames = TRUE) { 481s + res <- apply(x, MARGIN = 1L, FUN = weightedMedian, w = w, na.rm = na.rm, ...) 481s + 481s + # Keep naming support consistency same as rowWeightedMedians() 481s + if (!is.null(w)) { 481s + if (isFALSE(useNames)) names(res) <- NULL 481s + } 481s + else if (!useNames) names(res) <- NULL 481s + 481s + res 481s + } 481s > 481s > 481s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 481s > # Subsetted tests 481s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 481s > source("utils/validateIndicesFramework.R") 481s > # To check names attribute 481s > dimnames <- list(letters[1:6], LETTERS[1:6]) 481s > for (mode in c("numeric", "integer", "logical")) { 481s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 481s + w <- runif(6, min = 0, max = 6) 481s + storage.mode(x) <- mode 481s + storage.mode(w) <- if (mode == "logical") "integer" else mode 481s + if (mode == "numeric") w[1] <- Inf 481s + 481s + # Test with and without dimnames on x 481s + for (setDimnames in c(TRUE, FALSE)) { 481s + if (setDimnames) dimnames(x) <- dimnames 481s + else dimnames(x) <- NULL 481s + 481s + count <- 0L 481s + for (rows in index_cases) { 481s + for (cols in index_cases) { 481s + count <- count + 1L 481s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 481s + useNames <- c(TRUE, FALSE) 481s + useNames <- useNames[count %% length(useNames) + 1] 481s + 481s + validateIndicesTestMatrix_w(x, w, rows, cols, 481s + ftest = rowWeightedMedians, 481s + fsure = rowWeightedMedians_R, 481s + na.rm = na.rm, useNames = useNames) 481s + validateIndicesTestMatrix_w(x, w, rows, cols, 481s + fcoltest = colWeightedMedians, 481s + fsure = rowWeightedMedians_R, 481s + na.rm = na.rm, useNames = useNames) 481s + } 481s + } 481s + } 481s + } 482s > 482s 482s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 482s Copyright (C) 2025 The R Foundation for Statistical Computing 482s Platform: arm-unknown-linux-gnueabihf (32-bit) 482s 482s R is free software and comes with ABSOLUTELY NO WARRANTY. 482s You are welcome to redistribute it under certain conditions. 482s Type 'license()' or 'licence()' for distribution details. 482s 482s R is a collaborative project with many contributors. 482s Type 'contributors()' for more information and 482s 'citation()' on how to cite R or R packages in publications. 482s 482s Type 'demo()' for some demos, 'help()' for on-line help, or 482s 'help.start()' for an HTML browser interface to help. 482s Type 'q()' to quit R. 482s 482s > library("matrixStats") 482s > 482s > set.seed(1) 482s > 482s > x <- matrix(rnorm(20), nrow = 5L, ncol = 4L) 482s > print(x) 482s [,1] [,2] [,3] [,4] 482s [1,] -0.6264538 -0.8204684 1.5117812 -0.04493361 482s [2,] 0.1836433 0.4874291 0.3898432 -0.01619026 482s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 482s [4,] 1.5952808 0.5757814 -2.2146999 0.82122120 482s [5,] 0.3295078 -0.3053884 1.1249309 0.59390132 482s > 482s > # To check names attribute 482s > dimnames <- list(letters[1:5], LETTERS[1:4]) 482s > 482s > # Weighted row variances (uniform weights - all w = 1) 482s > # Non-weighted row variances 482s > x_est0 <- rowVars(x) 482s > w <- rep(1, times = ncol(x)) 482s > x_est1 <- rowWeightedVars(x, w = w) 482s > print(x_est1) 482s [1] 1.11767161 0.05022969 0.83582537 2.76819528 0.35351857 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > x_est2 <- colWeightedVars(t(x), w = w) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > # Check names attribute 482s > dimnames(x) <- dimnames 482s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 482s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > x_est0 <- rowVars(x, useNames = TRUE) 482s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 482s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > dimnames(x) <- NULL 482s > 482s > 482s > # Weighted row variances (uniform weights - all w = 3) 482s > x3 <- cbind(x, x, x) 482s > x_est0 <- rowVars(x3) 482s > w <- rep(3, times = ncol(x)) 482s > x_est1 <- rowWeightedVars(x, w = w) 482s > print(x_est1) 482s [1] 0.91445859 0.04109702 0.68385712 2.26488705 0.28924246 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > x_est2 <- colWeightedVars(t(x), w = w) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > # Check names attribute 482s > dimnames(x) <- dimnames 482s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 482s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > x3 <- cbind(x, x, x) 482s > x_est0 <- rowVars(x3, useNames = TRUE) 482s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 482s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > dimnames(x) <- NULL 482s > 482s > 482s > # Weighted row variances (excluding some columns) 482s > w <- c(1, 1, 0, 1) 482s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 482s > x_est1 <- rowWeightedVars(x, w = w) 482s > print(x_est1) 482s [1] 0.16287693 0.06430861 0.94767651 0.28313135 0.21361984 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > x_est2 <- colWeightedVars(t(x), w = w) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > # Check names attribute 482s > dimnames(x) <- dimnames 482s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 482s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 482s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 482s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > dimnames(x) <- NULL 482s > 482s > 482s > # Weighted row variances (excluding some columns) 482s > w <- c(0, 1, 0, 0) 482s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 482s > x_est1 <- rowWeightedVars(x, w = w) 482s > #stopifnot(all.equal(x_est1, x_est0)) 482s > x_est2 <- colWeightedVars(t(x), w = w) 482s > stopifnot(all.equal(x_est2, x_est1)) 482s > # Check names attribute 482s > dimnames(x) <- dimnames 482s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 482s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 482s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 482s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > dimnames(x) <- NULL 482s > 482s > 482s > # Weighted row variances (all zero weights) 482s > w <- c(0, 0, 0, 0) 482s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE]) 482s > x_est1 <- rowWeightedVars(x, w = w) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > x_est2 <- colWeightedVars(t(x), w = w) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > # Check names attribute 482s > dimnames(x) <- dimnames 482s > x_est1 <- rowWeightedVars(x, w = w, useNames = FALSE) 482s > x_est2 <- colWeightedVars(t(x), w = w, useNames = FALSE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > x_est0 <- rowVars(x[, (w == 1), drop = FALSE], useNames = TRUE) 482s > x_est1 <- rowWeightedVars(x, w = w, useNames = TRUE) 482s > x_est2 <- colWeightedVars(t(x), w = w, useNames = TRUE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > dimnames(x) <- NULL 482s > 482s > # Weighted variances by rows and columns 482s > w <- 1:4 482s > # Test with and without dimnames on x 482s > for (setDimnames in c(TRUE, FALSE)) { 482s + if (setDimnames) dimnames(x) <- dimnames 482s + else dimnames(x) <- NULL 482s + # Check names attribute 482s + for (useNames in c(TRUE, FALSE)) { 482s + x_est1 <- rowWeightedVars(x, w = w, useNames = useNames) 482s + print(x_est1) 482s + x_est2 <- colWeightedVars(t(x), w = w, useNames = useNames) 482s + stopifnot(all.equal(x_est2, x_est1)) 482s + } 482s + } 482s a b c d e 482s 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 482s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 482s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 482s [1] 0.90747094 0.05040463 0.65089440 2.28697479 0.27902734 482s > 482s > 482s > x[sample(length(x), size = 0.3 * length(x))] <- NA 482s > print(x) 482s [,1] [,2] [,3] [,4] 482s [1,] -0.6264538 NA 1.5117812 -0.04493361 482s [2,] 0.1836433 NA NA -0.01619026 482s [3,] -0.8356286 0.7383247 -0.6212406 0.94383621 482s [4,] 1.5952808 NA -2.2146999 0.82122120 482s [5,] 0.3295078 NA NA 0.59390132 482s > 482s > # Non-weighted row variances with missing values 482s > x_est0 <- rowVars(x, na.rm = TRUE) 482s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE) 482s > print(x_est1) 482s [1] 1.22226258 0.01996673 0.83582537 4.05532299 0.03495197 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > # Check names attribute 482s > dimnames(x) <- dimnames 482s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 482s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = FALSE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > x_est0 <- rowVars(x, na.rm = TRUE, useNames = TRUE) 482s > x_est1 <- rowWeightedVars(x, w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 482s > x_est2 <- colWeightedVars(t(x), w = rep(1, times = ncol(x)), na.rm = TRUE, useNames = TRUE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > dimnames(x) <- NULL 482s > 482s > 482s > # Weighted row variances with missing values 482s > # Test with and without dimnames on x 482s > for (setDimnames in c(TRUE, FALSE)) { 482s + if (setDimnames) dimnames(x) <- dimnames 482s + else dimnames(x) <- NULL 482s + # Check names attribute 482s + for (useNames in c(TRUE, FALSE)) { 482s + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 482s + print(x_est1) 482s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 482s + stopifnot(all.equal(x_est2, x_est1)) 482s + } 482s + } 482s a b c d e 482s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 482s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 482s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 482s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 482s > 482s > 482s > # Weighted variances by rows and columns 482s > w <- 1:4 482s > # Test with and without dimnames on x 482s > for (setDimnames in c(TRUE, FALSE)) { 482s + if (setDimnames) dimnames(x) <- dimnames 482s + else dimnames(x) <- NULL 482s + # Check names attribute 482s + for (useNames in c(TRUE, FALSE)) { 482s + x_est1 <- rowWeightedVars(x, w = w, na.rm = TRUE, useNames = useNames) 482s + print(x_est1) 482s + x_est2 <- colWeightedVars(t(x), w = w, na.rm = TRUE, useNames = useNames) 482s + stopifnot(all.equal(x_est2, x_est1)) 482s + } 482s + } 482s a b c d e 482s 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 482s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 482s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 482s [1] 0.788377504 0.007986693 0.650894398 2.795470241 0.013980790 482s > 482s > 482s > # Weighted row standard deviation (excluding some columns) 482s > w <- c(1, 1, 0, 1) 482s > ## FIXME: rowVars()/rowSds() needs na.rm = FALSE (wrong default) 482s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE) 482s > x_est1 <- rowWeightedSds(x, w = w) 482s > print(x_est1) 482s [1] NA NA 0.9734868 NA NA 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > # Check names attribute 482s > dimnames(x) <- dimnames 482s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = FALSE) 482s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = FALSE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > x_est0 <- rowSds(x[, (w == 1), drop = FALSE], na.rm = FALSE, useNames = TRUE) 482s > x_est1 <- rowWeightedSds(x, w = w, na.rm = FALSE, useNames = TRUE) 482s > x_est2 <- colWeightedSds(t(x), w = w, na.rm = FALSE, useNames = TRUE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > dimnames(x) <- NULL 482s > 482s > 482s > # Weighted row MADs (excluding some columns) 482s > w <- c(1, 1, 0, 1) 482s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE]) 482s > x_est1 <- rowWeightedMads(x, w = w) 482s > print(x_est1) 482s [1] NA NA 0.3046914 NA NA 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > x_est2 <- colWeightedMads(t(x), w = w) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > # Check names attribute 482s > dimnames(x) <- dimnames 482s > x_est1 <- rowWeightedMads(x, w = w, useNames = FALSE) 482s > x_est2 <- colWeightedMads(t(x), w = w, useNames = FALSE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > x_est0 <- rowMads(x[, (w == 1), drop = FALSE], useNames = TRUE) 482s > x_est1 <- rowWeightedMads(x, w = w, useNames = TRUE) 482s > x_est2 <- colWeightedMads(t(x), w = w, useNames = TRUE) 482s > stopifnot(all.equal(x_est1, x_est0)) 482s > stopifnot(all.equal(x_est2, x_est0)) 482s > dimnames(x) <- NULL 482s > 483s 483s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 483s Copyright (C) 2025 The R Foundation for Statistical Computing 483s Platform: arm-unknown-linux-gnueabihf (32-bit) 483s 483s R is free software and comes with ABSOLUTELY NO WARRANTY. 483s You are welcome to redistribute it under certain conditions. 483s Type 'license()' or 'licence()' for distribution details. 483s 483s R is a collaborative project with many contributors. 483s Type 'contributors()' for more information and 483s 'citation()' on how to cite R or R packages in publications. 483s 483s Type 'demo()' for some demos, 'help()' for on-line help, or 483s 'help.start()' for an HTML browser interface to help. 483s Type 'q()' to quit R. 483s 483s > library("matrixStats") 483s > 483s > fcns <- list( 483s + weightedVar = c(rowWeightedVars, colWeightedVars), 483s + weightedSd = c(rowWeightedSds, colWeightedSds), 483s + weightedMad = c(rowWeightedMads, colWeightedMads) 483s + ) 483s > 483s > 483s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 483s > # Subsetted tests 483s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 483s > source("utils/validateIndicesFramework.R") 483s > # To check names attribute 483s > dimnames <- list(letters[1:6], LETTERS[1:6]) 483s > for (fcn in names(fcns)) { 483s + cat(sprintf("subsetted tests on matrix %s()...\n", fcn)) 483s + row_fcn <- fcns[[fcn]][[1]] 483s + col_fcn <- fcns[[fcn]][[2]] 483s + 483s + for (mode in c("numeric", "integer")) { 483s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 483s + w <- runif(6, min = 0, max = 6) 483s + storage.mode(x) <- mode 483s + storage.mode(w) <- mode 483s + if (mode == "numeric") w[1] <- Inf 483s + 483s + # Test with and without dimnames on x 483s + for (setDimnames in c(TRUE, FALSE)) { 483s + if (setDimnames) dimnames(x) <- dimnames 483s + else dimnames(x) <- NULL 483s + 483s + count <- 0L 483s + for (rows in index_cases) { 483s + for (cols in index_cases) { 483s + count <- count + 1L 483s + na.rm <- c(TRUE, FALSE)[count %% 2 + 1] 483s + useNames <- c(TRUE, FALSE) 483s + useNames <- useNames[count %% length(useNames) + 1] 483s + 483s + validateIndicesTestMatrix_w(x, w, rows, cols, 483s + ftest = row_fcn, fsure = row_fcn, 483s + na.rm = na.rm, useNames = useNames) 483s + validateIndicesTestMatrix_w(x, w, rows, cols, 483s + fcoltest = col_fcn, fsure = row_fcn, 483s + na.rm = na.rm, useNames = useNames) 483s + } 483s + } 483s + } 483s + } 483s + cat(sprintf("%s()...DONE\n", fcn)) 483s + } 483s subsetted tests on matrix weightedVar()... 483s weightedVar()...DONE 483s subsetted tests on matrix weightedSd()... 484s weightedSd()...DONE 484s subsetted tests on matrix weightedMad()... 485s weightedMad()...DONE 485s > 485s 485s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 485s Copyright (C) 2025 The R Foundation for Statistical Computing 485s Platform: arm-unknown-linux-gnueabihf (32-bit) 485s 485s R is free software and comes with ABSOLUTELY NO WARRANTY. 485s You are welcome to redistribute it under certain conditions. 485s Type 'license()' or 'licence()' for distribution details. 485s 485s R is a collaborative project with many contributors. 485s Type 'contributors()' for more information and 485s 'citation()' on how to cite R or R packages in publications. 485s 485s Type 'demo()' for some demos, 'help()' for on-line help, or 485s 'help.start()' for an HTML browser interface to help. 485s Type 'q()' to quit R. 485s 485s > library("matrixStats") 485s > 485s > signTabulate0 <- function(x, ...) { 485s + nneg <- sum(x < 0, na.rm = TRUE) 485s + nzero <- sum(x == 0, na.rm = TRUE) 485s + npos <- sum(x > 0, na.rm = TRUE) 485s + nna <- sum(is.na(x)) 485s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 485s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 485s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 485s + res <- as.double(res) 485s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 485s + if (is.integer(x)) res <- res[1:4] 485s + res 485s + } # signTabulate0() 485s > 485s > 485s > # Simulate data 485s > set.seed(0xBEEF) 485s Doubles: 485s > n <- 100L 485s > x <- runif(n) 485s > x[sample(n, size = 0.1 * n)] <- 0 485s > x[sample(n, size = 0.1 * n)] <- NA_real_ 485s > x[sample(n, size = 0.1 * n)] <- -Inf 485s > x[sample(n, size = 0.1 * n)] <- +Inf 485s > 485s > # Doubles 485s > message("Doubles:") 485s > counts0 <- signTabulate0(x) 485s > print(counts0) 485s Integers: 485s -1 0 +1 NA -Inf +Inf 485s 9 7 77 7 9 10 485s > counts1 <- signTabulate(x) 485s > print(counts1) 485s -1 0 +1 NA -Inf +Inf 485s 9 7 77 7 9 10 485s > stopifnot(identical(counts1, counts0)) 485s > 485s > # Integers 485s > message("Integers:") 485s > x <- suppressWarnings(as.integer(x)) 485s > counts0 <- signTabulate0(x) 485s > print(counts0) 485s -1 0 +1 NA 485s 0 74 0 26 485s > counts1 <- signTabulate(x) 485s > print(counts1) 485s -1 0 +1 NA 485s 0 74 0 26 485s > stopifnot(identical(counts1, counts0)) 485s > 485s 485s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 485s Copyright (C) 2025 The R Foundation for Statistical Computing 485s Platform: arm-unknown-linux-gnueabihf (32-bit) 485s 485s R is free software and comes with ABSOLUTELY NO WARRANTY. 485s You are welcome to redistribute it under certain conditions. 485s Type 'license()' or 'licence()' for distribution details. 485s 485s R is a collaborative project with many contributors. 485s Type 'contributors()' for more information and 485s 'citation()' on how to cite R or R packages in publications. 485s 485s Type 'demo()' for some demos, 'help()' for on-line help, or 485s 'help.start()' for an HTML browser interface to help. 485s Type 'q()' to quit R. 485s 485s > library("matrixStats") 485s > 485s > signTabulate0 <- function(x, ...) { 485s + nneg <- sum(x < 0, na.rm = TRUE) 485s + nzero <- sum(x == 0, na.rm = TRUE) 485s + npos <- sum(x > 0, na.rm = TRUE) 485s + nna <- sum(is.na(x)) 485s + nneginf <- sum(is.infinite(x) & x < 0, na.rm = TRUE) 485s + nposinf <- sum(is.infinite(x) & x > 0, na.rm = TRUE) 485s + res <- c(nneg, nzero, npos, nna, nneginf, nposinf) 485s + res <- as.double(res) 485s + names(res) <- c("-1", "0", "+1", "NA", "-Inf", "+Inf") 485s + if (is.integer(x)) res <- res[1:4] 485s + res 485s + } # signTabulate0() 485s > 485s > 485s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 485s > # Subsetted tests 485s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 485s > source("utils/validateIndicesFramework.R") 485s > x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6, ncol = 6) 485s > x[2:3, 4:5] <- +Inf 485s > x[4:5, 1:2] <- -Inf 485s > for (idxs in index_cases) { 485s + validateIndicesTestVector(x, idxs, 485s + ftest = signTabulate, fsure = signTabulate0) 485s + } 485s > 485s 485s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 485s Copyright (C) 2025 The R Foundation for Statistical Computing 485s Platform: arm-unknown-linux-gnueabihf (32-bit) 485s 485s R is free software and comes with ABSOLUTELY NO WARRANTY. 485s You are welcome to redistribute it under certain conditions. 485s Type 'license()' or 'licence()' for distribution details. 485s 485s R is a collaborative project with many contributors. 485s Type 'contributors()' for more information and 485s 'citation()' on how to cite R or R packages in publications. 485s 485s Type 'demo()' for some demos, 'help()' for on-line help, or 485s 'help.start()' for an HTML browser interface to help. 485s Type 'q()' to quit R. 485s 485s > library("matrixStats") 485s > options(warn = 1) 485s > 485s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 485s > # Consistency checks 485s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 485s > set.seed(1) 485s > 485s > sum2_R <- function(x, na.rm = FALSE, idxs = NULL) { 485s + if (is.null(idxs)) { 485s + sum(x, na.rm = na.rm) 485s + } else { 485s + sum(x[idxs], na.rm = na.rm) 485s + } 485s + } # sum2_R() 485s > 485s > 485s > cat("Consistency checks:\n") 485s Consistency checks: 485s > for (kk in 1:20) { 485s + cat("Random test #", kk, "\n", sep = "") 485s + 485s + # Simulate data in a matrix of any shape 485s + n <- sample(1e3, size = 1L) 485s + x <- rnorm(n, sd = 100) 485s + 485s + # Add NAs? 485s + if ((kk %% 4) %in% c(3, 0)) { 485s + cat("Adding NAs\n") 485s + nna <- sample(n, size = 1L) 485s + na_values <- c(NA_real_, NaN) 485s + t <- sample(na_values, size = nna, replace = TRUE) 485s + x[sample(length(x), size = nna)] <- t 485s + } 485s + 485s + # Integer or double? 485s + if ((kk %% 4) %in% c(2, 0)) { 485s + cat("Coercing to integers\n") 485s + storage.mode(x) <- "integer" 485s + } 485s + 485s + na.rm <- sample(c(TRUE, FALSE), size = 1L) 485s + 485s + # Sum over all 485s + y0 <- sum2_R(x, na.rm = na.rm) 485s + y1 <- sum2(x, na.rm = na.rm) 485s + stopifnot(all.equal(y1, y0)) 485s + 485s + # Sum over subset 485s + nidxs <- sample(n, size = 1L) 485s + idxs <- sample(n, size = nidxs) 485s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 485s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 485s + stopifnot(all.equal(y1, y0)) 485s + 485s + if (storage.mode(x) == "integer") { 485s + storage.mode(x) <- "logical" 485s + 485s + y0 <- sum2_R(x, na.rm = na.rm) 485s + y1 <- sum2(x, na.rm = na.rm) 485s + stopifnot(all.equal(y1, y0)) 485s + 485s + y0 <- sum2_R(x, na.rm = na.rm, idxs = idxs) 485s + y1 <- sum2(x, na.rm = na.rm, idxs = idxs) 485s + stopifnot(all.equal(y1, y0)) 485s + } 485s + } # for (kk ...) 485s Random test #1 485s Random test #2 485s Coercing to integers 485s Random test #3 485s Adding NAs 485s Random test #4 485s Adding NAs 485s Coercing to integers 485s Random test #5 485s Random test #6 485s Coercing to integers 485s Random test #7 485s Adding NAs 485s Random test #8 485s Adding NAs 485s Coercing to integers 485s Random test #9 485s Random test #10 485s Coercing to integers 485s Random test #11 485s Adding NAs 485s Random test #12 485s Adding NAs 485s Coercing to integers 485s Random test #13 485s Random test #14 485s Coercing to integers 485s Random test #15 485s Adding NAs 485s Random test #16 485s Adding NAs 485s Coercing to integers 485s Random test #17 485s Random test #18 485s Coercing to integers 485s Random test #19 485s Adding NAs 485s Random test #20 485s Adding NAs 485s Coercing to integers 485s > 485s > 485s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 485s > # All missing values 485s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 485s > for (n in 0:2) { 485s + for (na.rm in c(FALSE, TRUE)) { 485s + x <- rep(NA_real_, times = n) 485s + y0 <- sum(x, na.rm = na.rm) 485s + y <- sum2(x, na.rm = na.rm) 485s + stopifnot(all.equal(y, y0)) 485s + 485s + x <- rep(NA_integer_, times = n) 485s + y0 <- sum(x, na.rm = na.rm) 485s + y <- sum2(x, na.rm = na.rm) 485s + stopifnot(all.equal(y, y0)) 485s + 485s + x <- rep(NA, times = n) 485s + y0 <- sum(x, na.rm = na.rm) 485s + y <- sum2(x, na.rm = na.rm) 485s + stopifnot(all.equal(y, y0)) 485s + } 485s + } 485s > 485s > 485s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 485s > # Special cases 485s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 485s > for (na.rm in c(FALSE, TRUE)) { 485s + # Summing over zero elements (integers) 485s + x <- integer(0) 485s + s1 <- sum(x, na.rm = na.rm) 485s + s2 <- sum2(x, na.rm = na.rm) 485s + stopifnot(identical(s1, s2)) 485s + 485s + x <- 1:10 485s + idxs <- integer(0) 485s + s1 <- sum(x[idxs], na.rm = na.rm) 485s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 485s + stopifnot(identical(s1, s2)) 485s + 485s + # Summing over NA_integer_:s 485s + x <- rep(NA_integer_, times = 10L) 485s + s1 <- sum(x, na.rm = na.rm) 485s + s2 <- sum2(x, na.rm = na.rm) 485s + stopifnot(identical(s1, s2)) 485s + 485s + x <- rep(NA_integer_, times = 10L) 485s + idxs <- 1:5 485s + s1 <- sum(x[idxs], na.rm = na.rm) 485s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 485s + stopifnot(identical(s1, s2)) 485s + 485s + 485s + # Summing over zero elements (doubles) 485s + x <- double(0) 485s + s1 <- sum(x) 485s + s2 <- sum2(x) 485s + stopifnot( 485s + identical(s1, 0), 485s + identical(s1, s2) 485s + ) 485s + 485s + x <- as.double(1:10) 485s + idxs <- integer(0) 486s + s1 <- sum(x[idxs]) 486s + s2 <- sum2(x, idxs = idxs) 486s + stopifnot( 486s + identical(s1, 0), 486s + identical(s1, s2) 486s + ) 486s + 486s + # Summing over NA_real_:s 486s + x <- rep(NA_real_, times = 10L) 486s + s1 <- sum(x, na.rm = na.rm) 486s + s2 <- sum2(x, na.rm = na.rm) 486s + stopifnot( 486s + !na.rm || s1 == 0, 486s + identical(s1, s2) 486s + ) 486s + 486s + x <- rep(NA_real_, times = 10L) 486s + idxs <- 1:5 486s + s1 <- sum(x[idxs], na.rm = na.rm) 486s + s2 <- sum2(x, idxs = idxs, na.rm = na.rm) 486s + stopifnot( 486s + !na.rm || s1 == 0, 486s + identical(s1, s2) 486s + ) 486s + 486s + # Summing over -Inf:s 486s + x <- rep(-Inf, times = 3L) 486s + s1 <- sum(x, na.rm = na.rm) 486s + s2 <- sum2(x, na.rm = na.rm) 486s + stopifnot( 486s + is.infinite(s1) && s1 < 0, 486s + identical(s1, s2) 486s + ) 486s + 486s + # Summing over +Inf:s 486s + x <- rep(+Inf, times = 3L) 486s + s1 <- sum(x, na.rm = na.rm) 486s + s2 <- sum2(x, na.rm = na.rm) 486s + stopifnot(identical(s1, s2)) 486s + stopifnot( 486s + is.infinite(s1) && s1 > 0, 486s + identical(s1, s2) 486s + ) 486s + 486s + # Summing over mix of -Inf:s and +Inf:s 486s + x <- rep(c(-Inf, +Inf), times = 3L) 486s + s1 <- sum(x, na.rm = na.rm) 486s + s2 <- sum2(x, na.rm = na.rm) 486s + stopifnot( 486s + is.nan(s1), 486s + identical(s1, s2) 486s + ) 486s + 486s + # Summing over mix of -Inf:s and +Inf:s and numerics 486s + x <- rep(c(-Inf, +Inf, 3.14), times = 2L) 486s + s1 <- sum(x, na.rm = na.rm) 486s + s2 <- sum2(x, na.rm = na.rm) 486s + stopifnot( 486s + is.nan(s1), 486s + identical(s1, s2) 486s + ) 486s + 486s + # Summing over mix of NaN, NA, +Inf, and numerics 486s + x <- c(NaN, NA, +Inf, 3.14) 486s + s1 <- sum(x, na.rm = na.rm) 486s + s2 <- sum2(x, na.rm = na.rm) 486s + if (na.rm) { 486s + stopifnot( 486s + is.infinite(s1) && s1 > 0, 486s + identical(s2, s1) 486s + ) 486s + } else { 486s + stopifnot(is.na(s1), is.na(s2)) 486s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 486s + ## returned here (as one would expect). NaN might very well be returned, 486s + ## when both NA and NaN are involved. This is an accepted feature in R, 486s + ## which is documented in help("is.nan"). See also 486s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 486s + ## Thus, we cannot guarantee that s1 is identical to s0. 486s + } 486s + 486s + # Summing over mix of NaN, NA, +Inf, and numerics 486s + x <- c(NA, NaN, +Inf, 3.14) 486s + s1 <- sum(x, na.rm = na.rm) 486s + s2 <- sum2(x, na.rm = na.rm) 486s + if (na.rm) { 486s + stopifnot( 486s + is.infinite(s1) && s1 > 0, 486s + identical(s2, s1) 486s + ) 486s + } else { 486s + stopifnot(is.na(s1), is.na(s2)) 486s + ## NOTE, due to compiler optimization, it is not guaranteed that NA is 486s + ## returned here (as one would expect). NaN might very well be returned, 486s + ## when both NA and NaN are involved. This is an accepted feature in R, 486s + ## which is documented in help("is.nan"). See also 486s + ## https://stat.ethz.ch/pipermail/r-devel/2017-April/074009.html. 486s + ## Thus, we cannot guarantee that s1 is identical to s0. 486s + } 486s + } 486s > 486s > 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > # Summing of large integers 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > x <- c(.Machine$integer.max, 1L, -.Machine$integer.max) 486s > 486s > # Total gives integer overflow 486s > s1 <- sum(x[1:2]) # NA_integer_ w/ warning 486s > s2 <- sum2(x[1:2]) # NA_integer_ w/ warning 486s Warning in sum2(x[1:2]) : 486s Integer overflow. Use sum2(..., mode = "double") to avoid this. 486s > stopifnot( 486s + identical(s2, NA_integer_) 486s + ) 486s > 486s > ## Assert above warning 486s > res <- tryCatch({ 486s + s2 <- sum2(x[1:2]) 486s + }, warning = identity) 486s > stopifnot(inherits(res, "warning")) 486s > 486s > 486s > # Total gives integer overflow (coerce to numeric) 486s > s1 <- sum(as.numeric(x[1:2])) # 2147483648 486s > s2 <- sum2(as.numeric(x[1:2])) # 2147483648 486s > s3 <- sum2(x[1:2], mode = "double") # 2147483648 486s > stopifnot( 486s + identical(s1, 2147483648), 486s + identical(s1, s2), 486s + identical(s1, s3) 486s + ) 486s > 486s > # Cumulative sum would give integer overflow but not the total 486s > s1 <- sum(x) # 1L 486s > s2 <- sum2(x) # 1L 486s > stopifnot( 486s + identical(s1, 1L), 486s Warning in sum2(x, mode = "integer") : 486s sum2(x, mode = "integer") called with typeof(x) == "double"; did you mean to use as.integer(sum2(x))? 486s + identical(s1, s2) 486s + ) 486s > 486s > # Input is double but coercing result to integer 486s > x <- c(1, 2, 3.1) 486s > s1 <- sum2(x) 486s > s2 <- sum2(x, mode = "integer") 486s > stopifnot( 486s + identical(as.integer(s1), s2) 486s + ) 486s > 486s > ## Assert above warning 486s > res <- tryCatch({ 486s + s2 <- sum2(x, mode = "integer") 486s + }, warning = identity) 486s > stopifnot(inherits(res, "warning")) 486s > 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > # Summing of large doubles 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > ## Double overflow 486s > x <- rep(.Machine$double.xmax, times = 2L) 486s > y0 <- sum(x) 486s > print(y0) 486s [1] Inf 486s > y <- sum2(x) 486s > print(y) 486s [1] Inf 486s > stopifnot( 486s + is.infinite(y) && y > 0, 486s + identical(y, y0) 486s + ) 486s > 486s > x <- rep(-.Machine$double.xmax, times = 2L) 486s > y0 <- sum(x) 486s > print(y0) 486s [1] -Inf 486s > y <- sum2(x) 486s > print(y) 486s [1] -Inf 486s > stopifnot( 486s + is.infinite(y) && y < 0, 486s + identical(y, y0) 486s + ) 486s > 486s > 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > # Argument 'idxs' 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > x <- 1:10 486s > idxs_list <- list( 486s + integer = 1:5, 486s + double = as.double(1:5), 486s + logical = (x <= 5) 486s + ) 486s > 486s > for (idxs in idxs_list) { 486s + cat("idxs:\n") 486s + str(idxs) 486s + s1 <- sum(x[idxs], na.rm = TRUE) 486s + s2 <- sum2(x, idxs = idxs, na.rm = TRUE) 486s + stopifnot(identical(s1, s2)) 486s + } 486s idxs: 486s int [1:5] 1 2 3 4 5 486s idxs: 486s num [1:5] 1 2 3 4 5 486s idxs: 486s logi [1:10] TRUE TRUE TRUE TRUE TRUE FALSE ... 486s > 486s 486s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 486s Copyright (C) 2025 The R Foundation for Statistical Computing 486s Platform: arm-unknown-linux-gnueabihf (32-bit) 486s 486s R is free software and comes with ABSOLUTELY NO WARRANTY. 486s You are welcome to redistribute it under certain conditions. 486s Type 'license()' or 'licence()' for distribution details. 486s 486s R is a collaborative project with many contributors. 486s Type 'contributors()' for more information and 486s 'citation()' on how to cite R or R packages in publications. 486s 486s Type 'demo()' for some demos, 'help()' for on-line help, or 486s 'help.start()' for an HTML browser interface to help. 486s Type 'q()' to quit R. 486s 486s > library("matrixStats") 486s > 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > # Subsetted tests 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > source("utils/validateIndicesFramework.R") 486s > x <- runif(6, min = -6, max = 6) 486s > storage.mode(x) <- "integer" 486s > for (idxs in index_cases) { 486s + validateIndicesTestVector(x, idxs, 486s + ftest = sum2, fsure = sum, 486s + na.rm = FALSE) 486s + validateIndicesTestVector(x, idxs, 486s + ftest = sum2, fsure = sum, 486s + na.rm = TRUE) 486s + } 486s > 486s 486s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 486s Copyright (C) 2025 The R Foundation for Statistical Computing 486s Platform: arm-unknown-linux-gnueabihf (32-bit) 486s 486s R is free software and comes with ABSOLUTELY NO WARRANTY. 486s You are welcome to redistribute it under certain conditions. 486s Type 'license()' or 'licence()' for distribution details. 486s 486s R is a collaborative project with many contributors. 486s Type 'contributors()' for more information and 486s 'citation()' on how to cite R or R packages in publications. 486s 486s Type 'demo()' for some demos, 'help()' for on-line help, or 486s 'help.start()' for an HTML browser interface to help. 486s Type 'q()' to quit R. 486s 486s > library("matrixStats") 486s > 486s > set.seed(1) 486s > x <- rnorm(1e4) 486s > 486s > 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > # Variance estimators 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > sigma2_a <- var(x) 486s > cat(sprintf("var(x) = %g\n", sigma2_a)) 486s var(x) = 1.02487 486s > 486s > sigma2_b <- varDiff(x) 486s > cat(sprintf("varDiff(x) = %g\n", sigma2_b)) 486s varDiff(x) = 1.01224 486s > 486s > d <- abs(sigma2_b - sigma2_a) 486s > cat(sprintf("Absolute difference = %g\n", d)) 486s Absolute difference = 0.0126268 486s > stopifnot(d < 0.02) 486s > 486s > 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > # Standard deviation estimators 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > sigma_a <- sd(x) 486s > cat(sprintf("sd(x) = %g\n", sigma_a)) 486s sd(x) = 1.01236 486s > 486s > sigma_b <- sdDiff(x) 486s > cat(sprintf("sdDiff(x) = %g\n", sigma_b)) 486s sdDiff(x) = 1.0061 486s > 486s > d <- abs(sigma_b - sigma_a) 486s > cat(sprintf("Absolute difference = %g\n", d)) 486s Absolute difference = 0.00625567 486s > stopifnot(d < 0.01) 486s > 486s > # Sanity checks 486s > stopifnot(abs(sigma2_a - sigma_a ^ 2) < 1e-9) 486s > stopifnot(abs(sigma2_b - sigma_b ^ 2) < 1e-9) 486s > 486s > 486s > sigma_a2 <- mad(x) 486s > cat(sprintf("mad(x) = %g\n", sigma_a2)) 486s mad(x) = 0.998376 486s > 486s > sigma_b2 <- madDiff(x) 486s > cat(sprintf("madDiff(x) = %g\n", sigma_b2)) 486s madDiff(x) = 1.02513 486s > 486s > d <- abs(sigma_b2 - sigma_a2) 486s > cat(sprintf("Absolute difference = %g\n", d)) 486s Absolute difference = 0.0267497 486s > stopifnot(d < 0.05) 486s > 486s > 486s > sigma_a3 <- IQR(x) 486s > cat(sprintf("IQR(x) = %g\n", sigma_a3)) 486s IQR(x) = 1.35105 486s > 486s > sigma_b3 <- iqrDiff(x) 486s > cat(sprintf("iqrDiff(x) = %g\n", sigma_b3)) 486s iqrDiff(x) = 1.37797 486s > 486s > d <- abs(sigma_b3 - sigma_a3) 486s > cat(sprintf("Absolute difference = %g\n", d)) 486s Absolute difference = 0.0269152 486s > stopifnot(d < 0.05) 486s > 486s > 486s > 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > # Trimmed estimators 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > y <- x 486s > outliers <- sample(length(x), size = 0.1 * length(x)) 486s > y[outliers] <- 100 * y[outliers] 486s > 486s > sigma_ao <- sd(y[-outliers]) 486s > cat(sprintf("sd(y) = %g\n", sigma_ao)) 486s sd(y) = 1.01166 486s > 486s > sigma_bo <- sdDiff(y[-outliers]) 486s > cat(sprintf("sdDiff(y) = %g\n", sigma_bo)) 486s sdDiff(y) = 1.00743 486s > 486s > d <- abs(sigma_b - sigma_a) 486s > cat(sprintf("Absolute difference = %g\n", d)) 486s Absolute difference = 0.00625567 486s > stopifnot(d < 0.01) 486s > 486s > sigma_bot <- sdDiff(y, trim = 0.05) 486s > cat(sprintf("sdDiff(y, trim = 0.05) = %g\n", sigma_bot)) 486s sdDiff(y, trim = 0.05) = 7.74327 486s > 486s > d <- abs(sigma_bot - sigma_a) 486s > cat(sprintf("Absolute difference = %g\n", d)) 486s Absolute difference = 6.73091 486s > #stopifnot(d < 1e-3) 486s > 486s > sigma_cot <- madDiff(y, trim = 0.05) 486s > cat(sprintf("madDiff(y, trim = 0.05) = %g\n", sigma_cot)) 486s madDiff(y, trim = 0.05) = 1.15278 486s > 486s > sigma_dot <- iqrDiff(y, trim = 0.05) 486s > cat(sprintf("iqrDiff(y, trim = 0.05) = %g\n", sigma_dot)) 486s iqrDiff(y, trim = 0.05) = 1.55762 486s > 486s > 486s > fcns <- list( 486s + varDiff = varDiff, 486s + sdDiff = sdDiff, 486s + madDiff = madDiff, 486s + iqrDiff = iqrDiff 486s + ) 486s > 486s > for (name in names(fcns)) { 486s + cat(sprintf("%s()...\n", name)) 486s + fcn <- fcns[[name]] 486s + 486s + for (mode in c("integer", "double")) { 486s + cat("mode: ", mode, "", sep = "") 486s + for (n in 0:3) { 486s + x <- runif(n, min = -5, max = 5) 486s + storage.mode(x) <- mode 486s + str(x) 486s + 486s + y <- fcn(x) 486s + yt <- fcn(x, trim = 0.1) 486s + str(list("non-trimmed" = y, trimmed = yt)) 486s + } # for (mode ...) 486s + } 486s + 486s + cat(sprintf("%s()...DONE\n", name)) 486s + } # for (name ...) 486s varDiff()... 486s mode: integer int(0) 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s int -4 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s int [1:2] 3 2 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s int [1:3] 1 4 -1 486s List of 2 486s $ non-trimmed: num 16 486s $ trimmed : num 16 486s mode: double num(0) 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s num -0.794 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s num [1:2] 0.897 -3.728 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s num [1:3] 2.07 -1.13 1.94 486s List of 2 486s $ non-trimmed: num 9.83 486s $ trimmed : num 9.83 486s varDiff()...DONE 486s sdDiff()... 486s mode: integer int(0) 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s int 2 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s int [1:2] -4 1 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s int [1:3] -2 1 -1 486s List of 2 486s $ non-trimmed: num 2.5 486s $ trimmed : num 2.5 486s mode: double num(0) 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s num -3.78 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s num [1:2] -2.04 2.38 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s num [1:3] 1.42 -2.14 1.14 486s List of 2 486s $ non-trimmed: num 3.42 486s $ trimmed : num 3.42 486s sdDiff()...DONE 486s madDiff()... 486s mode: integer int(0) 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s int -1 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s int [1:2] -1 4 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s int [1:3] -1 0 -3 486s List of 2 486s $ non-trimmed: num 2.1 486s $ trimmed : num 2.1 486s mode: double num(0) 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s num -1.13 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s num [1:2] -1.7 -1.21 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s num [1:3] -2.39 -0.464 3.086 486s List of 2 486s $ non-trimmed: num 0.851 486s $ trimmed : num 0.851 486s madDiff()...DONE 486s iqrDiff()... 486s mode: integer int(0) 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s int 3 486s List of 2 486s $ non-trimmed: num 0 486s $ trimmed : num 0 486s int [1:2] -3 4 486s List of 2 486s $ non-trimmed: num 0 486s $ trimmed : num 0 486s int [1:3] 0 -2 -2 486s List of 2 486s $ non-trimmed: num 0.707 486s $ trimmed : num 0.707 486s mode: double num(0) 486s List of 2 486s $ non-trimmed: num NA 486s $ trimmed : num NA 486s num -4.46 486s List of 2 486s $ non-trimmed: num 0 486s $ trimmed : num 0 486s num [1:2] 3.67 1.02 486s List of 2 486s $ non-trimmed: num 0 486s $ trimmed : num 0 486s num [1:3] -0.537 -2.733 2.857 486s List of 2 486s $ non-trimmed: num 2.75 486s $ trimmed : num 2.75 486s iqrDiff()...DONE 486s > 486s 486s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 486s Copyright (C) 2025 The R Foundation for Statistical Computing 486s Platform: arm-unknown-linux-gnueabihf (32-bit) 486s 486s R is free software and comes with ABSOLUTELY NO WARRANTY. 486s You are welcome to redistribute it under certain conditions. 486s Type 'license()' or 'licence()' for distribution details. 486s 486s R is a collaborative project with many contributors. 486s Type 'contributors()' for more information and 486s 'citation()' on how to cite R or R packages in publications. 486s 486s Type 'demo()' for some demos, 'help()' for on-line help, or 486s 'help.start()' for an HTML browser interface to help. 486s Type 'q()' to quit R. 486s 486s > library("matrixStats") 486s > 486s > fcns <- list( 486s + varDiff = varDiff, 486s + sdDiff = sdDiff, 486s + madDiff = madDiff, 486s + iqrDiff = iqrDiff 486s + ) 486s > 486s > 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > # Subsetted tests 486s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 486s > source("utils/validateIndicesFramework.R") 486s > for (name in names(fcns)) { 486s + cat(sprintf("subsetted tests on %s()...\n", name)) 486s + fcn <- fcns[[name]] 486s + 486s + for (mode in c("numeric", "integer")) { 486s + x <- runif(6, min = -6, max = 6) 486s + storage.mode(x) <- mode 486s + trim <- runif(1, min = 0, max = 0.5) 486s + if (mode == "numeric") x[1] <- Inf 486s + 486s + for (diff in 1:2) { 486s + for (idxs in index_cases) { 486s + validateIndicesTestVector(x, idxs, 486s + ftest = fcn, fsure = fcn, 486s + na.rm = TRUE, diff = diff, trim = trim) 486s + validateIndicesTestVector(x, idxs, 486s + ftest = fcn, fsure = fcn, 486s + na.rm = FALSE, diff = diff, trim = trim) 486s + } 486s + } 486s + } 486s + cat(sprintf("%s()...DONE\n", name)) 486s + } 486s subsetted tests on varDiff()... 486s varDiff()...DONE 486s subsetted tests on sdDiff()... 486s sdDiff()...DONE 486s subsetted tests on madDiff()... 486s madDiff()...DONE 486s subsetted tests on iqrDiff()... 486s iqrDiff()...DONE 486s > 487s 487s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 487s Copyright (C) 2025 The R Foundation for Statistical Computing 487s Platform: arm-unknown-linux-gnueabihf (32-bit) 487s 487s R is free software and comes with ABSOLUTELY NO WARRANTY. 487s You are welcome to redistribute it under certain conditions. 487s Type 'license()' or 'licence()' for distribution details. 487s 487s R is a collaborative project with many contributors. 487s Type 'contributors()' for more information and 487s 'citation()' on how to cite R or R packages in publications. 487s 487s Type 'demo()' for some demos, 'help()' for on-line help, or 487s 'help.start()' for an HTML browser interface to help. 487s Type 'q()' to quit R. 487s 487s > library("matrixStats") 487s > 487s > for (mode in c("logical", "integer", "double")) { 487s + cat("mode: ", mode, "", sep = "") 487s + n <- 2L 487s + x <- runif(n, min = -5, max = 5) 487s + if (mode == "logical") { 487s + x <- x > 0 487s + } 487s + storage.mode(x) <- mode 487s + str(x) 487s + 487s + cat("All weights are 1\n") 487s + w <- rep(1, times = n) 487s + m0 <- weighted.mean(x, w) 487s + m1 <- weightedMean(x, w) 487s + str(list(m0 = m0, m1 = m1)) 487s + stopifnot(identical(m1, m0)) 487s + 487s + cat("First weight is 5\n") 487s + # Pull the mean towards zero 487s + w[1] <- 5 487s + str(w) 487s + m0 <- weighted.mean(x, w) 487s + m1 <- weightedMean(x, w) 487s + str(list(m0 = m0, m1 = m1)) 487s + stopifnot(identical(m1, m0)) 487s + 487s + cat("All weights are 0\n") 487s + # All weights set to zero 487s + w <- rep(0, times = n) 487s + m0 <- weighted.mean(x, w) 487s + m1 <- weightedMean(x, w) 487s + str(list(m0 = m0, m1 = m1)) 487s + stopifnot(identical(m1, m0)) 487s + 487s + cat("First weight is 8.5\n") 487s + # Put even more weight on the zero 487s + w[1] <- 8.5 487s + m0 <- weighted.mean(x, w) 487s + m1 <- weightedMean(x, w) 487s + str(list(m0 = m0, m1 = m1)) 487s + stopifnot(identical(m1, m0)) 487s + 487s + cat("First weight is Inf\n") 487s + # All weight on the first value 487s + w[1] <- Inf 487s + m0 <- weighted.mean(x, w) 487s + m1 <- weightedMean(x, w) 487s + str(list(m0 = m0, m1 = m1)) 487s + stopifnot(identical(m1, m0)) 487s + 487s + cat("Last weight is Inf\n") 487s + # All weight on the last value 487s + w[1] <- 1 487s + w[n] <- Inf 487s + m0 <- weighted.mean(x, w) 487s + m1 <- weightedMean(x, w) 487s + str(list(m0 = m0, m1 = m1)) 487s + stopifnot(identical(m1, m0)) 487s + } # for (mode ...) 487s mode: logical logi [1:2] TRUE TRUE 487s All weights are 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s First weight is 5 487s num [1:2] 5 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s All weights are 0 487s List of 2 487s $ m0: num NaN 487s $ m1: num NaN 487s First weight is 8.5 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s First weight is Inf 487s List of 2 487s $ m0: num NaN 487s $ m1: num NaN 487s Last weight is Inf 487s List of 2 487s $ m0: num NaN 487s $ m1: num NaN 487s mode: integer int [1:2] 3 -4 487s All weights are 1 487s List of 2 487s $ m0: num -0.5 487s $ m1: num -0.5 487s First weight is 5 487s num [1:2] 5 1 487s List of 2 487s $ m0: num 1.83 487s $ m1: num 1.83 487s All weights are 0 487s List of 2 487s $ m0: num NaN 487s $ m1: num NaN 487s First weight is 8.5 487s List of 2 487s $ m0: num 3 487s $ m1: num 3 487s First weight is Inf 487s List of 2 487s $ m0: num NaN 487s $ m1: num NaN 487s Last weight is Inf 487s List of 2 487s $ m0: num NaN 487s $ m1: num NaN 487s mode: double num [1:2] 3.39 -1.61 487s All weights are 1 487s List of 2 487s $ m0: num 0.889 487s $ m1: num 0.889 487s First weight is 5 487s num [1:2] 5 1 487s List of 2 487s $ m0: num 2.55 487s $ m1: num 2.55 487s All weights are 0 487s List of 2 487s $ m0: num NaN 487s $ m1: num NaN 487s First weight is 8.5 487s List of 2 487s $ m0: num 3.39 487s $ m1: num 3.39 487s First weight is Inf 487s List of 2 487s $ m0: num NaN 487s $ m1: num NaN 487s Last weight is Inf 487s List of 2 487s $ m0: num NaN 487s $ m1: num NaN 487s > 487s > 487s > message("*** Testing for missing values") 487s > # NA tests 487s > xs <- list(A = c(1, 2, 3), B = c(NA, 2, 3), C = c(NA, 2, 3)) 487s > ws <- list(A = c(1, 1, 1), B = c(NA, 1, 1), C = c(1, NA, 1)) 487s > ## NOTE: The (B, B) case with na.rm = TRUE is interesting because 487s > ## even if NAs in 'w' are not dropped by na.rm = TRUE, this one 487s > ## is because 'x' is dropped and therefore that first element 487s > ## is skipped in the computation. It basically does 487s > ## keep <- !is.na(x); x <- x[keep]; w <- w[keep] 487s > ## without looking at 'w'. 487s > for (x in xs) { 487s + for (mode in c("logical", "integer", "double")) { 487s + storage.mode(x) <- mode 487s + for (w in ws) { 487s + for (na.rm in c(FALSE, TRUE)) { 487s + cat(sprintf("mode: %s, na.rm = %s\n", mode, na.rm)) 487s + str(list(x = x, w = w)) 487s + m0 <- weighted.mean(x, w, na.rm = na.rm) 487s + m1 <- weightedMean(x, w, na.rm = na.rm) 487s + str(list(m0 = m0, m1 = m1)) 487s + stopifnot(all.equal(m1, m0)) 487s + } 487s + } 487s + } 487s + } 487s *** Testing for missing values 487s mode: logical, na.rm = FALSE 487s List of 2 487s $ x: logi [1:3] TRUE TRUE TRUE 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: logical, na.rm = TRUE 487s List of 2 487s $ x: logi [1:3] TRUE TRUE TRUE 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: logical, na.rm = FALSE 487s List of 2 487s $ x: logi [1:3] TRUE TRUE TRUE 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = TRUE 487s List of 2 487s $ x: logi [1:3] TRUE TRUE TRUE 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = FALSE 487s List of 2 487s $ x: logi [1:3] TRUE TRUE TRUE 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = TRUE 487s List of 2 487s $ x: logi [1:3] TRUE TRUE TRUE 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = FALSE 487s List of 2 487s $ x: int [1:3] 1 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: integer, na.rm = TRUE 487s List of 2 487s $ x: int [1:3] 1 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: integer, na.rm = FALSE 487s List of 2 487s $ x: int [1:3] 1 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = TRUE 487s List of 2 487s $ x: int [1:3] 1 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = FALSE 487s List of 2 487s $ x: int [1:3] 1 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = TRUE 487s List of 2 487s $ x: int [1:3] 1 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = FALSE 487s List of 2 487s $ x: num [1:3] 1 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: double, na.rm = TRUE 487s List of 2 487s $ x: num [1:3] 1 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: double, na.rm = FALSE 487s List of 2 487s $ x: num [1:3] 1 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = TRUE 487s List of 2 487s $ x: num [1:3] 1 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = FALSE 487s List of 2 487s $ x: num [1:3] 1 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = TRUE 487s List of 2 487s $ x: num [1:3] 1 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = FALSE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = TRUE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: logical, na.rm = FALSE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = TRUE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: logical, na.rm = FALSE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = TRUE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = FALSE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = TRUE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: integer, na.rm = FALSE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = TRUE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: integer, na.rm = FALSE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = TRUE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = FALSE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = TRUE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: double, na.rm = FALSE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = TRUE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: double, na.rm = FALSE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = TRUE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = FALSE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = TRUE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: logical, na.rm = FALSE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = TRUE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: logical, na.rm = FALSE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: logical, na.rm = TRUE 487s List of 2 487s $ x: logi [1:3] NA TRUE TRUE 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = FALSE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = TRUE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: integer, na.rm = FALSE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = TRUE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: integer, na.rm = FALSE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: integer, na.rm = TRUE 487s List of 2 487s $ x: int [1:3] NA 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = FALSE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = TRUE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] 1 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: double, na.rm = FALSE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = TRUE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] NA 1 1 487s List of 2 487s $ m0: num 1 487s $ m1: num 1 487s mode: double, na.rm = FALSE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s mode: double, na.rm = TRUE 487s List of 2 487s $ x: num [1:3] NA 1 1 487s $ w: num [1:3] 1 NA 1 487s List of 2 487s $ m0: num NA 487s $ m1: num NA 487s > 487s 487s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 487s Copyright (C) 2025 The R Foundation for Statistical Computing 487s Platform: arm-unknown-linux-gnueabihf (32-bit) 487s 487s R is free software and comes with ABSOLUTELY NO WARRANTY. 487s You are welcome to redistribute it under certain conditions. 487s Type 'license()' or 'licence()' for distribution details. 487s 487s R is a collaborative project with many contributors. 487s Type 'contributors()' for more information and 487s 'citation()' on how to cite R or R packages in publications. 487s 487s Type 'demo()' for some demos, 'help()' for on-line help, or 487s 'help.start()' for an HTML browser interface to help. 487s Type 'q()' to quit R. 487s 487s > library("matrixStats") 487s > 487s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 487s > # Subsetted tests 487s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 487s > source("utils/validateIndicesFramework.R") 487s > for (mode in c("numeric", "integer")) { 487s + x <- runif(6, min = -6, max = 6) 487s + w <- runif(6, min = 0, max = 6) 487s + storage.mode(x) <- mode 487s + storage.mode(w) <- mode 487s + if (mode == "numeric") w[1] <- Inf 487s + 487s + for (idxs in index_cases) { 487s + validateIndicesTestVector_w(x, w, idxs, 487s + ftest = weightedMean, fsure = weighted.mean, 487s + na.rm = TRUE, refine = TRUE) 487s + validateIndicesTestVector_w(x, w, idxs, 487s + ftest = weightedMean, fsure = weighted.mean, 487s + na.rm = FALSE, refine = TRUE) 487s + } 487s + } 487s > 487s 487s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 487s Copyright (C) 2025 The R Foundation for Statistical Computing 487s Platform: arm-unknown-linux-gnueabihf (32-bit) 487s 487s R is free software and comes with ABSOLUTELY NO WARRANTY. 487s You are welcome to redistribute it under certain conditions. 487s Type 'license()' or 'licence()' for distribution details. 487s 487s R is a collaborative project with many contributors. 487s Type 'contributors()' for more information and 487s 'citation()' on how to cite R or R packages in publications. 487s 487s Type 'demo()' for some demos, 'help()' for on-line help, or 487s 'help.start()' for an HTML browser interface to help. 487s Type 'q()' to quit R. 487s 487s > library("matrixStats") 487s > 487s > x <- 1:5 487s > y <- weightedMedian(x) 487s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = TRUE) 487s > print(y) 487s [1] 3 487s > 487s > y <- weightedMedian(x, w = c(NA, Inf, NA, Inf, NA), na.rm = FALSE) 487s > print(y) 487s [1] NA 487s > stopifnot(is.na(y)) 487s > 487s > x <- 1:10 487s > n <- length(x) 487s > 487s > y1 <- median(x) # 5.5 487s > y2 <- weightedMedian(x) # 5.5 487s > stopifnot(all.equal(y1, y2)) 487s > 487s > 487s > w <- rep(1, times = n) 487s > y1 <- weightedMedian(x, w) # 5.5 (default) 487s > y2a <- weightedMedian(x, ties = "weighted") # 5.5 (default) 487s > y2b <- weightedMedian(x, ties = "min") # 5 487s > y2c <- weightedMedian(x, ties = "max") # 6 487s > stopifnot(all.equal(y2a, y1)) 487s > 487s > y3 <- weightedMedian(x, w) # 5.5 (default) 487s > 487s > 487s > # Pull the median towards zero 487s > w[1] <- 5 487s > y1 <- weightedMedian(x, w) # 3.5 487s > y <- c(rep(0, times = w[1]), x[-1]) # Only possible for integer weights 487s > y2 <- median(y) # 3.5 487s > stopifnot(all.equal(y1, y2)) 487s > 487s > # Put even more weight on the zero 487s > w[1] <- 8.5 487s > y <- weightedMedian(x, w) # 2 487s > 487s > # All weight on the first value 487s > w[1] <- Inf 487s > y <- weightedMedian(x, w) # 1 487s > 487s > # All weight on the last value 487s > w[1] <- 1 487s > w[n] <- Inf 487s > y <- weightedMedian(x, w) # 10 487s > 487s > # All weights set to zero 487s > w <- rep(0, times = n) 487s > y <- weightedMedian(x, w) # NA 487s > 487s > x <- 1:4 487s > w <- rep(1, times = 4) 487s > for (mode in c("integer", "double")) { 487s + storage.mode(x) <- mode 487s + for (ties in c("weighted", "mean", "min", "max")) { 487s + cat(sprintf("ties = %s\n", ties)) 487s + y <- weightedMedian(x, w, ties = ties) 487s + } 487s + } 487s ties = weighted 487s ties = mean 487s ties = min 487s ties = max 487s ties = weighted 487s ties = mean 487s ties = min 487s ties = max 487s > 487s > set.seed(0x42) 487s > 487s > y <- weightedMedian(x = double(0L)) 487s > print(y) 487s [1] NA 487s > stopifnot(length(y) == 1L) 487s > stopifnot(is.na(y)) 487s > 487s > y <- weightedMedian(x = x[1]) 487s > print(y) 487s [1] 1 487s > stopifnot(length(y) == 1L) 487s > stopifnot(all.equal(y, x[1])) 487s > 487s > 487s > n <- 1e3 487s > x <- runif(n) 487s > w <- runif(n, min = 0, max = 1) 487s > for (mode in c("integer", "double")) { 487s + storage.mode(x) <- mode 487s + for (ties in c("weighted", "mean", "min", "max")) { 487s + y <- weightedMedian(x, w, ties = ties) 487s + cat(sprintf("mode = %s, ties = %s, result = %g\n", mode, ties, y)) 487s + } 487s + } 487s mode = integer, ties = weighted, result = 0 487s mode = integer, ties = mean, result = 0 487s mode = integer, ties = min, result = 0 487s mode = integer, ties = max, result = 0 487s mode = double, ties = weighted, result = 0 487s mode = double, ties = mean, result = 0 487s mode = double, ties = min, result = 0 487s mode = double, ties = max, result = 0 487s > 487s > 487s > # A large vector 487s > n <- 1e5 487s > x <- runif(n) 487s > w <- runif(n, min = 0, max = 1) 487s > y <- weightedMedian(x, w) 487s > 487s > y <- weightedMedian(x, w, ties = "min") 487s > 487s > 487s > # Single Number 487s > xs <- c(1, NA_integer_) 487s > ws <- c(1, NA_integer_) 487s > for (x in xs) { 487s + for (w in ws) { 487s + y <- weightedMedian(x = x, w = w) 487s + if (is.na(w)) z <- NA_real_ 487s + else z <- x[1] 487s + stopifnot(all.equal(y, z)) 487s + } 487s + } 487s > 487s > ## Logical 487s > x1 <- c(TRUE, FALSE, TRUE) 487s > w0 <- c(0, 0, 0) 487s > stopifnot(!is.finite(weightedMedian(x1, w0)), 487s + !is.infinite(weightedMedian(x1, w0))) 487s > 487s > w1 <- c(1, 1, 1) 487s > stopifnot(weightedMedian(x1, w1) == 1) 487s > 487s > w2 <- c(1, 2, 3) 487s > stopifnot(weightedMedian(x1, w2) == 1) 487s > 487s > ### NA 487s > stopifnot(is.na(weightedMedian(c(TRUE, FALSE, NA), 487s + c(1, 2, 3))), 487s + all.equal(weightedMedian(c(TRUE, FALSE, NA), 487s + c(1, 2, 3), 487s + na.rm = TRUE), 487s + weightedMedian(c(TRUE, FALSE), 487s + c(1, 2)))) 487s > ### Identical to as.integer() 487s > x <- rcauchy(100) 487s > w <- abs(rcauchy(100)) 487s > stopifnot(all.equal(weightedMedian(x > 0, w), 487s + weightedMedian(as.integer(x > 0), w))) 487s > 487s > 487s > 487s 487s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 487s Copyright (C) 2025 The R Foundation for Statistical Computing 487s Platform: arm-unknown-linux-gnueabihf (32-bit) 487s 487s R is free software and comes with ABSOLUTELY NO WARRANTY. 487s You are welcome to redistribute it under certain conditions. 487s Type 'license()' or 'licence()' for distribution details. 487s 487s R is a collaborative project with many contributors. 487s Type 'contributors()' for more information and 487s 'citation()' on how to cite R or R packages in publications. 487s 487s Type 'demo()' for some demos, 'help()' for on-line help, or 487s 'help.start()' for an HTML browser interface to help. 487s Type 'q()' to quit R. 487s 488s > library("matrixStats") 488s > 488s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 488s > # Subsetted tests 488s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 488s > source("utils/validateIndicesFramework.R") 488s > for (mode in c("numeric", "integer")) { 488s + x <- runif(6, min = -6, max = 6) 488s + w <- runif(6, min = 0, max = 6) 488s + storage.mode(x) <- mode 488s + storage.mode(w) <- mode 488s + if (mode == "numeric") w[1] <- Inf 488s + 488s + for (idxs in index_cases) { 488s + validateIndicesTestVector_w(x, w, idxs, 488s + ftest = weightedMedian, 488s + fsure = weightedMedian, 488s + na.rm = TRUE) 488s + validateIndicesTestVector_w(x, w, idxs, 488s + ftest = weightedMedian, 488s + fsure = weightedMedian, 488s + na.rm = FALSE) 488s + 488s + for (ties in c("weighted", "mean", "min", "max")) { 488s + validateIndicesTestVector_w(x, w, idxs, 488s + ftest = weightedMedian, 488s + fsure = weightedMedian, 488s + na.rm = TRUE, ties = ties) 488s + validateIndicesTestVector_w(x, w, idxs, 488s + ftest = weightedMedian, 488s + fsure = weightedMedian, 488s + na.rm = FALSE, ties = ties) 488s + } 488s + } 488s + } 488s > 488s 488s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 488s Copyright (C) 2025 The R Foundation for Statistical Computing 488s Platform: arm-unknown-linux-gnueabihf (32-bit) 488s 488s R is free software and comes with ABSOLUTELY NO WARRANTY. 488s You are welcome to redistribute it under certain conditions. 488s Type 'license()' or 'licence()' for distribution details. 488s 488s R is a collaborative project with many contributors. 488s Type 'contributors()' for more information and 488s 'citation()' on how to cite R or R packages in publications. 488s 488s Type 'demo()' for some demos, 'help()' for on-line help, or 488s 'help.start()' for an HTML browser interface to help. 488s Type 'q()' to quit R. 488s 488s > library("matrixStats") 488s > 488s > weightedVar_R <- function(x, w) { 488s + mu <- weighted.mean(x, w = w) 488s + sum(w * (x - mu) ^ 2) / (sum(w) - 1) 488s + } 488s > 488s > 488s > n <- 10 488s > x <- as.double(1:n) 488s > 488s > message("*** weightedVar() ...") 488s > 488s > message("- Zero elements") 488s > m0 <- var(integer(0)) 488s > m1 <- weightedVar(integer(0), w = integer(0)) 488s > str(list(m0 = m0, m1 = m1)) 488s *** weightedVar() ... 488s - Zero elements 488s List of 2 488s $ m0: num NA 488s $ m1: int NA 488s > stopifnot(all.equal(m1, m0)) 488s > 488s > 488s > message("- One elements") 488s > m0 <- var(1) 488s > m1 <- weightedVar(1) 488s > str(list(m0 = m0, m1 = m1)) 488s List of 2 488s $ m0: num NA 488s $ m1: num NA 488s > stopifnot(all.equal(m1, m0)) 488s > 488s > 488s > message("- Uniform weights (all w = 1)") 488s > m0 <- var(x) 488s > w <- rep(1, times = n) 488s > m1 <- weightedVar(x, w = w) 488s > str(list(m0 = m0, m1 = m1)) 488s List of 2 488s $ m0:- One elements 488s num 9.17 488s $ m1: num 9.17 488s > stopifnot(all.equal(m1, m0)) 488s > 488s > 488s > message("- Uniform weights (all w = 3)") 488s > m0 <- var(rep(x, each = 3)) 488s > w <- rep(3, times = n) 488s > m1 <- weightedVar(x, w = w) 488s > str(list(m0 = m0, m1 = m1)) 488s List of 2 488s - Uniform weights (all w = 1) 488s $ m0: num 8.53 488s $ m1: num 8.53 488s > stopifnot(all.equal(m1, m0)) 488s > 488s > 488s > message("- Uniform weights on the first five elements") 488s - Uniform weights (all w = 3) 488s > idxs <- 1:5 488s > m0 <- var(x[1:5]) 488s > w <- rep(0, times = n) 488s > w[idxs] <- 1 488s > m1 <- weightedVar(x, w = w) 488s > str(list(m0 = m0, m1 = m1)) 488s List of 2 488s $ m0: num 2.5 488s $ m1: num 2.5 488s > stopifnot(all.equal(m1, m0)) 488s > 488s > 488s > message("- Uniform weights on every second elements") 488s > idxs <- seq(from = 1, to = n, by = 2) 488s > m0 <- var(x[idxs]) 488s > w <- rep(0, times = n) 488s > w[idxs] <- 1 488s > m1 <- weightedVar(x, w = w) 488s > str(list(m0 = m0, m1 = m1)) 488s List of 2 488s $ m0: num 10 488s $ m1:- Uniform weights on the first five elements 488s num 10 488s > stopifnot(all.equal(m1, m0)) 488s > 488s > 488s > message("- All weights are zero") 488s > idxs <- integer(0L) 488s > m0 <- var(x[idxs]) 488s > w <- rep(0, times = n) 488s > w[idxs] <- 1 488s > m1 <- weightedVar(x, w = w) 488s > str(list(m0 = m0, m1 = m1)) 488s List of 2 488s $ m0: num NA 488s $ m1: num NA 488s > stopifnot(all.equal(m1, m0)) 488s > 488s > message("- Infinite weight on first element") 488s > idxs <- 1L 488s > m0 <- var(x[idxs]) 488s > w <- rep(0, times = n) 488s > w[idxs] <- Inf 488s > m1 <- weightedVar(x, w = w) 488s > str(list(m0 = m0, m1 = m1)) 488s List of 2 488s $ m0:- Uniform weights on every second elements 488s num NA 488s $ m1: num NA 488s > stopifnot(all.equal(m1, m0)) 488s > 488s > message("- Missing-value weight on first element") 488s > idxs <- 1L 488s > w <- rep(1, times = n) 488s > w[idxs] <- NA_real_ 488s > m1 <- weightedVar(x, w = w) 488s > str(list(m1 = m1)) 488s List of 1 488s $ m1: num NA 488s > stopifnot(identical(m1, NA_real_)) 488s > 488s > 488s > message("- Frequency weights") 488s - All weights are zero 488s > 488s > ## From https://en.wikipedia.org/wiki/Weighted_arithmetic_mean 488s > y <- c(2, 2, 4, 5, 5, 5) 488s > x <- unique(y) 488s > w <- table(y) 488s > stopifnot(names(w) == x) 488s > 488s > m0 <- weightedVar(x, w = w) 488s > m1 <- var(y) 488s > stopifnot(all.equal(m1, m0)) 488s > m2 <- weightedVar(x, w = w) 488s > str(list(m0 = m0, m1 = m1, m2 = m2)) 488s List of 3 488s $ m0: num 2.17 488s $ m1: num 2.17 488s $ m2:- Infinite weight on first element 488s - Missing-value weight on first element 488s num 2.17 488s > stopifnot(all.equal(m2, m0)) 488s > 488s > ## From https://github.com/HenrikBengtsson/matrixStats/issues/72 488s > large <- c(21, 8, 26, 1, 15, 33, 12, 25, 0, 84) 488s > years <- c(41706, 9301, 33678, 3082, 27040, 44188, 10049, 30591, 2275, 109831) 488s > 488s > m0 <- weightedVar(large, w = years) 488s > m1 <- weightedVar(large, w = years) 488s > str(list(m0 = m0, m1 = m1)) 488s List of 2 488s $ m0: num 899 488s $ m1: num 899 488s > stopifnot(all.equal(m1, m0)) 488s > 488s > message("*** weightedVar() ... DONE") 488s > 488s - Frequency weights 488s *** weightedVar() ... DONE 488s 488s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 488s Copyright (C) 2025 The R Foundation for Statistical Computing 488s Platform: arm-unknown-linux-gnueabihf (32-bit) 488s 488s R is free software and comes with ABSOLUTELY NO WARRANTY. 488s You are welcome to redistribute it under certain conditions. 488s Type 'license()' or 'licence()' for distribution details. 488s 488s R is a collaborative project with many contributors. 488s Type 'contributors()' for more information and 488s 'citation()' on how to cite R or R packages in publications. 488s 488s Type 'demo()' for some demos, 'help()' for on-line help, or 488s 'help.start()' for an HTML browser interface to help. 488s Type 'q()' to quit R. 488s 488s > library("matrixStats") 488s > 488s > fcns <- list( 488s + weightedVar = weightedVar, 488s + weightedSd = weightedSd, 488s + weightedMad = weightedMad 488s + ) 488s > 488s > for (name in names(fcns)) { 488s + cat(sprintf("%s()...\n", name)) 488s + fcn <- fcns[[name]] 488s + 488s + for (mode in c("integer", "double")) { 488s + cat("mode: ", mode, "\n", sep = "") 488s + n <- 15L 488s + x <- runif(n, min = -5, max = 5) 488s + storage.mode(x) <- mode 488s + str(x) 488s + 488s + for (add_na in c(FALSE, TRUE)) { 488s + cat("add_na: ", add_na, "\n", sep = "") 488s + if (add_na) { 488s + x[c(5, 7)] <- NA 488s + } 488s + str(x) 488s + 488s + for (na.rm in c(FALSE, TRUE)) { 488s + cat("na.rm: ", na.rm, "\n", sep = "") 488s + 488s + cat("Weights are not specified (all are 1)\n") 488s + m1 <- fcn(x, na.rm = na.rm) 488s + str(list(m1 = m1)) 488s + 488s + cat("All weights are 1\n") 488s + w <- rep(1, times = n) 488s + m1 <- fcn(x, w, na.rm = na.rm) 488s + str(list(m1 = m1)) 488s + 488s + cat("First weight is 5\n") 488s + # Pull the mean towards zero 488s + w[1] <- 5 488s + str(w) 488s + m1 <- fcn(x, w, na.rm = na.rm) 488s + str(list(m1 = m1)) 488s + 488s + cat("All weights are 0\n") 488s + # All weights set to zero 488s + w <- rep(0, times = n) 488s + m1 <- fcn(x, w, na.rm = na.rm) 488s + str(list(m1 = m1)) 488s + 488s + cat("First weight is 8.5\n") 488s + # Put even more weight on the zero 488s + w[1] <- 8.5 488s + m1 <- fcn(x, w, na.rm = na.rm) 488s + str(list(m1 = m1)) 488s + 488s + cat("First weight is Inf\n") 488s + # All weight on the first value 488s + w[1] <- Inf 488s + m1 <- fcn(x, w, na.rm = na.rm) 488s + str(list(m1 = m1)) 488s + 488s + cat("Last weight is Inf\n") 488s + # All weight on the last value 488s + w[1] <- 1 488s + w[n] <- Inf 488s + m1 <- fcn(x, w, na.rm = na.rm) 488s + str(list(m1 = m1)) 488s + 488s + cat("Last weight is NA\n") 488s + # All weight on the last value 488s + w[1] <- 1 488s + w[n] <- NA_real_ 488s + m1 <- fcn(x, w, na.rm = na.rm) 488s + str(list(m1 = m1)) 488s + } # for (na.rm ...) 488s + } # for (add_na ...) 488s + } # for (mode ...) 488s + 488s + cat(sprintf("%s()...DONE\n", name)) 488s + } # for (name ...) 488s weightedVar()... 488s mode: integer 488s int [1:15] -1 0 -4 4 0 2 -2 -1 -4 4 ... 488s add_na: FALSE 488s int [1:15] -1 0 -4 4 0 2 -2 -1 -4 4 ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 6.74 488s All weights are 1 488s List of 1 488s $ m1: num 6.74 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 5.36 488s All weights are 0 488s List of 1 488s $ m1: int NA 488s First weight is 8.5 488s List of 1 488s $ m1: int NA 488s First weight is Inf 488s List of 1 488s $ m1: int NA 488s Last weight is Inf 488s List of 1 488s $ m1: int NA 488s Last weight is NA 488s List of 1 488s $ m1: int NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 6.74 488s All weights are 1 488s List of 1 488s $ m1: num 6.74 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 5.36 488s All weights are 0 488s List of 1 488s $ m1: int NA 488s First weight is 8.5 488s List of 1 488s $ m1: int NA 488s First weight is Inf 488s List of 1 488s $ m1: int NA 488s Last weight is Inf 488s List of 1 488s $ m1: int NA 488s Last weight is NA 488s List of 1 488s $ m1: int NA 488s add_na: TRUE 488s int [1:15] -1 0 -4 4 NA 2 NA -1 -4 4 ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: int NA 488s All weights are 1 488s List of 1 488s $ m1: int NA 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: int NA 488s All weights are 0 488s List of 1 488s $ m1: int NA 488s First weight is 8.5 488s List of 1 488s $ m1: int NA 488s First weight is Inf 488s List of 1 488s $ m1: int NA 488s Last weight is Inf 488s List of 1 488s $ m1: int NA 488s Last weight is NA 488s List of 1 488s $ m1: int NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 7.58 488s All weights are 1 488s List of 1 488s $ m1: num 7.58 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 5.85 488s All weights are 0 488s List of 1 488s $ m1: int NA 488s First weight is 8.5 488s List of 1 488s $ m1: int NA 488s First weight is Inf 488s List of 1 488s $ m1: int NA 488s Last weight is Inf 488s List of 1 488s $ m1: int NA 488s Last weight is NA 488s List of 1 488s $ m1: int NA 488s mode: double 488s num [1:15] 3.63 2.36 -2.29 -3.8 1.89 ... 488s add_na: FALSE 488s num [1:15] 3.63 2.36 -2.29 -3.8 1.89 ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 8.78 488s All weights are 1 488s List of 1 488s $ m1: num 8.78 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 9.94 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 8.78 488s All weights are 1 488s List of 1 488s $ m1: num 8.78 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 9.94 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s add_na: TRUE 488s num [1:15] 3.63 2.36 -2.29 -3.8 NA ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num NA 488s All weights are 1 488s List of 1 488s $ m1: num NA 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num NA 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 8.19 488s All weights are 1 488s List of 1 488s $ m1: num 8.19 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 9.31 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s weightedVar()...DONE 488s weightedSd()... 488s mode: integer 488s int [1:15] -4 -2 -3 -3 0 -4 1 0 -3 1 ... 488s add_na: FALSE 488s int [1:15] -4 -2 -3 -3 0 -4 1 0 -3 1 ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 2.16 488s All weights are 1 488s List of 1 488s $ m1: num 2.16 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 2.2 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 2.16 488s All weights are 1 488s List of 1 488s $ m1: num 2.16 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 2.2 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s add_na: TRUE 488s int [1:15] -4 -2 -3 -3 NA -4 NA 0 -3 1 ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num NA 488s All weights are 1 488s List of 1 488s $ m1: num NA 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num NA 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 2.18 488s All weights are 1 488s List of 1 488s $ m1: num 2.18 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 2.14 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s mode: double 488s num [1:15] 4.018 3.525 4.409 -0.938 0.408 ... 488s add_na: FALSE 488s num [1:15] 4.018 3.525 4.409 -0.938 0.408 ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 2.98 488s All weights are 1 488s List of 1 488s $ m1: num 2.98 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 2.98 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 2.98 488s All weights are 1 488s List of 1 488s $ m1: num 2.98 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 2.98 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s add_na: TRUE 488s num [1:15] 4.018 3.525 4.409 -0.938 NA ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num NA 488s All weights are 1 488s List of 1 488s $ m1: num NA 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num NA 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 3 488s All weights are 1 488s List of 1 488s $ m1: num 3 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 3.04 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num NA 488s First weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is Inf 488s List of 1 488s $ m1: num NA 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s weightedSd()...DONE 488s weightedMad()... 488s mode: integer 488s int [1:15] -2 -3 -3 0 -3 -2 0 -2 -1 -2 ... 488s add_na: FALSE 488s int [1:15] -2 -3 -3 0 -3 -2 0 -2 -1 -2 ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 1.48 488s All weights are 1 488s List of 1 488s $ m1: num 1.48 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 1.48 488s All weights are 0 488s List of 1 488s $ m1: int NA 488s First weight is 8.5 488s List of 1 488s $ m1: int 0 488s First weight is Inf 488s List of 1 488s $ m1: int 0 488s Last weight is Inf 488s List of 1 488s $ m1: int 0 488s Last weight is NA 488s List of 1 488s $ m1: int NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 1.48 488s All weights are 1 488s List of 1 488s $ m1: num 1.48 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 1.48 488s All weights are 0 488s List of 1 488s $ m1: int NA 488s First weight is 8.5 488s List of 1 488s $ m1: int 0 488s First weight is Inf 488s List of 1 488s $ m1: int 0 488s Last weight is Inf 488s List of 1 488s $ m1: int 0 488s Last weight is NA 488s List of 1 488s $ m1: int NA 488s add_na: TRUE 488s int [1:15] -2 -3 -3 0 NA -2 NA -2 -1 -2 ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num NA 488s All weights are 1 488s List of 1 488s $ m1: int NA 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: int NA 488s All weights are 0 488s List of 1 488s $ m1: int NA 488s First weight is 8.5 488s List of 1 488s $ m1: int 0 488s First weight is Inf 488s List of 1 488s $ m1: int 0 488s Last weight is Inf 488s List of 1 488s $ m1: int 0 488s Last weight is NA 488s List of 1 488s $ m1: int NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 1.48 488s All weights are 1 488s List of 1 488s $ m1: num 1.48 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 1.48 488s All weights are 0 488s List of 1 488s $ m1: int NA 488s First weight is 8.5 488s List of 1 488s $ m1: int 0 488s First weight is Inf 488s List of 1 488s $ m1: int 0 488s Last weight is Inf 488s List of 1 488s $ m1: int 0 488s Last weight is NA 488s List of 1 488s $ m1: int NA 488s mode: double 488s num [1:15] -1.7341 3.0301 -0.0425 1.833 -3.9385 ... 488s add_na: FALSE 488s num [1:15] -1.7341 3.0301 -0.0425 1.833 -3.9385 ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 4.18 488s All weights are 1 488s List of 1 488s $ m1: num 4.18 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 2.96 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num 0 488s First weight is Inf 488s List of 1 488s $ m1: num 0 488s Last weight is Inf 488s List of 1 488s $ m1: num 0 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 4.18 488s All weights are 1 488s List of 1 488s $ m1: num 4.18 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 2.96 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num 0 488s First weight is Inf 488s List of 1 488s $ m1: num 0 488s Last weight is Inf 488s List of 1 488s $ m1: num 0 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s add_na: TRUE 488s num [1:15] -1.7341 3.0301 -0.0425 1.833 NA ... 488s na.rm: FALSE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num NA 488s All weights are 1 488s List of 1 488s $ m1: num NA 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num NA 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num 0 488s First weight is Inf 488s List of 1 488s $ m1: num 0 488s Last weight is Inf 488s List of 1 488s $ m1: num 0 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s na.rm: TRUE 488s Weights are not specified (all are 1) 488s List of 1 488s $ m1: num 2.92 488s All weights are 1 488s List of 1 488s $ m1: num 2.92 488s First weight is 5 488s num [1:15] 5 1 1 1 1 1 1 1 1 1 ... 488s List of 1 488s $ m1: num 3.62 488s All weights are 0 488s List of 1 488s $ m1: num NA 488s First weight is 8.5 488s List of 1 488s $ m1: num 0 488s First weight is Inf 488s List of 1 488s $ m1: num 0 488s Last weight is Inf 488s List of 1 488s $ m1: num 0 488s Last weight is NA 488s List of 1 488s $ m1: num NA 488s weightedMad()...DONE 488s > 488s 488s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 488s Copyright (C) 2025 The R Foundation for Statistical Computing 488s Platform: arm-unknown-linux-gnueabihf (32-bit) 488s 488s R is free software and comes with ABSOLUTELY NO WARRANTY. 488s You are welcome to redistribute it under certain conditions. 488s Type 'license()' or 'licence()' for distribution details. 488s 488s R is a collaborative project with many contributors. 488s Type 'contributors()' for more information and 488s 'citation()' on how to cite R or R packages in publications. 488s 488s Type 'demo()' for some demos, 'help()' for on-line help, or 488s 'help.start()' for an HTML browser interface to help. 488s Type 'q()' to quit R. 488s 488s > library("matrixStats") 489s > 489s > fcns <- list( 489s + weightedVar = weightedVar, 489s + weightedSd = weightedSd, 489s + weightedMad = weightedMad 489s + ) 489s > 489s > 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > # Subsetted tests 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > source("utils/validateIndicesFramework.R") 489s > for (name in names(fcns)) { 489s + cat(sprintf("subsetted tests on %s()...\n", name)) 489s + fcn <- fcns[[name]] 489s + 489s + for (mode in c("numeric", "integer")) { 489s + x <- runif(6, min = -6, max = 6) 489s + w <- runif(6, min = 0, max = 6) 489s + storage.mode(x) <- mode 489s + storage.mode(w) <- mode 489s + if (mode == "numeric") w[1] <- Inf 489s + 489s + for (idxs in index_cases) { 489s + validateIndicesTestVector_w(x, w, idxs, 489s + ftest = fcn, fsure = fcn, 489s + na.rm = TRUE) 489s + validateIndicesTestVector_w(x, w, idxs, 489s + ftest = fcn, fsure = fcn, 489s + na.rm = FALSE) 489s + } 489s + } 489s + cat(sprintf("%s()...DONE\n", name)) 489s + } 489s subsetted tests on weightedVar()... 489s weightedVar()...DONE 489s subsetted tests on weightedSd()... 489s weightedSd()...DONE 489s subsetted tests on weightedMad()... 489s weightedMad()...DONE 489s > 489s 489s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 489s Copyright (C) 2025 The R Foundation for Statistical Computing 489s Platform: arm-unknown-linux-gnueabihf (32-bit) 489s 489s R is free software and comes with ABSOLUTELY NO WARRANTY. 489s You are welcome to redistribute it under certain conditions. 489s Type 'license()' or 'licence()' for distribution details. 489s 489s R is a collaborative project with many contributors. 489s Type 'contributors()' for more information and 489s 'citation()' on how to cite R or R packages in publications. 489s 489s Type 'demo()' for some demos, 'help()' for on-line help, or 489s 'help.start()' for an HTML browser interface to help. 489s Type 'q()' to quit R. 489s 489s > library("matrixStats") 489s > 489s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 489s + if (na.rm) { 489s + xnok <- is.na(x) 489s + ynok <- is.na(y) 489s + anok <- xnok & ynok 489s + unit <- switch(OP, 489s + "+" = 0, 489s + "-" = NA_real_, 489s + "*" = 1, 489s + "/" = NA_real_, 489s + stop("Unknown 'OP' operator: ", OP) 489s + ) 489s + x[xnok] <- unit 489s + y[ynok] <- unit 489s + } 489s + 489s + ans <- switch(OP, 489s + "+" = x + y, 489s + "-" = x - y, 489s + "*" = x * y, 489s + "/" = x / y, 489s + stop("Unknown 'OP' operator: ", OP) 489s + ) 489s + 489s + if (na.rm) { 489s + ans[anok] <- NA_real_ 489s + } 489s + 489s + ans 489s + } # x_OP_y_R() 489s > 489s > 489s > 489s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 489s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 489s + } 489s > 489s > 489s > 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > # No missing values 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > x <- matrix(1:16, nrow = 4, ncol = 4) 489s > y <- 1:nrow(x) 489s > storage.mode(y) <- storage.mode(x) 489s > 489s > for (OP in c("+", "-", "*", "/")) { 489s + for (na.rm in c(FALSE, TRUE)) { 489s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 489s + 489s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 489s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 489s + str(a1) 489s + stopifnot(all.equal(a1, a0)) 489s + 489s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 489s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 489s + str(b1) 489s + stopifnot(all.equal(b1, b0)) 489s + } 489s + } 489s OP = '+', na.rm = FALSE 489s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 489s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 489s OP = '+', na.rm = TRUE 489s int [1:4, 1:4] 2 4 6 8 6 8 10 12 10 12 ... 489s int [1:4, 1:4] 2 3 4 5 7 8 9 10 12 13 ... 489s OP = '-', na.rm = FALSE 489s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 489s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 489s OP = '-', na.rm = TRUE 489s int [1:4, 1:4] 0 0 0 0 4 4 4 4 8 8 ... 489s int [1:4, 1:4] 0 1 2 3 3 4 5 6 6 7 ... 489s OP = '*', na.rm = FALSE 489s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 489s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 489s OP = '*', na.rm = TRUE 489s int [1:4, 1:4] 1 4 9 16 5 12 21 32 9 20 ... 489s int [1:4, 1:4] 1 2 3 4 10 12 14 16 27 30 ... 489s OP = '/', na.rm = FALSE 489s num [1:4, 1:4] 1 1 1 1 5 ... 489s num [1:4, 1:4] 1 2 3 4 2.5 ... 489s OP = '/', na.rm = TRUE 489s num [1:4, 1:4] 1 1 1 1 5 ... 489s num [1:4, 1:4] 1 2 3 4 2.5 ... 489s > 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > # Missing values in x, y, or both. 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > for (which in c("x", "y", "both")) { 489s + x <- matrix(1:16, nrow = 4, ncol = 4) 489s + y <- 1:nrow(x) 489s + storage.mode(y) <- storage.mode(x) 489s + 489s + if (which == "x") { 489s + x[3:6] <- NA_real_ 489s + } else if (which == "y") { 489s + y[c(1, 3)] <- NA_real_ 489s + } else if (which == "both") { 489s + x[3:6] <- NA_real_ 489s + y[c(1, 3)] <- NA_real_ 489s + } 489s + 489s + for (OP in c("+", "-", "*", "/")) { 489s + for (na.rm in c(FALSE, TRUE)) { 489s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 489s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 489s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 489s + str(a1) 489s + stopifnot(all.equal(a1, a0)) 489s + 489s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 489s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 489s + str(b1) 489s + stopifnot(all.equal(b1, b0)) 489s + } 489s + } 489s + } 489s OP = '+', na.rm = FALSE 489s num [1:4, 1:4] 2 4 NA NA NA NA 10 12 10 12 ... 489s num [1:4, 1:4] 2 3 NA NA NA NA 9 10 12 13 ... 489s OP = '+', na.rm = TRUE 489s num [1:4, 1:4] 2 4 3 4 1 2 10 12 10 12 ... 489s num [1:4, 1:4] 2 3 1 1 2 2 9 10 12 13 ... 489s OP = '-', na.rm = FALSE 489s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 489s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 489s OP = '-', na.rm = TRUE 489s num [1:4, 1:4] 0 0 NA NA NA NA 4 4 8 8 ... 489s num [1:4, 1:4] 0 1 NA NA NA NA 5 6 6 7 ... 489s OP = '*', na.rm = FALSE 489s num [1:4, 1:4] 1 4 NA NA NA NA 21 32 9 20 ... 489s num [1:4, 1:4] 1 2 NA NA NA NA 14 16 27 30 ... 489s OP = '*', na.rm = TRUE 489s num [1:4, 1:4] 1 4 3 4 1 2 21 32 9 20 ... 489s num [1:4, 1:4] 1 2 1 1 2 2 14 16 27 30 ... 489s OP = '/', na.rm = FALSE 489s num [1:4, 1:4] 1 1 NA NA NA ... 489s num [1:4, 1:4] 1 2 NA NA NA ... 489s OP = '/', na.rm = TRUE 489s num [1:4, 1:4] 1 1 NA NA NA ... 489s num [1:4, 1:4] 1 2 NA NA NA ... 489s OP = '+', na.rm = FALSE 489s num [1:4, 1:4] NA 4 NA 8 NA 8 NA 12 NA 12 ... 489s num [1:4, 1:4] NA NA NA NA 7 8 9 10 NA NA ... 489s OP = '+', na.rm = TRUE 489s num [1:4, 1:4] 1 4 3 8 5 8 7 12 9 12 ... 489s num [1:4, 1:4] 1 2 3 4 7 8 9 10 9 10 ... 489s OP = '-', na.rm = FALSE 489s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 489s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 489s OP = '-', na.rm = TRUE 489s num [1:4, 1:4] NA 0 NA 0 NA 4 NA 4 NA 8 ... 489s num [1:4, 1:4] NA NA NA NA 3 4 5 6 NA NA ... 489s OP = '*', na.rm = FALSE 489s num [1:4, 1:4] NA 4 NA 16 NA 12 NA 32 NA 20 ... 489s num [1:4, 1:4] NA NA NA NA 10 12 14 16 NA NA ... 489s OP = '*', na.rm = TRUE 489s num [1:4, 1:4] 1 4 3 16 5 12 7 32 9 20 ... 489s num [1:4, 1:4] 1 2 3 4 10 12 14 16 9 10 ... 489s OP = '/', na.rm = FALSE 489s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 489s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 489s OP = '/', na.rm = TRUE 489s num [1:4, 1:4] NA 1 NA 1 NA 3 NA 2 NA 5 ... 489s num [1:4, 1:4] NA NA NA NA 2.5 3 3.5 4 NA NA ... 489s OP = '+', na.rm = FALSE 489s num [1:4, 1:4] NA 4 NA NA NA NA NA 12 NA 12 ... 489s num [1:4, 1:4] NA NA NA NA NA NA 9 10 NA NA ... 489s OP = '+', na.rm = TRUE 489s num [1:4, 1:4] 1 4 NA 4 NA 2 7 12 9 12 ... 489s num [1:4, 1:4] 1 2 NA NA 2 2 9 10 9 10 ... 489s OP = '-', na.rm = FALSE 489s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 489s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 489s OP = '-', na.rm = TRUE 489s num [1:4, 1:4] NA 0 NA NA NA NA NA 4 NA 8 ... 489s num [1:4, 1:4] NA NA NA NA NA NA 5 6 NA NA ... 489s OP = '*', na.rm = FALSE 489s num [1:4, 1:4] NA 4 NA NA NA NA NA 32 NA 20 ... 489s num [1:4, 1:4] NA NA NA NA NA NA 14 16 NA NA ... 489s OP = '*', na.rm = TRUE 489s num [1:4, 1:4] 1 4 NA 4 NA 2 7 32 9 20 ... 489s num [1:4, 1:4] 1 2 NA NA 2 2 14 16 9 10 ... 489s OP = '/', na.rm = FALSE 489s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 489s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 489s OP = '/', na.rm = TRUE 489s num [1:4, 1:4] NA 1 NA NA NA NA NA 2 NA 5 ... 489s num [1:4, 1:4] NA NA NA NA NA NA 3.5 4 NA NA ... 489s > 489s > 489s > 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > # Length differences 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > x <- matrix(1:8, nrow = 2, ncol = 4) 489s > y <- 1:ncol(x) 489s > storage.mode(y) <- storage.mode(x) 489s > 489s > for (OP in c("+", "-", "*", "/")) { 489s + for (na.rm in c(FALSE, TRUE)) { 489s + cat(sprintf("OP = '%s', na.rm = %s\n", OP, na.rm)) 489s + 489s + a0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 489s + a1 <- x_OP_y(x, y, OP, na.rm = na.rm) 489s + str(a1) 489s + stopifnot(all.equal(a1, a0)) 489s + 489s + b0 <- t_tx_OP_y_R(x, y, OP, na.rm = na.rm) 489s + b1 <- t_tx_OP_y(x, y, OP, na.rm = na.rm) 489s + str(b1) 489s + stopifnot(all.equal(b1, b0)) 489s + } 489s + } 489s OP = '+', na.rm = FALSE 489s int [1:2, 1:4] 2 4 6 8 6 8 10 12 489s int [1:2, 1:4] 2 3 5 6 8 9 11 12 489s OP = '+', na.rm = TRUE 489s int [1:2, 1:4] 2 4 6 8 6 8 10 12 489s int [1:2, 1:4] 2 3 5 6 8 9 11 12 489s OP = '-', na.rm = FALSE 489s int [1:2, 1:4] 0 0 0 0 4 4 4 4 489s int [1:2, 1:4] 0 1 1 2 2 3 3 4 489s OP = '-', na.rm = TRUE 489s int [1:2, 1:4] 0 0 0 0 4 4 4 4 489s int [1:2, 1:4] 0 1 1 2 2 3 3 4 489s OP = '*', na.rm = FALSE 489s int [1:2, 1:4] 1 4 9 16 5 12 21 32 489s int [1:2, 1:4] 1 2 6 8 15 18 28 32 489s OP = '*', na.rm = TRUE 489s int [1:2, 1:4] 1 4 9 16 5 12 21 32 489s int [1:2, 1:4] 1 2 6 8 15 18 28 32 489s OP = '/', na.rm = FALSE 489s num [1:2, 1:4] 1 1 1 1 5 ... 489s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 489s OP = '/', na.rm = TRUE 489s num [1:2, 1:4] 1 1 1 1 5 ... 489s num [1:2, 1:4] 1 2 1.5 2 1.67 ... 489s > 489s > 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > # All missing values 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > xs <- list( 489s + A = matrix(1:2, nrow = 2, ncol = 2), 489s + B = matrix(NA_integer_, nrow = 2, ncol = 2) 489s + ) 489s > ys <- list( 489s + A = 1L, 489s + B = NA_integer_ 489s + ) 489s > 489s > for (x in xs) { 489s + for (y in ys) { 489s + for (mode in c("logical", "integer", "double")) { 489s + storage.mode(x) <- mode 489s + storage.mode(y) <- mode 489s + str(list(x = x, y = y)) 489s + 489s + for (OP in c("+", "-", "*", "/")) { 489s + for (na.rm in c(FALSE, TRUE)) { 489s + cat(sprintf("mode = '%s', OP = '%s', na.rm = %s\n", mode, OP, na.rm)) 489s + suppressWarnings({ 489s + z0 <- x_OP_y_R(x, y, OP, na.rm = na.rm) 489s + z <- x_OP_y(x, y, OP, na.rm = na.rm) 489s + }) 489s + str(z) 489s + stopifnot(all.equal(z, z0)) 489s + } 489s + } 489s + } # for (mode ...) 489s + } # for (y ...) 489s + } # for (x ...) 489s List of 2 489s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 489s $ y: logi TRUE 489s mode = 'logical', OP = '+', na.rm = FALSE 489s int [1:2, 1:2] 2 2 2 2 489s mode = 'logical', OP = '+', na.rm = TRUE 489s int [1:2, 1:2] 2 2 2 2 489s mode = 'logical', OP = '-', na.rm = FALSE 489s int [1:2, 1:2] 0 0 0 0 489s mode = 'logical', OP = '-', na.rm = TRUE 489s int [1:2, 1:2] 0 0 0 0 489s mode = 'logical', OP = '*', na.rm = FALSE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'logical', OP = '*', na.rm = TRUE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'logical', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] 1 1 1 1 489s mode = 'logical', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] 1 1 1 1 489s List of 2 489s $ x: int [1:2, 1:2] 1 1 1 1 489s $ y: int 1 489s mode = 'integer', OP = '+', na.rm = FALSE 489s int [1:2, 1:2] 2 2 2 2 489s mode = 'integer', OP = '+', na.rm = TRUE 489s int [1:2, 1:2] 2 2 2 2 489s mode = 'integer', OP = '-', na.rm = FALSE 489s int [1:2, 1:2] 0 0 0 0 489s mode = 'integer', OP = '-', na.rm = TRUE 489s int [1:2, 1:2] 0 0 0 0 489s mode = 'integer', OP = '*', na.rm = FALSE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'integer', OP = '*', na.rm = TRUE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'integer', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] 1 1 1 1 489s mode = 'integer', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] 1 1 1 1 489s List of 2 489s $ x: num [1:2, 1:2] 1 1 1 1 489s $ y: num 1 489s mode = 'double', OP = '+', na.rm = FALSE 489s num [1:2, 1:2] 2 2 2 2 489s mode = 'double', OP = '+', na.rm = TRUE 489s num [1:2, 1:2] 2 2 2 2 489s mode = 'double', OP = '-', na.rm = FALSE 489s num [1:2, 1:2] 0 0 0 0 489s mode = 'double', OP = '-', na.rm = TRUE 489s num [1:2, 1:2] 0 0 0 0 489s mode = 'double', OP = '*', na.rm = FALSE 489s num [1:2, 1:2] 1 1 1 1 489s mode = 'double', OP = '*', na.rm = TRUE 489s num [1:2, 1:2] 1 1 1 1 489s mode = 'double', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] 1 1 1 1 489s mode = 'double', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] 1 1 1 1 489s List of 2 489s $ x: logi [1:2, 1:2] TRUE TRUE TRUE TRUE 489s $ y: logi NA 489s mode = 'logical', OP = '+', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '+', na.rm = TRUE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'logical', OP = '-', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '-', na.rm = TRUE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '*', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '*', na.rm = TRUE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'logical', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s List of 2 489s $ x: int [1:2, 1:2] 1 1 1 1 489s $ y: int NA 489s mode = 'integer', OP = '+', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '+', na.rm = TRUE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'integer', OP = '-', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '-', na.rm = TRUE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '*', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '*', na.rm = TRUE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'integer', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s List of 2 489s $ x: num [1:2, 1:2] 1 1 1 1 489s $ y: num NA 489s mode = 'double', OP = '+', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '+', na.rm = TRUE 489s num [1:2, 1:2] 1 1 1 1 489s mode = 'double', OP = '-', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '-', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '*', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '*', na.rm = TRUE 489s num [1:2, 1:2] 1 1 1 1 489s mode = 'double', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s List of 2 489s $ x: logi [1:2, 1:2] NA NA NA NA 489s $ y: logi TRUE 489s mode = 'logical', OP = '+', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '+', na.rm = TRUE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'logical', OP = '-', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '-', na.rm = TRUE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '*', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '*', na.rm = TRUE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'logical', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s List of 2 489s $ x: int [1:2, 1:2] NA NA NA NA 489s $ y: int 1 489s mode = 'integer', OP = '+', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '+', na.rm = TRUE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'integer', OP = '-', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '-', na.rm = TRUE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '*', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '*', na.rm = TRUE 489s int [1:2, 1:2] 1 1 1 1 489s mode = 'integer', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s List of 2 489s $ x: num [1:2, 1:2] NA NA NA NA 489s $ y: num 1 489s mode = 'double', OP = '+', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '+', na.rm = TRUE 489s num [1:2, 1:2] 1 1 1 1 489s mode = 'double', OP = '-', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '-', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '*', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '*', na.rm = TRUE 489s num [1:2, 1:2] 1 1 1 1 489s mode = 'double', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s List of 2 489s $ x: logi [1:2, 1:2] NA NA NA NA 489s $ y: logi NA 489s mode = 'logical', OP = '+', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '+', na.rm = TRUE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '-', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '-', na.rm = TRUE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '*', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '*', na.rm = TRUE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'logical', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s List of 2 489s $ x: int [1:2, 1:2] NA NA NA NA 489s $ y: int NA 489s mode = 'integer', OP = '+', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '+', na.rm = TRUE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '-', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '-', na.rm = TRUE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '*', na.rm = FALSE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '*', na.rm = TRUE 489s int [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'integer', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s List of 2 489s $ x: num [1:2, 1:2] NA NA NA NA 489s $ y: num NA 489s mode = 'double', OP = '+', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '+', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '-', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '-', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '*', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '*', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '/', na.rm = FALSE 489s num [1:2, 1:2] NA NA NA NA 489s mode = 'double', OP = '/', na.rm = TRUE 489s num [1:2, 1:2] NA NA NA NA 489s > 489s 489s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 489s Copyright (C) 2025 The R Foundation for Statistical Computing 489s Platform: arm-unknown-linux-gnueabihf (32-bit) 489s 489s R is free software and comes with ABSOLUTELY NO WARRANTY. 489s You are welcome to redistribute it under certain conditions. 489s Type 'license()' or 'licence()' for distribution details. 489s 489s R is a collaborative project with many contributors. 489s Type 'contributors()' for more information and 489s 'citation()' on how to cite R or R packages in publications. 489s 489s Type 'demo()' for some demos, 'help()' for on-line help, or 489s 'help.start()' for an HTML browser interface to help. 489s Type 'q()' to quit R. 489s 489s > library("matrixStats") 489s > 489s > x_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 489s + if (na.rm) { 489s + xnok <- is.na(x) 489s + ynok <- is.na(y) 489s + anok <- xnok & ynok 489s + unit <- switch(OP, 489s + "+" = 0, 489s + "-" = NA_real_, 489s + "*" = 1, 489s + "/" = NA_real_, 489s + stop("Unknown 'OP' operator: ", OP) 489s + ) 489s + x[xnok] <- unit 489s + y[ynok] <- unit 489s + } 489s + 489s + ans <- switch(OP, 489s + "+" = x + y, 489s + "-" = x - y, 489s + "*" = x * y, 489s + "/" = x / y, 489s + stop("Unknown 'OP' operator: ", OP) 489s + ) 489s + 489s + if (na.rm) { 489s + ans[anok] <- NA_real_ 489s + } 489s + 489s + ans 489s + } # x_OP_y_R() 489s > 489s > 489s > t_tx_OP_y_R <- function(x, y, OP, na.rm = FALSE) { 489s + t(x_OP_y_R(x = t(x), y = y, OP = OP, na.rm = na.rm)) 489s + } 489s > 489s > 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > # Subsetted tests 489s > # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 489s > source("utils/validateIndicesFramework.R") 489s > for (OP in c("+", "-", "*", "/")) { 489s + for (mode in c("numeric", "integer", "logical")) { 489s + x <- matrix(runif(6 * 6, min = -6, max = 6), nrow = 6L, ncol = 6L) 489s + y <- runif(6, min = 0, max = 6) 489s + storage.mode(x) <- mode 489s + storage.mode(y) <- mode 489s + if (mode == "numeric") y[1] <- Inf 489s + 489s + for (xrows in index_cases) { 489s + for (xcols in index_cases) { 489s + if (is.null(xrows)) xrows <- seq_len(nrow(x)) 489s + if (is.null(xcols)) xcols <- seq_len(ncol(x)) 489s + 489s + for (yidxs in list(xrows, xcols)) { 489s + for (na.rm in c(TRUE, FALSE)) { 489s + 489s + suppressWarnings({ 489s + actual <- tryCatch( 489s + x_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 489s + na.rm = na.rm), 489s + error = function(c) "error" 489s + ) 489s + 489s + expect <- tryCatch( 489s + x_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 489s + na.rm = na.rm), 489s + error = function(c) "error" 489s + ) 489s + }) 489s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 489s + 489s + suppressWarnings({ 489s + actual <- tryCatch( 489s + t_tx_OP_y(x, y, OP, xrows = xrows, xcols = xcols, yidxs = yidxs, 489s + na.rm = na.rm), 489s + error = function(c) "error" 489s + ) 489s + 489s + expect <- tryCatch( 489s + t_tx_OP_y_R(x[xrows, xcols, drop = FALSE], y[yidxs], OP, 489s + na.rm = na.rm), 489s + error = function(c) "error" 489s + ) 489s + }) 489s + stopifnot(all.equal(as.vector(actual), as.vector(expect))) 489s + } 489s + } 489s + } 489s + } 489s + } 489s + } 493s > 493s 493s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 493s Copyright (C) 2025 The R Foundation for Statistical Computing 493s Platform: arm-unknown-linux-gnueabihf (32-bit) 493s 493s R is free software and comes with ABSOLUTELY NO WARRANTY. 493s You are welcome to redistribute it under certain conditions. 493s Type 'license()' or 'licence()' for distribution details. 493s 493s R is a collaborative project with many contributors. 493s Type 'contributors()' for more information and 493s 'citation()' on how to cite R or R packages in publications. 493s 493s Type 'demo()' for some demos, 'help()' for on-line help, or 493s 'help.start()' for an HTML browser interface to help. 493s Type 'q()' to quit R. 493s 493s > ## These tests need to be last of all tests, otherwise 493s > ## covr::package_coverage() gives an error. 493s > cat("1. Loading package\n") 493s 1. Loading package 493s > loadNamespace("matrixStats") 493s 493s > stopifnot("matrixStats" %in% loadedNamespaces()) 493s > 493s > cat("2. Unloading package\n") 493s 2. Unloading package 493s > unloadNamespace("matrixStats") 493s > stopifnot(!"matrixStats" %in% loadedNamespaces()) 493s > 493s > if (FALSE) { 493s + ## 'covr' gives "Error in library("matrixStats") : 493s + ## there is no package called 'matrixStats'" here, cf. 493s + ## https://travis-ci.org/HenrikBengtsson/matrixStats/builds/48015577 493s + 493s + cat("3. Attaching package\n") 493s + library("matrixStats") 493s + stopifnot("package:matrixStats" %in% search()) 493s + 493s + cat("4. Detaching package\n") 493s + detach("package:matrixStats") 493s + stopifnot(!"package:matrixStats" %in% search()) 493s + stopifnot("matrixStats" %in% loadedNamespaces()) 493s + 493s + cat("5. Unloading package\n") 493s + unloadNamespace("matrixStats") 493s + stopifnot(!"matrixStats" %in% loadedNamespaces()) 493s + 493s + cat("6. Attaching package (again)\n") 493s + library("matrixStats") 493s + stopifnot("package:matrixStats" %in% search()) 493s + 493s + cat("7. Detaching package (again)\n") 493s + detach("package:matrixStats") 493s + stopifnot(!"package:matrixStats" %in% search()) 493s + stopifnot("matrixStats" %in% loadedNamespaces()) 493s + } 493s > 493s > cat("7. DONE\n") 493s 7. DONE 493s > 494s autopkgtest [23:41:44]: test run-unit-test: -----------------------] 499s run-unit-test PASS 499s autopkgtest [23:41:49]: test run-unit-test: - - - - - - - - - - results - - - - - - - - - - 502s autopkgtest [23:41:52]: test pkg-r-autopkgtest: preparing testbed 532s autopkgtest [23:42:22]: testbed dpkg architecture: armhf 534s autopkgtest [23:42:24]: testbed apt version: 3.1.15 538s autopkgtest [23:42:27]: @@@@@@@@@@@@@@@@@@@@ test bed setup 539s autopkgtest [23:42:29]: testbed release detected to be: resolute 547s autopkgtest [23:42:37]: updating testbed package index (apt update) 550s Get:1 http://ftpmaster.internal/ubuntu resolute-proposed InRelease [124 kB] 550s Get:2 http://ftpmaster.internal/ubuntu resolute InRelease [124 kB] 551s Get:3 http://ftpmaster.internal/ubuntu resolute-updates InRelease [124 kB] 551s Get:4 http://ftpmaster.internal/ubuntu resolute-security InRelease [124 kB] 551s Get:5 http://ftpmaster.internal/ubuntu resolute-proposed/universe Sources [1645 kB] 557s Get:6 http://ftpmaster.internal/ubuntu resolute-proposed/main Sources [176 kB] 557s Get:7 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse Sources [29.4 kB] 557s Get:8 http://ftpmaster.internal/ubuntu resolute-proposed/main armhf Packages [246 kB] 558s Get:9 http://ftpmaster.internal/ubuntu resolute-proposed/universe armhf Packages [1405 kB] 562s Get:10 http://ftpmaster.internal/ubuntu resolute-proposed/multiverse armhf Packages [7452 B] 562s Get:11 http://ftpmaster.internal/ubuntu resolute/main Sources [1398 kB] 567s Get:12 http://ftpmaster.internal/ubuntu resolute/universe Sources [21.4 MB] 610s Get:13 http://ftpmaster.internal/ubuntu resolute/restricted Sources [15.1 kB] 610s Get:14 http://ftpmaster.internal/ubuntu resolute/main armhf Packages [1374 kB] 613s Get:15 http://ftpmaster.internal/ubuntu resolute/universe armhf Packages [15.3 MB] 641s Fetched 43.5 MB in 1min 31s (477 kB/s) 642s Reading package lists... 648s autopkgtest [23:44:18]: upgrading testbed (apt dist-upgrade and autopurge) 649s Reading package lists... 650s Building dependency tree... 650s Reading state information... 650s Calculating upgrade... 651s The following packages will be upgraded: 651s cryptsetup-bin dracut-install iproute2 iptables libcryptsetup12 libip4tc2 651s libip6tc2 libxtables12 wget 651s 9 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 651s Need to get 2407 kB of archives. 651s After this operation, 152 kB of additional disk space will be used. 651s Get:1 http://ftpmaster.internal/ubuntu resolute/main armhf iptables armhf 1.8.11-2ubuntu3 [345 kB] 652s Get:2 http://ftpmaster.internal/ubuntu resolute/main armhf libip4tc2 armhf 1.8.11-2ubuntu3 [22.0 kB] 652s Get:3 http://ftpmaster.internal/ubuntu resolute/main armhf libip6tc2 armhf 1.8.11-2ubuntu3 [22.3 kB] 652s Get:4 http://ftpmaster.internal/ubuntu resolute/main armhf libxtables12 armhf 1.8.11-2ubuntu3 [33.5 kB] 652s Get:5 http://ftpmaster.internal/ubuntu resolute/main armhf iproute2 armhf 6.18.0-1ubuntu1 [1123 kB] 655s Get:6 http://ftpmaster.internal/ubuntu resolute/main armhf libcryptsetup12 armhf 2:2.8.0-1ubuntu3 [254 kB] 656s Get:7 http://ftpmaster.internal/ubuntu resolute/main armhf wget armhf 1.25.0-2ubuntu4 [327 kB] 656s Get:8 http://ftpmaster.internal/ubuntu resolute/main armhf cryptsetup-bin armhf 2:2.8.0-1ubuntu3 [232 kB] 657s Get:9 http://ftpmaster.internal/ubuntu resolute/main armhf dracut-install armhf 109-11ubuntu1 [47.9 kB] 657s Preconfiguring packages ... 657s Fetched 2407 kB in 6s (389 kB/s) 658s (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 ... 68683 files and directories currently installed.) 658s Preparing to unpack .../0-iptables_1.8.11-2ubuntu3_armhf.deb ... 658s Unpacking iptables (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 658s Preparing to unpack .../1-libip4tc2_1.8.11-2ubuntu3_armhf.deb ... 658s Unpacking libip4tc2:armhf (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 658s Preparing to unpack .../2-libip6tc2_1.8.11-2ubuntu3_armhf.deb ... 658s Unpacking libip6tc2:armhf (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 658s Preparing to unpack .../3-libxtables12_1.8.11-2ubuntu3_armhf.deb ... 658s Unpacking libxtables12:armhf (1.8.11-2ubuntu3) over (1.8.11-2ubuntu2) ... 658s Preparing to unpack .../4-iproute2_6.18.0-1ubuntu1_armhf.deb ... 658s Unpacking iproute2 (6.18.0-1ubuntu1) over (6.16.0-1ubuntu3) ... 658s Preparing to unpack .../5-libcryptsetup12_2%3a2.8.0-1ubuntu3_armhf.deb ... 658s Unpacking libcryptsetup12:armhf (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 658s Preparing to unpack .../6-wget_1.25.0-2ubuntu4_armhf.deb ... 658s Unpacking wget (1.25.0-2ubuntu4) over (1.25.0-2ubuntu3) ... 658s Preparing to unpack .../7-cryptsetup-bin_2%3a2.8.0-1ubuntu3_armhf.deb ... 658s Unpacking cryptsetup-bin (2:2.8.0-1ubuntu3) over (2:2.8.0-1ubuntu2) ... 658s Preparing to unpack .../8-dracut-install_109-11ubuntu1_armhf.deb ... 658s Unpacking dracut-install (109-11ubuntu1) over (109-9ubuntu1) ... 658s Setting up libip4tc2:armhf (1.8.11-2ubuntu3) ... 658s Setting up wget (1.25.0-2ubuntu4) ... 658s Setting up libip6tc2:armhf (1.8.11-2ubuntu3) ... 658s Setting up libxtables12:armhf (1.8.11-2ubuntu3) ... 658s Setting up dracut-install (109-11ubuntu1) ... 658s Setting up libcryptsetup12:armhf (2:2.8.0-1ubuntu3) ... 658s Setting up cryptsetup-bin (2:2.8.0-1ubuntu3) ... 658s Setting up iptables (1.8.11-2ubuntu3) ... 658s Setting up iproute2 (6.18.0-1ubuntu1) ... 659s Processing triggers for man-db (2.13.1-1build1) ... 660s Processing triggers for install-info (7.2-5) ... 660s Processing triggers for libc-bin (2.42-2ubuntu4) ... 662s Reading package lists... 662s Building dependency tree... 662s Reading state information... 662s Solving dependencies... 663s 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. 666s autopkgtest [23:44:36]: rebooting testbed after setup commands that affected boot 741s Reading package lists... 742s Building dependency tree... 742s Reading state information... 742s Solving dependencies... 742s The following NEW packages will be installed: 742s build-essential cpp cpp-15 cpp-15-arm-linux-gnueabihf 742s cpp-arm-linux-gnueabihf dctrl-tools fontconfig fontconfig-config 742s fonts-dejavu-core fonts-dejavu-mono fonts-glyphicons-halflings fonts-mathjax 742s g++ g++-15 g++-15-arm-linux-gnueabihf g++-arm-linux-gnueabihf gcc gcc-15 742s gcc-15-arm-linux-gnueabihf gcc-arm-linux-gnueabihf gfortran gfortran-15 742s gfortran-15-arm-linux-gnueabihf gfortran-arm-linux-gnueabihf icu-devtools 742s libasan8 libblas-dev libblas3 libbz2-dev libc-dev-bin libc6-dev libcairo2 742s libcc1-0 libcrypt-dev libdatrie1 libdeflate-dev libdeflate0 libfontconfig1 742s libfreetype6 libgcc-15-dev libgfortran-15-dev libgfortran5 libgomp1 742s libgraphite2-3 libharfbuzz0b libice6 libicu-dev libisl23 libjbig0 742s libjpeg-dev libjpeg-turbo8 libjpeg-turbo8-dev libjpeg8 libjpeg8-dev 742s libjs-bootstrap libjs-highlight.js libjs-jquery libjs-jquery-datatables 742s libjs-mathjax liblapack-dev liblapack3 liblerc4 liblzma-dev libmpc3 742s libncurses-dev libpango-1.0-0 libpangocairo-1.0-0 libpangoft2-1.0-0 742s libpaper-utils libpaper2 libpcre2-16-0 libpcre2-32-0 libpcre2-dev 742s libpcre2-posix3 libpixman-1-0 libpkgconf3 libpng-dev libreadline-dev 742s libsharpyuv0 libsm6 libstdc++-15-dev libtcl8.6 libthai-data libthai0 742s libtiff6 libtirpc-dev libtk8.6 libubsan1 libwebp7 libxcb-render0 libxcb-shm0 742s libxft2 libxrender1 libxss1 libxt6t64 libzstd-dev linux-libc-dev 742s node-normalize.css pkg-r-autopkgtest pkgconf pkgconf-bin r-base-core 742s r-base-dev r-cran-base64enc r-cran-cli r-cran-commonmark r-cran-evaluate 742s r-cran-farver r-cran-ggplot2 r-cran-glue r-cran-gtable r-cran-highr 742s r-cran-isoband r-cran-knitr r-cran-labeling r-cran-lifecycle r-cran-markdown 742s r-cran-matrixstats r-cran-r6 r-cran-rcolorbrewer r-cran-rlang r-cran-s7 742s r-cran-scales r-cran-vctrs r-cran-viridislite r-cran-withr r-cran-xfun 742s r-cran-yaml rpcsvc-proto unzip x11-common xdg-utils zip zlib1g-dev 743s 0 upgraded, 134 newly installed, 0 to remove and 0 not upgraded. 743s Need to get 148 MB of archives. 743s After this operation, 406 MB of additional disk space will be used. 743s Get:1 http://ftpmaster.internal/ubuntu resolute/main armhf libc-dev-bin armhf 2.42-2ubuntu4 [21.8 kB] 743s Get:2 http://ftpmaster.internal/ubuntu resolute/main armhf linux-libc-dev armhf 6.19.0-3.3 [1804 kB] 749s Get:3 http://ftpmaster.internal/ubuntu resolute/main armhf libcrypt-dev armhf 1:4.5.1-1 [128 kB] 749s Get:4 http://ftpmaster.internal/ubuntu resolute/main armhf rpcsvc-proto armhf 1.4.3-1build1 [62.6 kB] 749s Get:5 http://ftpmaster.internal/ubuntu resolute/main armhf libc6-dev armhf 2.42-2ubuntu4 [1416 kB] 753s Get:6 http://ftpmaster.internal/ubuntu resolute/main armhf libisl23 armhf 0.27-1build1 [553 kB] 755s Get:7 http://ftpmaster.internal/ubuntu resolute/main armhf libmpc3 armhf 1.3.1-2 [47.0 kB] 756s Get:8 http://ftpmaster.internal/ubuntu resolute/main armhf cpp-15-arm-linux-gnueabihf armhf 15.2.0-12ubuntu1 [10.1 MB] 794s Get:9 http://ftpmaster.internal/ubuntu resolute/main armhf cpp-15 armhf 15.2.0-12ubuntu1 [1032 B] 794s Get:10 http://ftpmaster.internal/ubuntu resolute/main armhf cpp-arm-linux-gnueabihf armhf 4:15.2.0-4ubuntu1 [5756 B] 794s Get:11 http://ftpmaster.internal/ubuntu resolute/main armhf cpp armhf 4:15.2.0-4ubuntu1 [22.4 kB] 794s Get:12 http://ftpmaster.internal/ubuntu resolute/main armhf libcc1-0 armhf 15.2.0-12ubuntu1 [43.5 kB] 794s Get:13 http://ftpmaster.internal/ubuntu resolute/main armhf libgomp1 armhf 15.2.0-12ubuntu1 [129 kB] 795s Get:14 http://ftpmaster.internal/ubuntu resolute/main armhf libasan8 armhf 15.2.0-12ubuntu1 [2949 kB] 807s Get:15 http://ftpmaster.internal/ubuntu resolute/main armhf libubsan1 armhf 15.2.0-12ubuntu1 [1187 kB] 811s Get:16 http://ftpmaster.internal/ubuntu resolute/main armhf libgcc-15-dev armhf 15.2.0-12ubuntu1 [898 kB] 815s Get:17 http://ftpmaster.internal/ubuntu resolute/main armhf gcc-15-arm-linux-gnueabihf armhf 15.2.0-12ubuntu1 [19.5 MB] 887s Get:18 http://ftpmaster.internal/ubuntu resolute/main armhf gcc-15 armhf 15.2.0-12ubuntu1 [499 kB] 888s Get:19 http://ftpmaster.internal/ubuntu resolute/main armhf gcc-arm-linux-gnueabihf armhf 4:15.2.0-4ubuntu1 [1220 B] 888s Get:20 http://ftpmaster.internal/ubuntu resolute/main armhf gcc armhf 4:15.2.0-4ubuntu1 [5022 B] 888s Get:21 http://ftpmaster.internal/ubuntu resolute/main armhf libstdc++-15-dev armhf 15.2.0-12ubuntu1 [2638 kB] 893s Get:22 http://ftpmaster.internal/ubuntu resolute/main armhf g++-15-arm-linux-gnueabihf armhf 15.2.0-12ubuntu1 [11.4 MB] 918s Get:23 http://ftpmaster.internal/ubuntu resolute/main armhf g++-15 armhf 15.2.0-12ubuntu1 [25.3 kB] 918s Get:24 http://ftpmaster.internal/ubuntu resolute/main armhf g++-arm-linux-gnueabihf armhf 4:15.2.0-4ubuntu1 [968 B] 918s Get:25 http://ftpmaster.internal/ubuntu resolute/main armhf g++ armhf 4:15.2.0-4ubuntu1 [1086 B] 918s Get:26 http://ftpmaster.internal/ubuntu resolute/main armhf build-essential armhf 12.12ubuntu2 [5256 B] 918s Get:27 http://ftpmaster.internal/ubuntu resolute/main armhf dctrl-tools armhf 2.24-3build4 [95.0 kB] 919s Get:28 http://ftpmaster.internal/ubuntu resolute/main armhf libfreetype6 armhf 2.14.1+dfsg-2 [345 kB] 919s Get:29 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-dejavu-mono all 2.37-8build1 [502 kB] 920s Get:30 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-dejavu-core all 2.37-8build1 [834 kB] 922s Get:31 http://ftpmaster.internal/ubuntu resolute/main armhf fontconfig-config armhf 2.17.1-3ubuntu1 [38.5 kB] 922s Get:32 http://ftpmaster.internal/ubuntu resolute/main armhf libfontconfig1 armhf 2.17.1-3ubuntu1 [117 kB] 923s Get:33 http://ftpmaster.internal/ubuntu resolute/main armhf fontconfig armhf 2.17.1-3ubuntu1 [180 kB] 923s Get:34 http://ftpmaster.internal/ubuntu resolute/universe armhf fonts-glyphicons-halflings all 1.009~3.4.1+dfsg-6 [119 kB] 923s Get:35 http://ftpmaster.internal/ubuntu resolute/main armhf fonts-mathjax all 2.7.9+dfsg-1build1 [2283 kB] 928s Get:36 http://ftpmaster.internal/ubuntu resolute/main armhf libgfortran5 armhf 15.2.0-12ubuntu1 [334 kB] 929s Get:37 http://ftpmaster.internal/ubuntu resolute/main armhf libgfortran-15-dev armhf 15.2.0-12ubuntu1 [380 kB] 929s Get:38 http://ftpmaster.internal/ubuntu resolute/main armhf gfortran-15-arm-linux-gnueabihf armhf 15.2.0-12ubuntu1 [10.7 MB] 962s Get:39 http://ftpmaster.internal/ubuntu resolute/main armhf gfortran-15 armhf 15.2.0-12ubuntu1 [18.1 kB] 962s Get:40 http://ftpmaster.internal/ubuntu resolute/main armhf gfortran-arm-linux-gnueabihf armhf 4:15.2.0-4ubuntu1 [1020 B] 962s Get:41 http://ftpmaster.internal/ubuntu resolute/main armhf gfortran armhf 4:15.2.0-4ubuntu1 [1162 B] 962s Get:42 http://ftpmaster.internal/ubuntu resolute/main armhf icu-devtools armhf 78.2-1ubuntu1 [203 kB] 963s Get:43 http://ftpmaster.internal/ubuntu resolute/main armhf libblas3 armhf 3.12.1-7ubuntu1 [133 kB] 964s Get:44 http://ftpmaster.internal/ubuntu resolute/main armhf libblas-dev armhf 3.12.1-7ubuntu1 [141 kB] 964s Get:45 http://ftpmaster.internal/ubuntu resolute/main armhf libbz2-dev armhf 1.0.8-6build2 [31.2 kB] 964s Get:46 http://ftpmaster.internal/ubuntu resolute/main armhf libpixman-1-0 armhf 0.46.4-1 [196 kB] 965s Get:47 http://ftpmaster.internal/ubuntu resolute/main armhf libxcb-render0 armhf 1.17.0-2ubuntu1 [15.5 kB] 965s Get:48 http://ftpmaster.internal/ubuntu resolute/main armhf libxcb-shm0 armhf 1.17.0-2ubuntu1 [5956 B] 965s Get:49 http://ftpmaster.internal/ubuntu resolute/main armhf libxrender1 armhf 1:0.9.12-1 [16.6 kB] 965s Get:50 http://ftpmaster.internal/ubuntu resolute/main armhf libcairo2 armhf 1.18.4-3 [489 kB] 966s Get:51 http://ftpmaster.internal/ubuntu resolute/main armhf libdatrie1 armhf 0.2.14-1 [16.4 kB] 967s Get:52 http://ftpmaster.internal/ubuntu resolute/main armhf libdeflate0 armhf 1.23-2build1 [38.8 kB] 967s Get:53 http://ftpmaster.internal/ubuntu resolute/main armhf libdeflate-dev armhf 1.23-2build1 [45.1 kB] 967s Get:54 http://ftpmaster.internal/ubuntu resolute/main armhf libgraphite2-3 armhf 1.3.14-11ubuntu1 [65.2 kB] 967s Get:55 http://ftpmaster.internal/ubuntu resolute/main armhf libharfbuzz0b armhf 12.3.2-1 [501 kB] 969s Get:56 http://ftpmaster.internal/ubuntu resolute/main armhf x11-common all 1:7.7+24ubuntu1 [22.4 kB] 969s Get:57 http://ftpmaster.internal/ubuntu resolute/main armhf libice6 armhf 2:1.1.1-1build1 [37.5 kB] 969s Get:58 http://ftpmaster.internal/ubuntu resolute/main armhf libicu-dev armhf 78.2-1ubuntu1 [12.2 MB] 1014s Get:59 http://ftpmaster.internal/ubuntu resolute/main armhf libjpeg-turbo8 armhf 2.1.5-4ubuntu3 [129 kB] 1014s Get:60 http://ftpmaster.internal/ubuntu resolute/main armhf libjpeg-turbo8-dev armhf 2.1.5-4ubuntu3 [265 kB] 1015s Get:61 http://ftpmaster.internal/ubuntu resolute/main armhf libjpeg8 armhf 8c-2ubuntu11 [2148 B] 1015s Get:62 http://ftpmaster.internal/ubuntu resolute/main armhf libjpeg8-dev armhf 8c-2ubuntu11 [1484 B] 1015s Get:63 http://ftpmaster.internal/ubuntu resolute/main armhf libjpeg-dev armhf 8c-2ubuntu11 [1482 B] 1015s Get:64 http://ftpmaster.internal/ubuntu resolute/universe armhf libjs-bootstrap all 3.4.1+dfsg-6 [129 kB] 1015s Get:65 http://ftpmaster.internal/ubuntu resolute/universe armhf libjs-highlight.js all 10.7.3+dfsg-2 [144 kB] 1015s Get:66 http://ftpmaster.internal/ubuntu resolute/main armhf libjs-jquery all 3.7.1+dfsg+~3.5.33-1build1 [321 kB] 1016s Get:67 http://ftpmaster.internal/ubuntu resolute/universe armhf libjs-jquery-datatables all 1.11.5+dfsg-2build1 [145 kB] 1016s Get:68 http://ftpmaster.internal/ubuntu resolute/main armhf liblapack3 armhf 3.12.1-7ubuntu1 [2090 kB] 1020s Get:69 http://ftpmaster.internal/ubuntu resolute/main armhf liblapack-dev armhf 3.12.1-7ubuntu1 [2207 kB] 1025s Get:70 http://ftpmaster.internal/ubuntu resolute/main armhf liblerc4 armhf 4.0.0+ds-5ubuntu2 [162 kB] 1026s Get:71 http://ftpmaster.internal/ubuntu resolute/main armhf libncurses-dev armhf 6.6+20251231-1 [348 kB] 1026s Get:72 http://ftpmaster.internal/ubuntu resolute/main armhf libthai-data all 0.1.30-1 [155 kB] 1027s Get:73 http://ftpmaster.internal/ubuntu resolute/main armhf libthai0 armhf 0.1.30-1 [15.4 kB] 1027s Get:74 http://ftpmaster.internal/ubuntu resolute/main armhf libpango-1.0-0 armhf 1.57.0-1 [218 kB] 1027s Get:75 http://ftpmaster.internal/ubuntu resolute/main armhf libpangoft2-1.0-0 armhf 1.57.0-1 [45.2 kB] 1027s Get:76 http://ftpmaster.internal/ubuntu resolute/main armhf libpangocairo-1.0-0 armhf 1.57.0-1 [25.3 kB] 1027s Get:77 http://ftpmaster.internal/ubuntu resolute/main armhf libpaper2 armhf 2.2.5-0.3build1 [16.3 kB] 1027s Get:78 http://ftpmaster.internal/ubuntu resolute/main armhf libpaper-utils armhf 2.2.5-0.3build1 [14.2 kB] 1027s Get:79 http://ftpmaster.internal/ubuntu resolute/main armhf libpcre2-16-0 armhf 10.46-1 [206 kB] 1028s Get:80 http://ftpmaster.internal/ubuntu resolute/main armhf libpcre2-32-0 armhf 10.46-1 [197 kB] 1028s Get:81 http://ftpmaster.internal/ubuntu resolute/main armhf libpcre2-posix3 armhf 10.46-1 [6286 B] 1028s Get:82 http://ftpmaster.internal/ubuntu resolute/main armhf libpcre2-dev armhf 10.46-1 [744 kB] 1030s Get:83 http://ftpmaster.internal/ubuntu resolute/main armhf libpkgconf3 armhf 1.8.1-4build1 [26.6 kB] 1030s Get:84 http://ftpmaster.internal/ubuntu resolute/main armhf zlib1g-dev armhf 1:1.3.dfsg+really1.3.1-1ubuntu2 [881 kB] 1032s Get:85 http://ftpmaster.internal/ubuntu resolute/main armhf libpng-dev armhf 1.6.54-1 [252 kB] 1033s Get:86 http://ftpmaster.internal/ubuntu resolute/main armhf libreadline-dev armhf 8.3-3 [165 kB] 1033s Get:87 http://ftpmaster.internal/ubuntu resolute/main armhf libsharpyuv0 armhf 1.5.0-0.1build1 [16.3 kB] 1033s Get:88 http://ftpmaster.internal/ubuntu resolute/main armhf libsm6 armhf 2:1.2.6-1build1 [15.3 kB] 1033s Get:89 http://ftpmaster.internal/ubuntu resolute/main armhf libtcl8.6 armhf 8.6.17+dfsg-1build1 [918 kB] 1036s Get:90 http://ftpmaster.internal/ubuntu resolute/main armhf libjbig0 armhf 2.1-6.1ubuntu3 [25.3 kB] 1036s Get:91 http://ftpmaster.internal/ubuntu resolute/main armhf libwebp7 armhf 1.5.0-0.1build1 [189 kB] 1036s Get:92 http://ftpmaster.internal/ubuntu resolute/main armhf libtiff6 armhf 4.7.0-3ubuntu3 [188 kB] 1037s Get:93 http://ftpmaster.internal/ubuntu resolute/main armhf libxft2 armhf 2.3.6-1build2 [37.2 kB] 1037s Get:94 http://ftpmaster.internal/ubuntu resolute/main armhf libxss1 armhf 1:1.2.3-1build4 [6328 B] 1037s Get:95 http://ftpmaster.internal/ubuntu resolute/main armhf libtk8.6 armhf 8.6.17-1 [694 kB] 1039s Get:96 http://ftpmaster.internal/ubuntu resolute/main armhf libxt6t64 armhf 1:1.2.1-1.3 [145 kB] 1039s Get:97 http://ftpmaster.internal/ubuntu resolute/main armhf libzstd-dev armhf 1.5.7+dfsg-3 [342 kB] 1040s Get:98 http://ftpmaster.internal/ubuntu resolute/universe armhf node-normalize.css all 8.0.1-5.1 [10.4 kB] 1040s Get:99 http://ftpmaster.internal/ubuntu resolute/main armhf zip armhf 3.0-15ubuntu3 [164 kB] 1041s Get:100 http://ftpmaster.internal/ubuntu resolute/main armhf unzip armhf 6.0-29ubuntu1 [167 kB] 1041s Get:101 http://ftpmaster.internal/ubuntu resolute/main armhf xdg-utils all 1.2.1-2ubuntu2 [66.1 kB] 1043s Get:102 http://ftpmaster.internal/ubuntu resolute/universe armhf r-base-core armhf 4.5.2-1ubuntu2 [28.5 MB] 1108s Get:103 http://ftpmaster.internal/ubuntu resolute/main armhf liblzma-dev armhf 5.8.2-2 [167 kB] 1108s Get:104 http://ftpmaster.internal/ubuntu resolute/main armhf pkgconf-bin armhf 1.8.1-4build1 [21.4 kB] 1108s Get:105 http://ftpmaster.internal/ubuntu resolute/main armhf pkgconf armhf 1.8.1-4build1 [16.8 kB] 1108s Get:106 http://ftpmaster.internal/ubuntu resolute/main armhf libtirpc-dev armhf 1.3.6+ds-1 [184 kB] 1108s Get:107 http://ftpmaster.internal/ubuntu resolute/universe armhf r-base-dev all 4.5.2-1ubuntu2 [1880 B] 1108s Get:108 http://ftpmaster.internal/ubuntu resolute/universe armhf pkg-r-autopkgtest all 20250812 [6158 B] 1108s Get:109 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-base64enc armhf 0.1-3-3build1 [28.2 kB] 1108s Get:110 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-cli armhf 3.6.4-1 [1377 kB] 1111s Get:111 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-commonmark armhf 1.9.5-1 [112 kB] 1111s Get:112 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-evaluate all 1.0.5-1 [117 kB] 1112s Get:113 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-farver armhf 2.1.2-1 [1355 kB] 1114s Get:114 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-glue armhf 1.8.0-1 [162 kB] 1115s Get:115 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-rlang armhf 1.1.5-3 [1700 kB] 1118s Get:116 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-lifecycle all 1.0.5+dfsg-1 [120 kB] 1118s Get:117 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-gtable all 0.3.6+dfsg-1 [199 kB] 1118s Get:118 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-isoband armhf 0.2.7-1 [1477 kB] 1121s Get:119 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-s7 armhf 0.2.0-1 [328 kB] 1122s Get:120 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-labeling all 0.4.3-1 [62.1 kB] 1122s Get:121 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-r6 all 2.6.1-1 [101 kB] 1122s Get:122 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-rcolorbrewer all 1.1-3-1build2 [54.0 kB] 1123s Get:123 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-viridislite all 0.4.3-1 [1088 kB] 1125s Get:124 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-scales all 1.4.0-1 [725 kB] 1127s Get:125 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-vctrs armhf 0.6.5-1 [1310 kB] 1131s Get:126 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-withr all 3.0.2+dfsg-1 [214 kB] 1132s Get:127 http://ftpmaster.internal/ubuntu resolute-proposed/universe armhf r-cran-ggplot2 all 4.0.2+dfsg-1 [4941 kB] 1157s Get:128 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-xfun armhf 0.55+dfsg-1 [589 kB] 1160s Get:129 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-highr all 0.11+dfsg-1 [38.5 kB] 1160s Get:130 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-yaml armhf 2.3.10-1 [101 kB] 1160s Get:131 http://ftpmaster.internal/ubuntu resolute/main armhf libjs-mathjax all 2.7.9+dfsg-1build1 [6017 kB] 1172s Get:132 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-knitr all 1.51+dfsg-1 [847 kB] 1174s Get:133 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-markdown all 1.13-1 [162 kB] 1174s Get:134 http://ftpmaster.internal/ubuntu resolute/universe armhf r-cran-matrixstats armhf 1.5.0-1 [495 kB] 1176s Preconfiguring packages ... 1176s Fetched 148 MB in 7min 13s (342 kB/s) 1176s Selecting previously unselected package libc-dev-bin. 1176s (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 ... 68686 files and directories currently installed.) 1176s Preparing to unpack .../000-libc-dev-bin_2.42-2ubuntu4_armhf.deb ... 1176s Unpacking libc-dev-bin (2.42-2ubuntu4) ... 1176s Selecting previously unselected package linux-libc-dev:armhf. 1176s Preparing to unpack .../001-linux-libc-dev_6.19.0-3.3_armhf.deb ... 1176s Unpacking linux-libc-dev:armhf (6.19.0-3.3) ... 1176s Selecting previously unselected package libcrypt-dev:armhf. 1176s Preparing to unpack .../002-libcrypt-dev_1%3a4.5.1-1_armhf.deb ... 1176s Unpacking libcrypt-dev:armhf (1:4.5.1-1) ... 1176s Selecting previously unselected package rpcsvc-proto. 1176s Preparing to unpack .../003-rpcsvc-proto_1.4.3-1build1_armhf.deb ... 1176s Unpacking rpcsvc-proto (1.4.3-1build1) ... 1176s Selecting previously unselected package libc6-dev:armhf. 1176s Preparing to unpack .../004-libc6-dev_2.42-2ubuntu4_armhf.deb ... 1176s Unpacking libc6-dev:armhf (2.42-2ubuntu4) ... 1176s Selecting previously unselected package libisl23:armhf. 1176s Preparing to unpack .../005-libisl23_0.27-1build1_armhf.deb ... 1176s Unpacking libisl23:armhf (0.27-1build1) ... 1176s Selecting previously unselected package libmpc3:armhf. 1176s Preparing to unpack .../006-libmpc3_1.3.1-2_armhf.deb ... 1176s Unpacking libmpc3:armhf (1.3.1-2) ... 1176s Selecting previously unselected package cpp-15-arm-linux-gnueabihf. 1176s Preparing to unpack .../007-cpp-15-arm-linux-gnueabihf_15.2.0-12ubuntu1_armhf.deb ... 1176s Unpacking cpp-15-arm-linux-gnueabihf (15.2.0-12ubuntu1) ... 1176s Selecting previously unselected package cpp-15. 1176s Preparing to unpack .../008-cpp-15_15.2.0-12ubuntu1_armhf.deb ... 1176s Unpacking cpp-15 (15.2.0-12ubuntu1) ... 1176s Selecting previously unselected package cpp-arm-linux-gnueabihf. 1177s Preparing to unpack .../009-cpp-arm-linux-gnueabihf_4%3a15.2.0-4ubuntu1_armhf.deb ... 1177s Unpacking cpp-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 1177s Selecting previously unselected package cpp. 1177s Preparing to unpack .../010-cpp_4%3a15.2.0-4ubuntu1_armhf.deb ... 1177s Unpacking cpp (4:15.2.0-4ubuntu1) ... 1177s Selecting previously unselected package libcc1-0:armhf. 1177s Preparing to unpack .../011-libcc1-0_15.2.0-12ubuntu1_armhf.deb ... 1177s Unpacking libcc1-0:armhf (15.2.0-12ubuntu1) ... 1177s Selecting previously unselected package libgomp1:armhf. 1177s Preparing to unpack .../012-libgomp1_15.2.0-12ubuntu1_armhf.deb ... 1177s Unpacking libgomp1:armhf (15.2.0-12ubuntu1) ... 1177s Selecting previously unselected package libasan8:armhf. 1177s Preparing to unpack .../013-libasan8_15.2.0-12ubuntu1_armhf.deb ... 1177s Unpacking libasan8:armhf (15.2.0-12ubuntu1) ... 1177s Selecting previously unselected package libubsan1:armhf. 1177s Preparing to unpack .../014-libubsan1_15.2.0-12ubuntu1_armhf.deb ... 1177s Unpacking libubsan1:armhf (15.2.0-12ubuntu1) ... 1177s Selecting previously unselected package libgcc-15-dev:armhf. 1177s Preparing to unpack .../015-libgcc-15-dev_15.2.0-12ubuntu1_armhf.deb ... 1177s Unpacking libgcc-15-dev:armhf (15.2.0-12ubuntu1) ... 1177s Selecting previously unselected package gcc-15-arm-linux-gnueabihf. 1177s Preparing to unpack .../016-gcc-15-arm-linux-gnueabihf_15.2.0-12ubuntu1_armhf.deb ... 1177s Unpacking gcc-15-arm-linux-gnueabihf (15.2.0-12ubuntu1) ... 1178s Selecting previously unselected package gcc-15. 1178s Preparing to unpack .../017-gcc-15_15.2.0-12ubuntu1_armhf.deb ... 1178s Unpacking gcc-15 (15.2.0-12ubuntu1) ... 1178s Selecting previously unselected package gcc-arm-linux-gnueabihf. 1178s Preparing to unpack .../018-gcc-arm-linux-gnueabihf_4%3a15.2.0-4ubuntu1_armhf.deb ... 1178s Unpacking gcc-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 1178s Selecting previously unselected package gcc. 1178s Preparing to unpack .../019-gcc_4%3a15.2.0-4ubuntu1_armhf.deb ... 1178s Unpacking gcc (4:15.2.0-4ubuntu1) ... 1178s Selecting previously unselected package libstdc++-15-dev:armhf. 1178s Preparing to unpack .../020-libstdc++-15-dev_15.2.0-12ubuntu1_armhf.deb ... 1178s Unpacking libstdc++-15-dev:armhf (15.2.0-12ubuntu1) ... 1178s Selecting previously unselected package g++-15-arm-linux-gnueabihf. 1178s Preparing to unpack .../021-g++-15-arm-linux-gnueabihf_15.2.0-12ubuntu1_armhf.deb ... 1178s Unpacking g++-15-arm-linux-gnueabihf (15.2.0-12ubuntu1) ... 1178s Selecting previously unselected package g++-15. 1178s Preparing to unpack .../022-g++-15_15.2.0-12ubuntu1_armhf.deb ... 1178s Unpacking g++-15 (15.2.0-12ubuntu1) ... 1178s Selecting previously unselected package g++-arm-linux-gnueabihf. 1178s Preparing to unpack .../023-g++-arm-linux-gnueabihf_4%3a15.2.0-4ubuntu1_armhf.deb ... 1178s Unpacking g++-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 1178s Selecting previously unselected package g++. 1178s Preparing to unpack .../024-g++_4%3a15.2.0-4ubuntu1_armhf.deb ... 1178s Unpacking g++ (4:15.2.0-4ubuntu1) ... 1178s Selecting previously unselected package build-essential. 1178s Preparing to unpack .../025-build-essential_12.12ubuntu2_armhf.deb ... 1178s Unpacking build-essential (12.12ubuntu2) ... 1178s Selecting previously unselected package dctrl-tools. 1178s Preparing to unpack .../026-dctrl-tools_2.24-3build4_armhf.deb ... 1178s Unpacking dctrl-tools (2.24-3build4) ... 1178s Selecting previously unselected package libfreetype6:armhf. 1178s Preparing to unpack .../027-libfreetype6_2.14.1+dfsg-2_armhf.deb ... 1178s Unpacking libfreetype6:armhf (2.14.1+dfsg-2) ... 1178s Selecting previously unselected package fonts-dejavu-mono. 1178s Preparing to unpack .../028-fonts-dejavu-mono_2.37-8build1_all.deb ... 1178s Unpacking fonts-dejavu-mono (2.37-8build1) ... 1178s Selecting previously unselected package fonts-dejavu-core. 1178s Preparing to unpack .../029-fonts-dejavu-core_2.37-8build1_all.deb ... 1178s Unpacking fonts-dejavu-core (2.37-8build1) ... 1178s Selecting previously unselected package fontconfig-config. 1178s Preparing to unpack .../030-fontconfig-config_2.17.1-3ubuntu1_armhf.deb ... 1178s Unpacking fontconfig-config (2.17.1-3ubuntu1) ... 1179s Selecting previously unselected package libfontconfig1:armhf. 1179s Preparing to unpack .../031-libfontconfig1_2.17.1-3ubuntu1_armhf.deb ... 1179s Unpacking libfontconfig1:armhf (2.17.1-3ubuntu1) ... 1179s Selecting previously unselected package fontconfig. 1179s Preparing to unpack .../032-fontconfig_2.17.1-3ubuntu1_armhf.deb ... 1179s Unpacking fontconfig (2.17.1-3ubuntu1) ... 1179s Selecting previously unselected package fonts-glyphicons-halflings. 1179s Preparing to unpack .../033-fonts-glyphicons-halflings_1.009~3.4.1+dfsg-6_all.deb ... 1179s Unpacking fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 1179s Selecting previously unselected package fonts-mathjax. 1179s Preparing to unpack .../034-fonts-mathjax_2.7.9+dfsg-1build1_all.deb ... 1179s Unpacking fonts-mathjax (2.7.9+dfsg-1build1) ... 1179s Selecting previously unselected package libgfortran5:armhf. 1179s Preparing to unpack .../035-libgfortran5_15.2.0-12ubuntu1_armhf.deb ... 1179s Unpacking libgfortran5:armhf (15.2.0-12ubuntu1) ... 1179s Selecting previously unselected package libgfortran-15-dev:armhf. 1179s Preparing to unpack .../036-libgfortran-15-dev_15.2.0-12ubuntu1_armhf.deb ... 1179s Unpacking libgfortran-15-dev:armhf (15.2.0-12ubuntu1) ... 1179s Selecting previously unselected package gfortran-15-arm-linux-gnueabihf. 1179s Preparing to unpack .../037-gfortran-15-arm-linux-gnueabihf_15.2.0-12ubuntu1_armhf.deb ... 1179s Unpacking gfortran-15-arm-linux-gnueabihf (15.2.0-12ubuntu1) ... 1179s Selecting previously unselected package gfortran-15. 1179s Preparing to unpack .../038-gfortran-15_15.2.0-12ubuntu1_armhf.deb ... 1179s Unpacking gfortran-15 (15.2.0-12ubuntu1) ... 1179s Selecting previously unselected package gfortran-arm-linux-gnueabihf. 1179s Preparing to unpack .../039-gfortran-arm-linux-gnueabihf_4%3a15.2.0-4ubuntu1_armhf.deb ... 1179s Unpacking gfortran-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 1179s Selecting previously unselected package gfortran. 1179s Preparing to unpack .../040-gfortran_4%3a15.2.0-4ubuntu1_armhf.deb ... 1179s Unpacking gfortran (4:15.2.0-4ubuntu1) ... 1179s Selecting previously unselected package icu-devtools. 1179s Preparing to unpack .../041-icu-devtools_78.2-1ubuntu1_armhf.deb ... 1179s Unpacking icu-devtools (78.2-1ubuntu1) ... 1179s Selecting previously unselected package libblas3:armhf. 1179s Preparing to unpack .../042-libblas3_3.12.1-7ubuntu1_armhf.deb ... 1179s Unpacking libblas3:armhf (3.12.1-7ubuntu1) ... 1179s Selecting previously unselected package libblas-dev:armhf. 1179s Preparing to unpack .../043-libblas-dev_3.12.1-7ubuntu1_armhf.deb ... 1179s Unpacking libblas-dev:armhf (3.12.1-7ubuntu1) ... 1179s Selecting previously unselected package libbz2-dev:armhf. 1179s Preparing to unpack .../044-libbz2-dev_1.0.8-6build2_armhf.deb ... 1179s Unpacking libbz2-dev:armhf (1.0.8-6build2) ... 1179s Selecting previously unselected package libpixman-1-0:armhf. 1179s Preparing to unpack .../045-libpixman-1-0_0.46.4-1_armhf.deb ... 1179s Unpacking libpixman-1-0:armhf (0.46.4-1) ... 1179s Selecting previously unselected package libxcb-render0:armhf. 1179s Preparing to unpack .../046-libxcb-render0_1.17.0-2ubuntu1_armhf.deb ... 1179s Unpacking libxcb-render0:armhf (1.17.0-2ubuntu1) ... 1179s Selecting previously unselected package libxcb-shm0:armhf. 1179s Preparing to unpack .../047-libxcb-shm0_1.17.0-2ubuntu1_armhf.deb ... 1179s Unpacking libxcb-shm0:armhf (1.17.0-2ubuntu1) ... 1179s Selecting previously unselected package libxrender1:armhf. 1179s Preparing to unpack .../048-libxrender1_1%3a0.9.12-1_armhf.deb ... 1179s Unpacking libxrender1:armhf (1:0.9.12-1) ... 1179s Selecting previously unselected package libcairo2:armhf. 1179s Preparing to unpack .../049-libcairo2_1.18.4-3_armhf.deb ... 1180s Unpacking libcairo2:armhf (1.18.4-3) ... 1180s Selecting previously unselected package libdatrie1:armhf. 1180s Preparing to unpack .../050-libdatrie1_0.2.14-1_armhf.deb ... 1180s Unpacking libdatrie1:armhf (0.2.14-1) ... 1180s Selecting previously unselected package libdeflate0:armhf. 1180s Preparing to unpack .../051-libdeflate0_1.23-2build1_armhf.deb ... 1180s Unpacking libdeflate0:armhf (1.23-2build1) ... 1180s Selecting previously unselected package libdeflate-dev:armhf. 1180s Preparing to unpack .../052-libdeflate-dev_1.23-2build1_armhf.deb ... 1180s Unpacking libdeflate-dev:armhf (1.23-2build1) ... 1180s Selecting previously unselected package libgraphite2-3:armhf. 1180s Preparing to unpack .../053-libgraphite2-3_1.3.14-11ubuntu1_armhf.deb ... 1180s Unpacking libgraphite2-3:armhf (1.3.14-11ubuntu1) ... 1180s Selecting previously unselected package libharfbuzz0b:armhf. 1180s Preparing to unpack .../054-libharfbuzz0b_12.3.2-1_armhf.deb ... 1180s Unpacking libharfbuzz0b:armhf (12.3.2-1) ... 1180s Selecting previously unselected package x11-common. 1180s Preparing to unpack .../055-x11-common_1%3a7.7+24ubuntu1_all.deb ... 1180s Unpacking x11-common (1:7.7+24ubuntu1) ... 1180s Selecting previously unselected package libice6:armhf. 1180s Preparing to unpack .../056-libice6_2%3a1.1.1-1build1_armhf.deb ... 1180s Unpacking libice6:armhf (2:1.1.1-1build1) ... 1180s Selecting previously unselected package libicu-dev:armhf. 1180s Preparing to unpack .../057-libicu-dev_78.2-1ubuntu1_armhf.deb ... 1180s Unpacking libicu-dev:armhf (78.2-1ubuntu1) ... 1180s Selecting previously unselected package libjpeg-turbo8:armhf. 1180s Preparing to unpack .../058-libjpeg-turbo8_2.1.5-4ubuntu3_armhf.deb ... 1180s Unpacking libjpeg-turbo8:armhf (2.1.5-4ubuntu3) ... 1180s Selecting previously unselected package libjpeg-turbo8-dev:armhf. 1180s Preparing to unpack .../059-libjpeg-turbo8-dev_2.1.5-4ubuntu3_armhf.deb ... 1180s Unpacking libjpeg-turbo8-dev:armhf (2.1.5-4ubuntu3) ... 1180s Selecting previously unselected package libjpeg8:armhf. 1180s Preparing to unpack .../060-libjpeg8_8c-2ubuntu11_armhf.deb ... 1180s Unpacking libjpeg8:armhf (8c-2ubuntu11) ... 1180s Selecting previously unselected package libjpeg8-dev:armhf. 1180s Preparing to unpack .../061-libjpeg8-dev_8c-2ubuntu11_armhf.deb ... 1180s Unpacking libjpeg8-dev:armhf (8c-2ubuntu11) ... 1180s Selecting previously unselected package libjpeg-dev:armhf. 1180s Preparing to unpack .../062-libjpeg-dev_8c-2ubuntu11_armhf.deb ... 1180s Unpacking libjpeg-dev:armhf (8c-2ubuntu11) ... 1180s Selecting previously unselected package libjs-bootstrap. 1180s Preparing to unpack .../063-libjs-bootstrap_3.4.1+dfsg-6_all.deb ... 1180s Unpacking libjs-bootstrap (3.4.1+dfsg-6) ... 1180s Selecting previously unselected package libjs-highlight.js. 1180s Preparing to unpack .../064-libjs-highlight.js_10.7.3+dfsg-2_all.deb ... 1180s Unpacking libjs-highlight.js (10.7.3+dfsg-2) ... 1180s Selecting previously unselected package libjs-jquery. 1180s Preparing to unpack .../065-libjs-jquery_3.7.1+dfsg+~3.5.33-1build1_all.deb ... 1180s Unpacking libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 1180s Selecting previously unselected package libjs-jquery-datatables. 1180s Preparing to unpack .../066-libjs-jquery-datatables_1.11.5+dfsg-2build1_all.deb ... 1180s Unpacking libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 1180s Selecting previously unselected package liblapack3:armhf. 1180s Preparing to unpack .../067-liblapack3_3.12.1-7ubuntu1_armhf.deb ... 1180s Unpacking liblapack3:armhf (3.12.1-7ubuntu1) ... 1180s Selecting previously unselected package liblapack-dev:armhf. 1181s Preparing to unpack .../068-liblapack-dev_3.12.1-7ubuntu1_armhf.deb ... 1181s Unpacking liblapack-dev:armhf (3.12.1-7ubuntu1) ... 1181s Selecting previously unselected package liblerc4:armhf. 1181s Preparing to unpack .../069-liblerc4_4.0.0+ds-5ubuntu2_armhf.deb ... 1181s Unpacking liblerc4:armhf (4.0.0+ds-5ubuntu2) ... 1181s Selecting previously unselected package libncurses-dev:armhf. 1181s Preparing to unpack .../070-libncurses-dev_6.6+20251231-1_armhf.deb ... 1181s Unpacking libncurses-dev:armhf (6.6+20251231-1) ... 1181s Selecting previously unselected package libthai-data. 1181s Preparing to unpack .../071-libthai-data_0.1.30-1_all.deb ... 1181s Unpacking libthai-data (0.1.30-1) ... 1181s Selecting previously unselected package libthai0:armhf. 1181s Preparing to unpack .../072-libthai0_0.1.30-1_armhf.deb ... 1181s Unpacking libthai0:armhf (0.1.30-1) ... 1181s Selecting previously unselected package libpango-1.0-0:armhf. 1181s Preparing to unpack .../073-libpango-1.0-0_1.57.0-1_armhf.deb ... 1181s Unpacking libpango-1.0-0:armhf (1.57.0-1) ... 1181s Selecting previously unselected package libpangoft2-1.0-0:armhf. 1181s Preparing to unpack .../074-libpangoft2-1.0-0_1.57.0-1_armhf.deb ... 1181s Unpacking libpangoft2-1.0-0:armhf (1.57.0-1) ... 1181s Selecting previously unselected package libpangocairo-1.0-0:armhf. 1181s Preparing to unpack .../075-libpangocairo-1.0-0_1.57.0-1_armhf.deb ... 1181s Unpacking libpangocairo-1.0-0:armhf (1.57.0-1) ... 1181s Selecting previously unselected package libpaper2:armhf. 1181s Preparing to unpack .../076-libpaper2_2.2.5-0.3build1_armhf.deb ... 1181s Unpacking libpaper2:armhf (2.2.5-0.3build1) ... 1181s Selecting previously unselected package libpaper-utils. 1181s Preparing to unpack .../077-libpaper-utils_2.2.5-0.3build1_armhf.deb ... 1181s Unpacking libpaper-utils (2.2.5-0.3build1) ... 1181s Selecting previously unselected package libpcre2-16-0:armhf. 1181s Preparing to unpack .../078-libpcre2-16-0_10.46-1_armhf.deb ... 1181s Unpacking libpcre2-16-0:armhf (10.46-1) ... 1181s Selecting previously unselected package libpcre2-32-0:armhf. 1181s Preparing to unpack .../079-libpcre2-32-0_10.46-1_armhf.deb ... 1181s Unpacking libpcre2-32-0:armhf (10.46-1) ... 1181s Selecting previously unselected package libpcre2-posix3:armhf. 1181s Preparing to unpack .../080-libpcre2-posix3_10.46-1_armhf.deb ... 1181s Unpacking libpcre2-posix3:armhf (10.46-1) ... 1181s Selecting previously unselected package libpcre2-dev:armhf. 1181s Preparing to unpack .../081-libpcre2-dev_10.46-1_armhf.deb ... 1181s Unpacking libpcre2-dev:armhf (10.46-1) ... 1181s Selecting previously unselected package libpkgconf3:armhf. 1181s Preparing to unpack .../082-libpkgconf3_1.8.1-4build1_armhf.deb ... 1181s Unpacking libpkgconf3:armhf (1.8.1-4build1) ... 1181s Selecting previously unselected package zlib1g-dev:armhf. 1181s Preparing to unpack .../083-zlib1g-dev_1%3a1.3.dfsg+really1.3.1-1ubuntu2_armhf.deb ... 1181s Unpacking zlib1g-dev:armhf (1:1.3.dfsg+really1.3.1-1ubuntu2) ... 1181s Selecting previously unselected package libpng-dev:armhf. 1181s Preparing to unpack .../084-libpng-dev_1.6.54-1_armhf.deb ... 1181s Unpacking libpng-dev:armhf (1.6.54-1) ... 1181s Selecting previously unselected package libreadline-dev:armhf. 1181s Preparing to unpack .../085-libreadline-dev_8.3-3_armhf.deb ... 1181s Unpacking libreadline-dev:armhf (8.3-3) ... 1181s Selecting previously unselected package libsharpyuv0:armhf. 1181s Preparing to unpack .../086-libsharpyuv0_1.5.0-0.1build1_armhf.deb ... 1181s Unpacking libsharpyuv0:armhf (1.5.0-0.1build1) ... 1181s Selecting previously unselected package libsm6:armhf. 1181s Preparing to unpack .../087-libsm6_2%3a1.2.6-1build1_armhf.deb ... 1181s Unpacking libsm6:armhf (2:1.2.6-1build1) ... 1181s Selecting previously unselected package libtcl8.6:armhf. 1181s Preparing to unpack .../088-libtcl8.6_8.6.17+dfsg-1build1_armhf.deb ... 1181s Unpacking libtcl8.6:armhf (8.6.17+dfsg-1build1) ... 1181s Selecting previously unselected package libjbig0:armhf. 1181s Preparing to unpack .../089-libjbig0_2.1-6.1ubuntu3_armhf.deb ... 1181s Unpacking libjbig0:armhf (2.1-6.1ubuntu3) ... 1181s Selecting previously unselected package libwebp7:armhf. 1181s Preparing to unpack .../090-libwebp7_1.5.0-0.1build1_armhf.deb ... 1181s Unpacking libwebp7:armhf (1.5.0-0.1build1) ... 1181s Selecting previously unselected package libtiff6:armhf. 1181s Preparing to unpack .../091-libtiff6_4.7.0-3ubuntu3_armhf.deb ... 1181s Unpacking libtiff6:armhf (4.7.0-3ubuntu3) ... 1181s Selecting previously unselected package libxft2:armhf. 1181s Preparing to unpack .../092-libxft2_2.3.6-1build2_armhf.deb ... 1181s Unpacking libxft2:armhf (2.3.6-1build2) ... 1182s Selecting previously unselected package libxss1:armhf. 1182s Preparing to unpack .../093-libxss1_1%3a1.2.3-1build4_armhf.deb ... 1182s Unpacking libxss1:armhf (1:1.2.3-1build4) ... 1182s Selecting previously unselected package libtk8.6:armhf. 1182s Preparing to unpack .../094-libtk8.6_8.6.17-1_armhf.deb ... 1182s Unpacking libtk8.6:armhf (8.6.17-1) ... 1182s Selecting previously unselected package libxt6t64:armhf. 1182s Preparing to unpack .../095-libxt6t64_1%3a1.2.1-1.3_armhf.deb ... 1182s Unpacking libxt6t64:armhf (1:1.2.1-1.3) ... 1182s Selecting previously unselected package libzstd-dev:armhf. 1182s Preparing to unpack .../096-libzstd-dev_1.5.7+dfsg-3_armhf.deb ... 1182s Unpacking libzstd-dev:armhf (1.5.7+dfsg-3) ... 1182s Selecting previously unselected package node-normalize.css. 1182s Preparing to unpack .../097-node-normalize.css_8.0.1-5.1_all.deb ... 1182s Unpacking node-normalize.css (8.0.1-5.1) ... 1182s Selecting previously unselected package zip. 1182s Preparing to unpack .../098-zip_3.0-15ubuntu3_armhf.deb ... 1182s Unpacking zip (3.0-15ubuntu3) ... 1182s Selecting previously unselected package unzip. 1182s Preparing to unpack .../099-unzip_6.0-29ubuntu1_armhf.deb ... 1182s Unpacking unzip (6.0-29ubuntu1) ... 1182s Selecting previously unselected package xdg-utils. 1182s Preparing to unpack .../100-xdg-utils_1.2.1-2ubuntu2_all.deb ... 1182s Unpacking xdg-utils (1.2.1-2ubuntu2) ... 1182s Selecting previously unselected package r-base-core. 1182s Preparing to unpack .../101-r-base-core_4.5.2-1ubuntu2_armhf.deb ... 1182s Unpacking r-base-core (4.5.2-1ubuntu2) ... 1182s Selecting previously unselected package liblzma-dev:armhf. 1182s Preparing to unpack .../102-liblzma-dev_5.8.2-2_armhf.deb ... 1182s Unpacking liblzma-dev:armhf (5.8.2-2) ... 1182s Selecting previously unselected package pkgconf-bin. 1182s Preparing to unpack .../103-pkgconf-bin_1.8.1-4build1_armhf.deb ... 1182s Unpacking pkgconf-bin (1.8.1-4build1) ... 1182s Selecting previously unselected package pkgconf:armhf. 1183s Preparing to unpack .../104-pkgconf_1.8.1-4build1_armhf.deb ... 1183s Unpacking pkgconf:armhf (1.8.1-4build1) ... 1183s Selecting previously unselected package libtirpc-dev:armhf. 1183s Preparing to unpack .../105-libtirpc-dev_1.3.6+ds-1_armhf.deb ... 1183s Unpacking libtirpc-dev:armhf (1.3.6+ds-1) ... 1183s Selecting previously unselected package r-base-dev. 1183s Preparing to unpack .../106-r-base-dev_4.5.2-1ubuntu2_all.deb ... 1183s Unpacking r-base-dev (4.5.2-1ubuntu2) ... 1183s Selecting previously unselected package pkg-r-autopkgtest. 1183s Preparing to unpack .../107-pkg-r-autopkgtest_20250812_all.deb ... 1183s Unpacking pkg-r-autopkgtest (20250812) ... 1183s Selecting previously unselected package r-cran-base64enc. 1183s Preparing to unpack .../108-r-cran-base64enc_0.1-3-3build1_armhf.deb ... 1183s Unpacking r-cran-base64enc (0.1-3-3build1) ... 1183s Selecting previously unselected package r-cran-cli. 1183s Preparing to unpack .../109-r-cran-cli_3.6.4-1_armhf.deb ... 1183s Unpacking r-cran-cli (3.6.4-1) ... 1183s Selecting previously unselected package r-cran-commonmark. 1183s Preparing to unpack .../110-r-cran-commonmark_1.9.5-1_armhf.deb ... 1183s Unpacking r-cran-commonmark (1.9.5-1) ... 1183s Selecting previously unselected package r-cran-evaluate. 1183s Preparing to unpack .../111-r-cran-evaluate_1.0.5-1_all.deb ... 1183s Unpacking r-cran-evaluate (1.0.5-1) ... 1183s Selecting previously unselected package r-cran-farver. 1183s Preparing to unpack .../112-r-cran-farver_2.1.2-1_armhf.deb ... 1183s Unpacking r-cran-farver (2.1.2-1) ... 1183s Selecting previously unselected package r-cran-glue. 1183s Preparing to unpack .../113-r-cran-glue_1.8.0-1_armhf.deb ... 1183s Unpacking r-cran-glue (1.8.0-1) ... 1183s Selecting previously unselected package r-cran-rlang. 1183s Preparing to unpack .../114-r-cran-rlang_1.1.5-3_armhf.deb ... 1183s Unpacking r-cran-rlang (1.1.5-3) ... 1183s Selecting previously unselected package r-cran-lifecycle. 1183s Preparing to unpack .../115-r-cran-lifecycle_1.0.5+dfsg-1_all.deb ... 1183s Unpacking r-cran-lifecycle (1.0.5+dfsg-1) ... 1183s Selecting previously unselected package r-cran-gtable. 1183s Preparing to unpack .../116-r-cran-gtable_0.3.6+dfsg-1_all.deb ... 1183s Unpacking r-cran-gtable (0.3.6+dfsg-1) ... 1183s Selecting previously unselected package r-cran-isoband. 1183s Preparing to unpack .../117-r-cran-isoband_0.2.7-1_armhf.deb ... 1183s Unpacking r-cran-isoband (0.2.7-1) ... 1183s Selecting previously unselected package r-cran-s7. 1183s Preparing to unpack .../118-r-cran-s7_0.2.0-1_armhf.deb ... 1183s Unpacking r-cran-s7 (0.2.0-1) ... 1183s Selecting previously unselected package r-cran-labeling. 1183s Preparing to unpack .../119-r-cran-labeling_0.4.3-1_all.deb ... 1183s Unpacking r-cran-labeling (0.4.3-1) ... 1183s Selecting previously unselected package r-cran-r6. 1183s Preparing to unpack .../120-r-cran-r6_2.6.1-1_all.deb ... 1183s Unpacking r-cran-r6 (2.6.1-1) ... 1183s Selecting previously unselected package r-cran-rcolorbrewer. 1183s Preparing to unpack .../121-r-cran-rcolorbrewer_1.1-3-1build2_all.deb ... 1183s Unpacking r-cran-rcolorbrewer (1.1-3-1build2) ... 1183s Selecting previously unselected package r-cran-viridislite. 1183s Preparing to unpack .../122-r-cran-viridislite_0.4.3-1_all.deb ... 1183s Unpacking r-cran-viridislite (0.4.3-1) ... 1183s Selecting previously unselected package r-cran-scales. 1183s Preparing to unpack .../123-r-cran-scales_1.4.0-1_all.deb ... 1183s Unpacking r-cran-scales (1.4.0-1) ... 1183s Selecting previously unselected package r-cran-vctrs. 1183s Preparing to unpack .../124-r-cran-vctrs_0.6.5-1_armhf.deb ... 1183s Unpacking r-cran-vctrs (0.6.5-1) ... 1183s Selecting previously unselected package r-cran-withr. 1183s Preparing to unpack .../125-r-cran-withr_3.0.2+dfsg-1_all.deb ... 1183s Unpacking r-cran-withr (3.0.2+dfsg-1) ... 1183s Selecting previously unselected package r-cran-ggplot2. 1183s Preparing to unpack .../126-r-cran-ggplot2_4.0.2+dfsg-1_all.deb ... 1183s Unpacking r-cran-ggplot2 (4.0.2+dfsg-1) ... 1183s Selecting previously unselected package r-cran-xfun. 1183s Preparing to unpack .../127-r-cran-xfun_0.55+dfsg-1_armhf.deb ... 1183s Unpacking r-cran-xfun (0.55+dfsg-1) ... 1183s Selecting previously unselected package r-cran-highr. 1183s Preparing to unpack .../128-r-cran-highr_0.11+dfsg-1_all.deb ... 1183s Unpacking r-cran-highr (0.11+dfsg-1) ... 1183s Selecting previously unselected package r-cran-yaml. 1183s Preparing to unpack .../129-r-cran-yaml_2.3.10-1_armhf.deb ... 1183s Unpacking r-cran-yaml (2.3.10-1) ... 1183s Selecting previously unselected package libjs-mathjax. 1183s Preparing to unpack .../130-libjs-mathjax_2.7.9+dfsg-1build1_all.deb ... 1183s Unpacking libjs-mathjax (2.7.9+dfsg-1build1) ... 1184s Selecting previously unselected package r-cran-knitr. 1184s Preparing to unpack .../131-r-cran-knitr_1.51+dfsg-1_all.deb ... 1184s Unpacking r-cran-knitr (1.51+dfsg-1) ... 1184s Selecting previously unselected package r-cran-markdown. 1184s Preparing to unpack .../132-r-cran-markdown_1.13-1_all.deb ... 1184s Unpacking r-cran-markdown (1.13-1) ... 1184s Selecting previously unselected package r-cran-matrixstats. 1184s Preparing to unpack .../133-r-cran-matrixstats_1.5.0-1_armhf.deb ... 1184s Unpacking r-cran-matrixstats (1.5.0-1) ... 1184s Setting up libgraphite2-3:armhf (1.3.14-11ubuntu1) ... 1184s Setting up libpixman-1-0:armhf (0.46.4-1) ... 1184s Setting up libsharpyuv0:armhf (1.5.0-0.1build1) ... 1184s Setting up fonts-mathjax (2.7.9+dfsg-1build1) ... 1184s Setting up liblerc4:armhf (4.0.0+ds-5ubuntu2) ... 1184s Setting up libzstd-dev:armhf (1.5.7+dfsg-3) ... 1184s Setting up libjs-mathjax (2.7.9+dfsg-1build1) ... 1184s Setting up libxrender1:armhf (1:0.9.12-1) ... 1184s Setting up libdatrie1:armhf (0.2.14-1) ... 1184s Setting up libxcb-render0:armhf (1.17.0-2ubuntu1) ... 1184s Setting up fonts-glyphicons-halflings (1.009~3.4.1+dfsg-6) ... 1184s Setting up unzip (6.0-29ubuntu1) ... 1184s Setting up x11-common (1:7.7+24ubuntu1) ... 1185s Setting up libdeflate0:armhf (1.23-2build1) ... 1185s Setting up linux-libc-dev:armhf (6.19.0-3.3) ... 1185s Setting up libxcb-shm0:armhf (1.17.0-2ubuntu1) ... 1185s Setting up libgomp1:armhf (15.2.0-12ubuntu1) ... 1185s Setting up libjbig0:armhf (2.1-6.1ubuntu3) ... 1185s Setting up libpcre2-16-0:armhf (10.46-1) ... 1185s Setting up zip (3.0-15ubuntu3) ... 1185s Setting up libpcre2-32-0:armhf (10.46-1) ... 1185s Setting up libblas3:armhf (3.12.1-7ubuntu1) ... 1185s update-alternatives: using /usr/lib/arm-linux-gnueabihf/blas/libblas.so.3 to provide /usr/lib/arm-linux-gnueabihf/libblas.so.3 (libblas.so.3-arm-linux-gnueabihf) in auto mode 1185s Setting up libtirpc-dev:armhf (1.3.6+ds-1) ... 1185s Setting up libpkgconf3:armhf (1.8.1-4build1) ... 1185s Setting up rpcsvc-proto (1.4.3-1build1) ... 1185s Setting up libfreetype6:armhf (2.14.1+dfsg-2) ... 1185s Setting up fonts-dejavu-mono (2.37-8build1) ... 1185s Setting up libmpc3:armhf (1.3.1-2) ... 1185s Setting up libtcl8.6:armhf (8.6.17+dfsg-1build1) ... 1185s Setting up icu-devtools (78.2-1ubuntu1) ... 1185s Setting up fonts-dejavu-core (2.37-8build1) ... 1185s Setting up pkgconf-bin (1.8.1-4build1) ... 1185s Setting up libjpeg-turbo8:armhf (2.1.5-4ubuntu3) ... 1185s Setting up libgfortran5:armhf (15.2.0-12ubuntu1) ... 1185s Setting up libwebp7:armhf (1.5.0-0.1build1) ... 1185s Setting up liblzma-dev:armhf (5.8.2-2) ... 1185s Setting up libubsan1:armhf (15.2.0-12ubuntu1) ... 1185s Setting up libpcre2-posix3:armhf (10.46-1) ... 1185s Setting up libjs-highlight.js (10.7.3+dfsg-2) ... 1185s Setting up libcrypt-dev:armhf (1:4.5.1-1) ... 1185s Setting up libasan8:armhf (15.2.0-12ubuntu1) ... 1185s Setting up libharfbuzz0b:armhf (12.3.2-1) ... 1185s Setting up libthai-data (0.1.30-1) ... 1185s Setting up libxss1:armhf (1:1.2.3-1build4) ... 1185s Setting up libpaper2:armhf (2.2.5-0.3build1) ... 1185s Setting up libjs-jquery (3.7.1+dfsg+~3.5.33-1build1) ... 1185s Setting up libisl23:armhf (0.27-1build1) ... 1185s Setting up libc-dev-bin (2.42-2ubuntu4) ... 1185s Setting up libdeflate-dev:armhf (1.23-2build1) ... 1185s Setting up node-normalize.css (8.0.1-5.1) ... 1185s Setting up cpp-15-arm-linux-gnueabihf (15.2.0-12ubuntu1) ... 1185s Setting up xdg-utils (1.2.1-2ubuntu2) ... 1185s update-alternatives: using /usr/bin/xdg-open to provide /usr/bin/open (open) in auto mode 1185s Setting up libcc1-0:armhf (15.2.0-12ubuntu1) ... 1185s Setting up cpp-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 1185s Setting up libblas-dev:armhf (3.12.1-7ubuntu1) ... 1185s update-alternatives: using /usr/lib/arm-linux-gnueabihf/blas/libblas.so to provide /usr/lib/arm-linux-gnueabihf/libblas.so (libblas.so-arm-linux-gnueabihf) in auto mode 1185s Setting up dctrl-tools (2.24-3build4) ... 1185s Setting up libjs-bootstrap (3.4.1+dfsg-6) ... 1185s Setting up libjpeg8:armhf (8c-2ubuntu11) ... 1185s Setting up libice6:armhf (2:1.1.1-1build1) ... 1185s Setting up liblapack3:armhf (3.12.1-7ubuntu1) ... 1185s update-alternatives: using /usr/lib/arm-linux-gnueabihf/lapack/liblapack.so.3 to provide /usr/lib/arm-linux-gnueabihf/liblapack.so.3 (liblapack.so.3-arm-linux-gnueabihf) in auto mode 1185s Setting up libgcc-15-dev:armhf (15.2.0-12ubuntu1) ... 1185s Setting up gcc-15-arm-linux-gnueabihf (15.2.0-12ubuntu1) ... 1185s Setting up fontconfig-config (2.17.1-3ubuntu1) ... 1185s Setting up libpaper-utils (2.2.5-0.3build1) ... 1185s Setting up libgfortran-15-dev:armhf (15.2.0-12ubuntu1) ... 1185s Setting up libjs-jquery-datatables (1.11.5+dfsg-2build1) ... 1185s Setting up pkgconf:armhf (1.8.1-4build1) ... 1185s Setting up libthai0:armhf (0.1.30-1) ... 1185s Setting up liblapack-dev:armhf (3.12.1-7ubuntu1) ... 1185s update-alternatives: using /usr/lib/arm-linux-gnueabihf/lapack/liblapack.so to provide /usr/lib/arm-linux-gnueabihf/liblapack.so (liblapack.so-arm-linux-gnueabihf) in auto mode 1185s Setting up cpp-15 (15.2.0-12ubuntu1) ... 1185s Setting up libtiff6:armhf (4.7.0-3ubuntu3) ... 1185s Setting up cpp (4:15.2.0-4ubuntu1) ... 1185s Setting up libc6-dev:armhf (2.42-2ubuntu4) ... 1185s Setting up libfontconfig1:armhf (2.17.1-3ubuntu1) ... 1185s Setting up libsm6:armhf (2:1.2.6-1build1) ... 1185s Setting up libicu-dev:armhf (78.2-1ubuntu1) ... 1185s Setting up libbz2-dev:armhf (1.0.8-6build2) ... 1185s Setting up gcc-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 1185s Setting up fontconfig (2.17.1-3ubuntu1) ... 1187s Regenerating fonts cache... done. 1187s Setting up libjpeg-turbo8-dev:armhf (2.1.5-4ubuntu3) ... 1187s Setting up libxft2:armhf (2.3.6-1build2) ... 1187s Setting up libncurses-dev:armhf (6.6+20251231-1) ... 1187s Setting up gfortran-15-arm-linux-gnueabihf (15.2.0-12ubuntu1) ... 1187s Setting up libpcre2-dev:armhf (10.46-1) ... 1187s Setting up libtk8.6:armhf (8.6.17-1) ... 1187s Setting up libpango-1.0-0:armhf (1.57.0-1) ... 1187s Setting up libreadline-dev:armhf (8.3-3) ... 1187s Setting up libcairo2:armhf (1.18.4-3) ... 1187s Setting up gfortran-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 1187s Setting up gcc-15 (15.2.0-12ubuntu1) ... 1187s Setting up libstdc++-15-dev:armhf (15.2.0-12ubuntu1) ... 1187s Setting up libxt6t64:armhf (1:1.2.1-1.3) ... 1187s Setting up zlib1g-dev:armhf (1:1.3.dfsg+really1.3.1-1ubuntu2) ... 1187s Setting up libpangoft2-1.0-0:armhf (1.57.0-1) ... 1187s Setting up libjpeg8-dev:armhf (8c-2ubuntu11) ... 1187s Setting up gfortran-15 (15.2.0-12ubuntu1) ... 1187s Setting up libpangocairo-1.0-0:armhf (1.57.0-1) ... 1187s Setting up libpng-dev:armhf (1.6.54-1) ... 1187s Setting up libjpeg-dev:armhf (8c-2ubuntu11) ... 1187s Setting up g++-15-arm-linux-gnueabihf (15.2.0-12ubuntu1) ... 1187s Setting up gcc (4:15.2.0-4ubuntu1) ... 1187s Setting up r-base-core (4.5.2-1ubuntu2) ... 1188s Creating config file /etc/R/Renviron with new version 1188s Setting up r-cran-labeling (0.4.3-1) ... 1188s Setting up r-cran-farver (2.1.2-1) ... 1188s Setting up r-cran-viridislite (0.4.3-1) ... 1188s Setting up r-cran-commonmark (1.9.5-1) ... 1188s Setting up r-cran-r6 (2.6.1-1) ... 1188s Setting up g++-15 (15.2.0-12ubuntu1) ... 1188s Setting up g++-arm-linux-gnueabihf (4:15.2.0-4ubuntu1) ... 1188s Setting up r-cran-rlang (1.1.5-3) ... 1188s Setting up r-cran-matrixstats (1.5.0-1) ... 1188s Setting up r-cran-xfun (0.55+dfsg-1) ... 1188s Setting up r-cran-withr (3.0.2+dfsg-1) ... 1188s Setting up r-cran-base64enc (0.1-3-3build1) ... 1188s Setting up r-cran-yaml (2.3.10-1) ... 1188s Setting up r-cran-evaluate (1.0.5-1) ... 1188s Setting up r-cran-highr (0.11+dfsg-1) ... 1188s Setting up r-cran-glue (1.8.0-1) ... 1188s Setting up r-cran-cli (3.6.4-1) ... 1188s Setting up gfortran (4:15.2.0-4ubuntu1) ... 1188s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f95 (f95) in auto mode 1188s 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 1188s update-alternatives: using /usr/bin/gfortran to provide /usr/bin/f77 (f77) in auto mode 1188s 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 1188s Setting up r-cran-lifecycle (1.0.5+dfsg-1) ... 1188s Setting up r-cran-markdown (1.13-1) ... 1188s Setting up r-cran-s7 (0.2.0-1) ... 1188s Setting up r-cran-rcolorbrewer (1.1-3-1build2) ... 1188s Setting up r-cran-isoband (0.2.7-1) ... 1188s Setting up r-cran-scales (1.4.0-1) ... 1188s Setting up r-cran-gtable (0.3.6+dfsg-1) ... 1188s Setting up r-cran-knitr (1.51+dfsg-1) ... 1188s Setting up g++ (4:15.2.0-4ubuntu1) ... 1188s update-alternatives: using /usr/bin/g++ to provide /usr/bin/c++ (c++) in auto mode 1188s Setting up build-essential (12.12ubuntu2) ... 1188s Setting up r-cran-vctrs (0.6.5-1) ... 1188s Setting up r-base-dev (4.5.2-1ubuntu2) ... 1188s Setting up r-cran-ggplot2 (4.0.2+dfsg-1) ... 1188s Setting up pkg-r-autopkgtest (20250812) ... 1188s Processing triggers for libc-bin (2.42-2ubuntu4) ... 1188s Processing triggers for man-db (2.13.1-1build1) ... 1189s Processing triggers for install-info (7.2-5) ... 1204s autopkgtest [23:53:34]: test pkg-r-autopkgtest: /usr/share/dh-r/pkg-r-autopkgtest 1204s autopkgtest [23:53:34]: test pkg-r-autopkgtest: [----------------------- 1207s Test: Try to load the R library matrixStats 1207s 1207s R version 4.5.2 (2025-10-31) -- "[Not] Part in a Rumble" 1207s Copyright (C) 2025 The R Foundation for Statistical Computing 1207s Platform: arm-unknown-linux-gnueabihf (32-bit) 1207s 1207s R is free software and comes with ABSOLUTELY NO WARRANTY. 1207s You are welcome to redistribute it under certain conditions. 1207s Type 'license()' or 'licence()' for distribution details. 1207s 1207s R is a collaborative project with many contributors. 1207s Type 'contributors()' for more information and 1207s 'citation()' on how to cite R or R packages in publications. 1207s 1207s Type 'demo()' for some demos, 'help()' for on-line help, or 1207s 'help.start()' for an HTML browser interface to help. 1207s Type 'q()' to quit R. 1207s 1207s > library('matrixStats') 1207s > 1207s autopkgtest [23:53:37]: test pkg-r-autopkgtest: -----------------------] 1211s pkg-r-autopkgtest PASS 1211s autopkgtest [23:53:41]: test pkg-r-autopkgtest: - - - - - - - - - - results - - - - - - - - - - 1215s autopkgtest [23:53:45]: @@@@@@@@@@@@@@@@@@@@ summary 1215s run-unit-test PASS 1215s pkg-r-autopkgtest PASS