aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Ranke <jranke@uni-bremen.de>2022-09-14 22:39:12 +0200
committerJohannes Ranke <jranke@uni-bremen.de>2022-09-14 22:39:12 +0200
commitaf24cde56a49b532d7f65dd199d176e0ce3cac09 (patch)
treea6b4d3c263ffee5014af941be9f21dc5cb34ac31
parent569a5790c2f8cca4dc6d8c5a53bd3b7a9f65441f (diff)
Remove purrr dependency
We now directly import from rlang and vctrs, which were indirect dependencies anyways. purrr::map_dfr is deprecated in the upcoming purrr 1.0, and depends on dplyr (since when?) which is only suggested by purrr. This would lead new installations of mkin to fail if dplyr is not installed as well.
-rw-r--r--DESCRIPTION4
-rw-r--r--NAMESPACE2
-rw-r--r--R/mixed.mmkin.R3
-rw-r--r--R/nlme.R4
-rw-r--r--R/plot.mixed.mmkin.R5
-rw-r--r--R/saem.R1
6 files changed, 11 insertions, 8 deletions
diff --git a/DESCRIPTION b/DESCRIPTION
index 118ceaae..6734a43c 100644
--- a/DESCRIPTION
+++ b/DESCRIPTION
@@ -2,7 +2,7 @@ Package: mkin
Type: Package
Title: Kinetic Evaluation of Chemical Degradation Data
Version: 1.1.2
-Date: 2022-07-21
+Date: 2022-09-14
Authors@R: c(
person("Johannes", "Ranke", role = c("aut", "cre", "cph"),
email = "johannes.ranke@jrwb.de",
@@ -24,7 +24,7 @@ Description: Calculation routines based on the FOCUS Kinetics Report (2006,
purpose.
Depends: R (>= 2.15.1),
Imports: stats, graphics, methods, parallel, deSolve, R6, inline (>= 0.3.19),
- numDeriv, lmtest, pkgbuild, nlme (>= 3.1-151), purrr, saemix (>= 3.1)
+ numDeriv, lmtest, pkgbuild, nlme (>= 3.1-151), saemix (>= 3.1), rlang, vctrs
Suggests: knitr, rbenchmark, tikzDevice, testthat, rmarkdown, covr, vdiffr,
benchmarkme, tibble, stats4
License: GPL
diff --git a/NAMESPACE b/NAMESPACE
index 90e69221..1be6d95d 100644
--- a/NAMESPACE
+++ b/NAMESPACE
@@ -135,7 +135,7 @@ importFrom(nlme,intervals)
importFrom(parallel,detectCores)
importFrom(parallel,mclapply)
importFrom(parallel,parLapply)
-importFrom(purrr,map_dfr)
+importFrom(rlang,"!!!")
importFrom(stats,AIC)
importFrom(stats,BIC)
importFrom(stats,aggregate)
diff --git a/R/mixed.mmkin.R b/R/mixed.mmkin.R
index 682a9a34..fd6d975f 100644
--- a/R/mixed.mmkin.R
+++ b/R/mixed.mmkin.R
@@ -1,5 +1,6 @@
#' Create a mixed effects model from an mmkin row object
#'
+#' @importFrom rlang !!!
#' @param object An [mmkin] row object
#' @param method The method to be used
#' @param \dots Currently not used
@@ -65,7 +66,7 @@ mixed.mmkin <- function(object, method = c("none"), ...) {
function(x) x$data[c("variable", "time", "observed", "predicted", "residual")])
names(ds_list) <- ds_names
- res$data <- purrr::map_dfr(ds_list, function(x) x, .id = "ds")
+ res$data <- vctrs::vec_rbind(!!!ds_list, .names_to = "ds")
names(res$data)[1:4] <- c("ds", "name", "time", "value")
res$data$name <- as.character(res$data$name)
res$data$ds <- ordered(res$data$ds, levels = unique(res$data$ds))
diff --git a/R/nlme.R b/R/nlme.R
index 8762f137..6b2d06d0 100644
--- a/R/nlme.R
+++ b/R/nlme.R
@@ -125,7 +125,7 @@ nlme_function <- function(object) {
}
#' @rdname nlme
-#' @importFrom purrr map_dfr
+#' @importFrom rlang !!!
#' @return A \code{\link{groupedData}} object
#' @export
nlme_data <- function(object) {
@@ -134,7 +134,7 @@ nlme_data <- function(object) {
ds_list <- lapply(object, function(x) x$data[c("time", "variable", "observed")])
names(ds_list) <- ds_names
- ds_nlme <- purrr::map_dfr(ds_list, function(x) x, .id = "ds")
+ ds_nlme <- vctrs::vec_rbind(!!!ds_list, .names_to = "ds")
ds_nlme$variable <- as.character(ds_nlme$variable)
ds_nlme$ds <- ordered(ds_nlme$ds, levels = unique(ds_nlme$ds))
ds_nlme_renamed <- data.frame(ds = ds_nlme$ds, name = ds_nlme$variable,
diff --git a/R/plot.mixed.mmkin.R b/R/plot.mixed.mmkin.R
index 3a444253..6815bfd2 100644
--- a/R/plot.mixed.mmkin.R
+++ b/R/plot.mixed.mmkin.R
@@ -153,7 +153,7 @@ plot.mixed.mmkin <- function(x,
outtimes <- sort(unique(c(x$data$time,
seq(xlim[1], xlim[2], length.out = 50))))
- pred_ds <- purrr::map_dfr(i, function(ds_i) {
+ pred_list <- lapply(i, function(ds_i) {
odeparms_trans <- degparms_all[ds_i, odeparms_names]
names(odeparms_trans) <- odeparms_names # needed if only one odeparm
if (backtransform) {
@@ -171,8 +171,9 @@ plot.mixed.mmkin <- function(x,
out <- mkinpredict(x$mkinmod, odeparms, odeini,
outtimes, solution_type = solution_type,
atol = fit_1$atol, rtol = fit_1$rtol)
- return(cbind(as.data.frame(out), ds = ds_names[ds_i]))
})
+ names(pred_list) <- ds_names[i]
+ pred_ds <- vctrs::vec_rbind(!!!pred_list, .names_to = "ds")
odeparms_pop_trans <- degparms_all_pop[odeparms_names]
diff --git a/R/saem.R b/R/saem.R
index 6ed3efdd..875456c3 100644
--- a/R/saem.R
+++ b/R/saem.R
@@ -559,6 +559,7 @@ saemix_model <- function(object, solution_type = "auto", transformations = c("mk
}
#' @rdname saem
+#' @importFrom rlang !!!
#' @return An [saemix::SaemixData] object.
#' @export
saemix_data <- function(object, verbose = FALSE, ...) {

Contact - Imprint