1 |
.core <- c("dimensio", "isopleuros", "kairos", "nexus", "tabula") |
|
2 | ||
3 |
is_attached <- function(x) { |
|
4 | 2x |
paste0("package:", x) %in% search() |
5 |
} |
|
6 | ||
7 |
tesselle_unloaded <- function() { |
|
8 | 1x |
.core[!is_attached(.core)] |
9 |
} |
|
10 | ||
11 |
tesselle_load <- function(x) { |
|
12 | 5x |
loc <- if (x %in% loadedNamespaces()) dirname(getNamespaceInfo(x, "path")) |
13 | 5x |
do.call("library", list(x, lib.loc = loc, character.only = TRUE)) |
14 |
} |
|
15 | ||
16 |
tesselle_attach <- function() { |
|
17 | 1x |
to_load <- tesselle_unloaded() |
18 | 1x |
if (length(to_load) == 0) |
19 | ! |
return(invisible()) |
20 | ||
21 | 1x |
packageStartupMessage(message_header(tr_("Attaching packages"))) |
22 | 1x |
suppressPackageStartupMessages(lapply(X = to_load, FUN = tesselle_load)) |
23 | 1x |
packageStartupMessage(message_packages(to_load)) |
24 | ||
25 | 1x |
invisible(to_load) |
26 |
} |
1 |
## https://michaelchirico.github.io/potools/articles/developers.html |
|
2 |
tr_ <- function(...) { |
|
3 | 1x |
enc2utf8(gettext(paste0(...), domain = "R-tesselle")) |
4 |
} |
|
5 | ||
6 |
message_header <- function(right) { |
|
7 | ||
8 | 1x |
left <- sprintf("tesselle %s", version_text("tesselle")) |
9 | ||
10 | 1x |
n_right <- nchar(right) |
11 | 1x |
n_left <- nchar(left) |
12 | ||
13 | 1x |
if (n_right > 0) { |
14 | 1x |
right <- sprintf(" %s ", right) |
15 | 1x |
n_right <- n_right + 2 |
16 |
} |
|
17 | 1x |
if (n_left > 0) { |
18 | 1x |
left <- sprintf(" %s ", left) |
19 | 1x |
n_left <- n_left + 2 |
20 |
} |
|
21 | ||
22 | 1x |
dash <- rep("-", getOption("width") - 6 - n_right - n_left) |
23 | 1x |
rule <- paste0(dash, collapse = "") |
24 | ||
25 | 1x |
sprintf("---%s%s%s---", right, rule, left) |
26 |
} |
|
27 |
message_packages <- function(x) { |
|
28 | 1x |
versions <- vapply(X = x, FUN = version_text, FUN.VALUE = character(1)) |
29 | 1x |
info <- sprintf("* %-12s%s", x, versions) |
30 | 1x |
paste0(info, collapse = "\n") |
31 |
} |
|
32 |
version_text <- function(x) { |
|
33 | 6x |
version <- unclass(utils::packageVersion(x))[[1]] |
34 | 6x |
paste0(as.character(version), collapse = ".") |
35 |
} |
1 |
#' @details |
|
2 |
#' \tabular{ll}{ |
|
3 |
#' **Package:** \tab tesselle \cr |
|
4 |
#' **Type:** \tab Package \cr |
|
5 |
#' **Version:** \tab 1.6.0 \cr |
|
6 |
#' **License:** \tab GPL-3 \cr |
|
7 |
#' } |
|
8 |
#' |
|
9 |
#' @author |
|
10 |
#' **Full list of authors and contributors** (alphabetic order): |
|
11 |
#' |
|
12 |
#' \tabular{ll}{ |
|
13 |
#' Nicolas Frerebeau \tab *Université Bordeaux Montaigne, France* \cr |
|
14 |
#' Brice Lebrun \tab *Université Bordeaux Montaigne, France* \cr |
|
15 |
#' } |
|
16 |
#' |
|
17 |
#' **Package maintainer** |
|
18 |
#' |
|
19 |
#' Nicolas Frerebeau\cr |
|
20 |
#' \email{nicolas.frerebeau@@u-bordeaux-montaigne.fr} |
|
21 |
#' |
|
22 |
#' Archéosciences Bordeaux (UMR 6034)\cr |
|
23 |
#' Maison de l'Archéologie\cr |
|
24 |
#' Université Bordeaux Montaigne\cr |
|
25 |
#' 33607 Pessac cedex\cr |
|
26 |
#' France |
|
27 |
#' @name tesselle-package |
|
28 |
#' @aliases tesselle |
|
29 |
#' @docType package |
|
30 |
#' @keywords internal |
|
31 |
"_PACKAGE" |
|
32 | ||
33 |
# Suppress R CMD check note "All declared Imports should be used." |
|
34 |
unused <- function() { |
|
35 | ! |
dimensio::ca |
36 | ! |
folio::arnold1949 |
37 | ! |
isopleuros::ternary_plot |
38 | ! |
kairos::mcd |
39 | ! |
khroma::color |
40 | ! |
nexus::as_composition |
41 | ! |
tabula::heterogeneity |
42 |
} |