如何在system.time输出中添加小数点?

时间:2016-08-20 10:13:56

标签: r time

当我运行system.time函数时,我一直得0,没有任何小数点。我知道答案应该比我得到的更详细。是否可以更改设置以获得更高的分辨率?

运行system.time函数

的示例
system.time(expr = a1, gcFirst = FALSE)
# user  system elapsed 
# 0       0       0 

system.time(expr = a2,gcFirst = FALSE)
# user  system elapsed 
# 0       0       0 

system.time(expr = a3,gcFirst = FALSE)
# user  system elapsed 
#  0       0       0 

另一方面,如果我使用microbenchmark,我可以看到时间不是0

mbm = microbenchmark(
a1 = mean(DT$pwgtp15,by=DT$SEX) ,
a2 = sapply(split(DT$pwgtp15,DT$SEX),mean) ,
a3 =tapply(DT$pwgtp15,DT$SEX,mean) ,
times = 100
)

mbm
# Unit: microseconds
#  expr   min       lq       mean   median        uq      max neval  cld
#  a1  28.841  33.5820   42.74292  39.3100   48.0010  110.619   100 a   
#  a2 388.348 435.7555  551.03031 503.9035  652.8420  906.670   100  b  
#  a3 433.384 486.1255  695.28737 675.9530  774.5205 4985.690   100   c 

如何更改system.time代码或我的设置以显示实际用户时间已过?

由于

0 个答案:

没有答案
相关问题