SciViews/tabularise

bug in tabularise_headtail() with a data.table object

Closed this issue · 1 comments

Hello @phgrosjean ,

I think I've discovered a bug in the tabularise_headtail() function. It seems from the tests below that the problem only occurs with a data.table object.

The error message indicates that the problem is in the rbind() function and in column 2 of the table, which is of class Date

SciViews::R()
iris <- read("iris", package = "datasets")
tabularise$headtail(iris) # OK

biometry <- read("biometry", package = "BioDataScience", lang = "fr")
tabularise$headtail(biometry) # ERROR
#> Error in rbindlist(l, use.names, fill, idcol): Class attribute on column 2 of item 2 does not match with column 2 of item 1.

bio <- BioDataScience::biometry
tabularise$headtail(bio) # OK

bio <- as_dtx(BioDataScience::biometry)
tabularise$headtail(bio) # ERROR
#> Error in rbindlist(l, use.names, fill, idcol): Class attribute on column 2 of item 2 does not match with column 2 of item 1.

Created on 2023-09-14 by the reprex package (v2.0.1)

Thanks, this is corrected now (object is converted into a data.frame in the function to avoid this problem).