Skip to content

as.data.table(table(NULL)) returns null data.table#4180

Merged
mattdowle merged 4 commits intomasterfrom
as-datatable-table
May 7, 2021
Merged

as.data.table(table(NULL)) returns null data.table#4180
mattdowle merged 4 commits intomasterfrom
as-datatable-table

Conversation

@MichaelChirico
Copy link
Copy Markdown
Member

Closes #4179

Note the intentional break vs. base for the stated reason:

x = as.data.table(table(iris$Species))
# this implementation
rbind(x, as.data.table(table(NULL)))
#            V1     N
# 1:     setosa    50
# 2: versicolor    50
# 3:  virginica    50
# base implementation
rbind(x, as.data.frame(table(NULL)))
# Error in rbindlist(l, use.names, fill, idcol) : 
#   Item 2 has 1 columns, inconsistent with item 1 which has 2 columns. To fill missing columns use fill=TRUE.

@codecov
Copy link
Copy Markdown

codecov bot commented Jan 16, 2020

Codecov Report

Merging #4180 (7d2064c) into master (dec9383) will increase coverage by 0.00%.
The diff coverage is 100.00%.

Impacted file tree graph

@@           Coverage Diff           @@
##           master    #4180   +/-   ##
=======================================
  Coverage   99.42%   99.42%           
=======================================
  Files          73       73           
  Lines       14465    14466    +1     
=======================================
+ Hits        14382    14383    +1     
  Misses         83       83           
Impacted Files Coverage Δ
R/as.data.table.R 100.00% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update dec9383...7d2064c. Read the comment docs.

@mattdowle mattdowle added this to the 1.14.1 milestone May 7, 2021
@mattdowle mattdowle merged commit 2939cb8 into master May 7, 2021
@mattdowle mattdowle deleted the as-datatable-table branch May 7, 2021 20:47
@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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

robustness -- as.data.table(table(NULL)) gives wrong error

3 participants