Reputation: 484
How do I time the running duration of R scripts?
I basically want an equivalent to the bash command time.
Upvotes: 2
Views: 182
Reputation: 15718
If it's a complicated script that can't be evaluated by system.time()
, try:
start_time = proc.time()
<your script here>
end_time = proc.time()
print(end_time - start_time)
Obviously you need to run lines 1-3 as close to each other as possible.
There are some examples here.
Upvotes: 0
Reputation: 61204
You can also use benchmark
function from rbenchmark
package. See helpfile here
Upvotes: 3