paradox icon indicating copy to clipboard operation
paradox copied to clipboard

as.data.table of empty ParamSet should have same columns as for non-empty ParamSet

Open mb706 opened this issue 3 years ago • 0 comments

> as.data.table(ps(x = p_lgl()))
   id    class lower upper      levels nlevels is_bounded special_vals        default storage_type tags
1:  x ParamLgl    NA    NA  TRUE,FALSE       2       TRUE    <list[0]> <NoDefault[3]>      logical     
> as.data.table(ps())
Null data.table (0 rows and 0 cols)

The result should ideally be the same as

> as.data.table(ps(x = p_lgl()))[0]
Empty data.table (0 rows and 11 cols): id,class,lower,upper,levels,nlevels...

This makes it easier to work with data.tables without having to check the edge-case on the user's side.

mb706 avatar Mar 07 '21 17:03 mb706