if (interactive()) {
# when your code is extremely time-consuming, you may need this function;
# e.g. you go to sleep, and R is running long computation... complex
# graphics... and long long computation... at last,
shutdown()
# the next day you wake up, 'thank you, R' :)
}
Run the code above in your browser using DataLab