Create a string with a path to directory for RStudio snippets. The directory might not exist.

get_path_rstudio_snippets_dir(rstudio_version = "current")

Arguments

rstudio_version

Numeric version of RStudio (the output is different for RStudio < 1.3 and 1.3 or newer series). If "current", the current version of RStudio will be determined automatically when it is running; otherwise, the 1.3-or-newer layout is used.

Value

(string) Path to directory for RStudio snippets.

Examples

if (interactive()) {
  # Regularly, you should use this:
  get_path_rstudio_snippets_dir()
}

# For testing purposes:
get_path_rstudio_snippets_dir("1.4.1103")
#> /home/runner/.config/snippets
get_path_rstudio_snippets_dir("1.2.5044")
#> /home/runner/.R/snippets