Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

droplevels() fails with empty data.table #5184

Closed
mb706 opened this issue Sep 29, 2021 · 1 comment · Fixed by #5185
Closed

droplevels() fails with empty data.table #5184

mb706 opened this issue Sep 29, 2021 · 1 comment · Fixed by #5185
Labels
Milestone

Comments

@mb706
Copy link

mb706 commented Sep 29, 2021

> droplevels(data.table::data.table())
Error in droplevels.data.table(data.table::data.table()) : 
  length(x) > 0L is not TRUE

It works for data.frame:

> droplevels(data.frame())
data frame with 0 columns and 0 rows

Using current GitHub-Version 8f0afcb

> sessionInfo()
R version 4.0.5 (2021-03-31)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: Fedora 34 (Thirty Four)

Matrix products: default
BLAS/LAPACK: /usr/lib64/libflexiblas.so.3.0

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

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

loaded via a namespace (and not attached):
[1] compiler_4.0.5    data.table_1.14.3
@ben-schwen
Copy link
Member

Ty for the report. The S3 method for data.table should ofc return the same result for this "edge case".

@jangorecki jangorecki added this to the 1.14.3 milestone Oct 2, 2021
@mattdowle mattdowle added the dev label Oct 5, 2021
@jangorecki jangorecki modified the milestones: 1.14.9, 1.15.0 Oct 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants