Skip to content

Commit 9cc7191

Browse files
committed
Dependency to pryr eliminated
1 parent 25884fe commit 9cc7191

7 files changed

Lines changed: 33 additions & 5 deletions

File tree

DESCRIPTION

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
Package: chart
22
Type: Package
3-
Version: 1.5.4
3+
Version: 1.5.5
44
Title: 'SciViews::R' - Unified Interface (with Formula) for R Plots
55
Description: Chart generalizes plot generation in R, being with base R plot
66
function, lattice or ggplot2. A formula interface is available for both
@@ -22,7 +22,6 @@ Imports:
2222
graphics (>= 4.2.0),
2323
grDevices (>= 4.2.0),
2424
latticeExtra (>= 0.6.30),
25-
pryr (>= 0.1.6),
2625
rlang (>= 1.1.1),
2726
scales (>= 1.2.1),
2827
stats (>= 4.2.0),

NAMESPACE

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ importFrom(ggpubr,ggarrange)
2929
importFrom(latticeExtra,custom.theme)
3030
importFrom(latticeExtra,ggplot2like)
3131
importFrom(latticeExtra,ggplot2like.opts)
32-
importFrom(pryr,modify_lang)
3332
importFrom(rlang,abort)
3433
importFrom(rlang,env_label)
3534
importFrom(rlang,f_env)

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
# chart 1.5.5
2+
3+
- Dependency to {pryr} is removed, since the package is archived from CRAN. A copy of its `modify_lang()` function is added here to get rid of that dependency.
4+
15
# chart 1.5.4
26

37
- Uses `aka()`, `section()` and `label()` from {svBase} (>= 1.7.0). No more dependencies to {data.io} and {svMisc}.

R/chart-internal.R

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,3 +81,29 @@ as_formula <- as.formula
8181
.base_to_ggplot <- c(col = "colour", color = "colour", pch = "shape",
8282
cex = "size", lty = "linetype", lwd = "size", srt = "angle", adj = "hjust",
8383
bg = "fill", fg = "colour", min = "ymin", max = "ymax")
84+
85+
# This was pryr::modify_lang(), but pryr is now archived from CRAN.
86+
.modify_lang <- function(x, f, ...) {
87+
recurse <- function(y) {
88+
lapply(y, .modify_lang, f = f, ...)
89+
}
90+
91+
if (is.atomic(x) || is.name(x)) {
92+
f(x, ...)
93+
} else if (is.call(x)) {
94+
as.call(recurse(x))
95+
} else if (is.function(x)) {
96+
formals(x) <- .modify_lang(formals(x), f, ...)
97+
body(x) <- .modify_lang(body(x), f, ...)
98+
x
99+
} else if (is.pairlist(x)) {
100+
as.pairlist(recurse(x))
101+
} else if (is.expression(x)) {
102+
as.expression(recurse(x))
103+
} else if (is.list(x)) {
104+
recurse(x)
105+
} else {
106+
stop("Unknown language class: ", paste(class(x), collapse = "/"),
107+
call. = FALSE)
108+
}
109+
}

R/chart-package.R

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
#' @importFrom rlang abort warn env_label f_env f_lhs f_rhs is_true is_quosure
2828
#' @importFrom stats as.formula asOneSidedFormula
2929
#' @importFrom utils .DollarNames apropos modifyList
30-
#' @importFrom pryr modify_lang
3130
#' @importFrom ggplotify as.ggplot
3231
#' @importFrom ggpubr ggarrange
3332
#' @importFrom svBase aka section label

R/chart.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ chart.default <- function(data, specif = NULL, formula = NULL, mapping = NULL,
226226
vars <- all.vars(form)
227227
vars <- vars[vars %in% dnames]
228228
for (var in vars) {
229-
expr <- pryr::modify_lang(expr, function(x)
229+
expr <- .modify_lang(expr, function(x)
230230
if (is.name(x) && identical(x, as.name(var)))
231231
as.name(labels[[var]]) else x)
232232
}

inst/WORDLIST

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ modelit
1010
ORCID
1111
OSX
1212
pipeable
13+
pryr
1314
README
1415
reusability
1516
SciViews

0 commit comments

Comments
 (0)