ddply
has a .progress
to get a progress bar while it\'s running, is there an equivalent for data.table
in R?
Yes, you can use any progress status you want.
library(data.table)
dt = data.table(a=1:4, b=c("a","b"))
dt[, {cat("group:",b,"\n"); sum(a)}, b]
#group: a
#group: b
# b V1
#1: a 4
#2: b 6
If you ask about progress in loading csv file with fread
then it will automatically be displayed for bigger datasets. Also as mentioned by Sergey in comment you can use verbose
argument to get more information, both in fread
and in [.data.table
.
If you want the percentage of groups processed.
grpn = uniqueN(dt$b)
dt[, {cat("progress",.GRP/grpn*100,"%\n"); sum(a)}, b]
#progress 50 %
#progress 100 %
# b V1
#1: a 4
#2: b 6