问题
How can I find out the process ID of the current R session my R code is running in?
I am using Ubuntu 18.04, but an answer working on Windows would also be great.
回答1:
There is a command called Sys.getpid()
that outputs the session ID directly
Sys.getpid()
#[1] 134164
来源:https://stackoverflow.com/questions/58657784/get-pid-process-id-of-r-session-from-within-r-session-to-attach-a-debugger