是否有办法改变system.time的精度?
system.time(sum(seq(1.0,10^4,1)))
转到如下:
round(system.time(sum(seq(1.0,10^4,1))),digits=6)
您应该使用microbenchmark
包。
从包DESCRIPTION
:
Package: microbenchmark
Title: Sub microsecond accurate timing functions.
Description: Provides infrastructure to accurately measure and compare the execution time of R expressions.