Put your code in a new R script, e.g. "~/.../myscript.R". Then run the following code:
source('~/.../myscript.R') # replace '...' with appropriate directory
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.