Reputation: 381
I am running a single script in R using source('scriptname.R').
I would like to get the running time of this script.
Can someone advise me on how I can do this?
Upvotes: 6
Views: 6773
Reputation: 368489
tl;dr: Wrap system.time(source("scriptname.R"))
around it.
Longer answer: Read the "Writing R Extensions" manual about profiling your code, and look at a few of the profiling packages which help aggregate the raw profiling data. The newest, and possibly nicest is Hadley's lineprof package on github.
Upvotes: 8
Reputation: 545995
system.time
should do:
system.time(source('scriptname.R'))
Upvotes: 4