Put your code in a new R script, e.g. "~/.../myscript.R". Then run the following code:
Rprof("profile1.out", line.profiling=TRUE)
source('~/.../myscript.R') # replace '...' with appropriate directory
Rprof(NULL)
summaryRprof("profile1.out", lines = "show")
- As shown here, you can do several profiles in a row by repeating the 3-line block shown above with different filenames than "profile1.out".
- Note the file "profile1.out" will be created in whatever your current working directory is.
- I think you can replace the line "source()" with the actual code itself.