SebKrantz / collapse

Advanced and Fast Data Transformation in R
https://sebkrantz.github.io/collapse/
Other
651 stars 34 forks source link

tfmv problem #557

Closed ggrothendieck closed 5 months ago

ggrothendieck commented 6 months ago

These work as expected

tfmv(BOD, "demand", sqrt)
tfmv(BOD, character(0), sqrt)
tfmv(BOD, 2, sqrt)

but this gives an error

tfmv(BOD, integer(0), sqrt)
## Error in if (cols[1L] < 0L) { : missing value where TRUE/FALSE needed

This matters because the second argument may have been computed and we don't know in advance that there is at least one column to be transformed. There is an obvious workaround but for consistency it should work.