Open franknarf1 opened 5 years ago
Maybe also cover reading files in other formats (json, matrix)... though maybe that's broad enough for a separate set of notes.
Thanks for the great tutorial. I consider myself an advanced data.table user but still learned some new stuff.
Two suggestions on the fread part:
?fread Compressed files with extension .gz and .bz2 are supported if the R.utils package is installed.
DT = fileDT[, rbindlist(setNames(contents, id), idcol="file_id")]
can be
fileDT[, fread(fn), by = .(year, id)]
and the result will be all table combined together with year, id column.
Reading files
fread("unzip -p file.zip subfile.csv")
orfread("tar -zxvf multiple_files.csv.gz wanted_file.csv")
. thanks to xz, Axeman https://chat.stackoverflow.com/transcript/message/45164278#45164278