Bug 17201 - Wishlist: 'which' to support long vectors
Summary: Wishlist: 'which' to support long vectors
Status: UNCONFIRMED
Alias: None
Product: R
Classification: Unclassified
Component: Wishlist (show other bugs)
Version: R 3.3.0
Hardware: Other Linux-Debian
: P5 enhancement
Assignee: R-core
URL:
Depends on:
Blocks:
 
Reported: 2016-12-25 07:07 UTC by Suharto Anggono
Modified: 2016-12-25 10:09 UTC (History)
0 users

See Also:


Attachments
summary.c: do_which: like approach in 'logicalSubscript' in subscript.c (1.75 KB, patch)
2016-12-25 07:07 UTC, Suharto Anggono
Details | Diff
Corresponding documentation change (874 bytes, patch)
2016-12-25 09:19 UTC, Suharto Anggono
Details | Diff
Corresponding documentation change (825 bytes, patch)
2016-12-25 10:09 UTC, Suharto Anggono
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Suharto Anggono 2016-12-25 07:07:29 UTC
Created attachment 2201 [details]
summary.c: do_which: like approach in 'logicalSubscript' in subscript.c

This is an example, in RStudio in Data Scientist Workbench.

R> x <- logical(2^31)

This fails.
R> i <- which(x)
Error in which(x) : 
  long vectors not supported yet: ../../src/include/Rinlinedfuns.h:138

The equivalent works.
R> i <- seq_along(x)[x & !is.na(x)]

R> gc()
             used   (Mb) gc trigger    (Mb)   max used    (Mb)
Ncells     476536   25.5     940480    50.3     592000    31.7
Vcells 1074474296 8197.6 6185902635 47194.7 6443238378 49158.1
R> sessionInfo()
R version 3.3.2 (2016-10-31)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Debian GNU/Linux stretch/sid

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C              
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8    
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8   
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C                 
 [9] LC_ADDRESS=C               LC_TELEPHONE=C            
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C       

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods  
[7] base     

other attached packages:
[1] SparkR_1.6.1

loaded via a namespace (and not attached):
[1] tools_3.3.2


For completeness, it would be nice if 'which' could work on long vectors.

Functionality like 'which' is implemented in function 'logicalSubscript' in subscript.c. The implementation supports long vectors.
Comment 1 Suharto Anggono 2016-12-25 09:19:14 UTC
Created attachment 2202 [details]
Corresponding documentation change
Comment 2 Suharto Anggono 2016-12-25 10:09:11 UTC
Created attachment 2203 [details]
Corresponding documentation change