Check when the R session was started?

Is there any way to check when the R session was started? In interactive mode , optional in batch mode .

+5
source share
3 answers

In the windows you can see the creation time of temp dir for r-session

file.info(tempdir())$ctime

His only idea and may not always work

+4
source

It will not work in current sessions, but can (locally) work on future sessions. Modify / create the .Rprofile file in your home directory and add the following two lines:

 .startedTime<-Sys.time() .sessionTime<-function() Sys.time()-.startedTime 

Lines in .Rprofile are executed at the beginning of the session. I select names starting with a dot, so they do not return ls() . Then start the R session and when you give:

 .sessionTime() 

it will return the elapsed time from the start of the session.

+7
source

The tracking time of the proc.time function since the start of R (see the help), which can be used as:

 Sys.time() - proc.time()["elapsed"] 

to find out when the session started.

+4
source

All Articles