R/misc_from_mapview.R

Defines functions is_vscode

is_rstudio = function () {
	if (requireNamespace("rstudioapi", quietly = TRUE)) {
		rstudioapi::isAvailable() && rstudioapi::versionInfo()$mode !=
			"vscode"
	}
	else {
		FALSE
	}
}

get_ide = function () {
	if (is_rstudio()) {
		return("rstudio")
	}
	else if (is_vscode()) {
		return("vscode")
	}
	else {
		"other"
	}
}

## need to assign global variable .vsc
utils::globalVariables(c(".vsc"))

is_vscode = function() {
	exists(".vsc") && exists("attach", envir = .vsc)
}

get_url_dir = function (url) gsub("file://|/index.html", "", url)

Try the tmap package in your browser

Any scripts or data that you put into this service are public.

tmap documentation built on April 4, 2025, 2:05 a.m.