Say i spawn a system command from an R session:
system("sleep 20")
How can I keep track of the CPU and memory usage of the resulting process (preferably from within an R session)?
Ideal solution would include polling at regular intervals so I can see how CPU / memory usage changes over time
I am running macOS monterey (but a minimally platform specific solution would be ideal)