powered by
Determines whether the current R session is running in a hosted environment such as Google Colab or RStudio Server (non-localhost).
is_hosted_session()
A logical value: TRUE if running in a hosted session (Google Colab or remote RStudio Server), FALSE otherwise.
TRUE
FALSE
This function checks for:
Google Colab: presence of the COLAB_RELEASE_TAG environment variable
COLAB_RELEASE_TAG
RStudio Server: RSTUDIO_PROGRAM_MODE is "server" and RSTUDIO_HTTP_REFERER does not contain "localhost"
RSTUDIO_PROGRAM_MODE
RSTUDIO_HTTP_REFERER
if (is_hosted_session()) { message("Running in a hosted environment") }
Run the code above in your browser using DataLab