fstpackage / fst

Lightning Fast Serialization of Data Frames for R
http://www.fstpackage.org/fst/
GNU Affero General Public License v3.0
614 stars 42 forks source link

Bug fix for 0-row tables #270

Closed AndyTwo2 closed 7 months ago

AndyTwo2 commented 1 year ago

Fixes the error below if there is a 0-row fst table being called. c.f. #99

library(fst)
# create a 0-row data frame
noRows = data.frame(aa=numeric(0), bb=character(0), cc=logical(0))
fst::write_fst(noRows, "noRowsFstFile.fst")
fst::read_fst("noRowsFstFile.fst")# works fine
fst::fst("noRowsFstFile.fst")
# the above gives error: Error in `.rowNamesDF<-`(x, value = value) : invalid 'row.names' length
MarcusKlik commented 7 months ago

Thanx @AndyTwo2, good find!

MarcusKlik commented 7 months ago

Added some tests for reading zero-row (and zero-column) tables using fst::fst()