Safely Access the RStudio API
Access the RStudio API (if available) and provide informative error messages when it's not.
install.packages("rstudioapi")
remotes::install_cran("rstudioapi")