# NOT RUN {
start <- Sys.time()
openPage()
app <- getPage()
time <- Sys.time()
app$openPage(FALSE)
app$openPage(FALSE)
print(getSessionIds())
# No sessions will be closed
closeSession(old = Sys.time() - start)
print(getSessionIds())
# One session (the one that has been opened first) will be closed
closeSession(old = Sys.time() - time)
print(getSessionIds())
time <- Sys.time()
sendCommand("jrc.sendCommand('print(\"Hi!\")')", sessionId = getSessionIds()[1], wait = 3)
# this will close all sessions except for the one, that has just send a command to R session
closeSession(inactive = Sys.time() - time)
# if there is only one active session, sessionId becomes an optional argument
closeSession()
closePage()
# }
# NOT RUN {
# }
Run the code above in your browser using DataLab