From dc3887b896f8651b65bc7488bddb3ac46e009938 Mon Sep 17 00:00:00 2001 From: Jim Thorson <50178738+James-Thorson-NOAA@users.noreply.github.com> Date: Tue, 2 Apr 2024 08:35:27 -0700 Subject: [PATCH] Fix #19 --- DESCRIPTION | 4 ++-- NAMESPACE | 1 - NEWS.md | 5 +++++ R/utils.R | 61 ++++++++++++++++++++++++++--------------------------- R/zzz.R | 2 +- 5 files changed, 38 insertions(+), 35 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b538b45..eb08a06 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: dsem Type: Package Title: Fit Dynamic Structural Equation Models -Version: 1.2.0 -Date: 2024-03-29 +Version: 1.2.1 +Date: 2024-04-02 Authors@R: c(person(given = "James", family = "Thorson", diff --git a/NAMESPACE b/NAMESPACE index 436e121..c094211 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -11,7 +11,6 @@ S3method(vcov,dsem) export(TMBAIC) export(as_fitted_DAG) export(as_sem) -export(checkDepPackageVersion) export(classify_variables) export(dsem) export(dsem_control) diff --git a/NEWS.md b/NEWS.md index ed27bea..9350012 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,8 @@ +# dsem 1.2.1 + +* removing `checkDepPackageVersion(dep_pkg="Matrix", this_pkg="TMB")` from `.onLoad()` + as requested by K. Kristensen + # dsem 1.2.0 * Adding option to specify covariance via argument `covs` diff --git a/R/utils.R b/R/utils.R index 031eb8d..18dbd49 100644 --- a/R/utils.R +++ b/R/utils.R @@ -6,37 +6,36 @@ #' @param warn give warning? #' @return logical: TRUE if the binary versions match #' @importFrom utils packageVersion -#' @export -checkDepPackageVersion <- function(dep_pkg = "TMB", - this_pkg = "dsem", - write_file = FALSE, - warn = TRUE) { - cur_dep_version <- as.character(packageVersion(dep_pkg)) - fn <- sprintf("%s-version", dep_pkg) - if (write_file) { - cat(sprintf("current %s version=%s: writing file\n", dep_pkg, cur_dep_version)) - writeLines(cur_dep_version, con = fn) - return(cur_dep_version) - } - fn <- system.file(fn, package=this_pkg) - built_dep_version <- scan(file=fn, what=character(), quiet=TRUE) - result_ok <- identical(built_dep_version, cur_dep_version) - if(warn && !result_ok) { - warning( - "Package version inconsistency detected.\n", - sprintf("%s was built with %s version %s", - this_pkg, dep_pkg, built_dep_version), - "\n", - sprintf("Current %s version is %s", - dep_pkg, cur_dep_version), - "\n", - sprintf("Please re-install %s from source ", this_pkg), - "or restore original ", - sQuote(dep_pkg), " package (see '?reinstalling' for more information)" - ) - } - return(result_ok) -} +#checkDepPackageVersion <- function(dep_pkg = "TMB", +# this_pkg = "dsem", +# write_file = FALSE, +# warn = TRUE) { +# cur_dep_version <- as.character(packageVersion(dep_pkg)) +# fn <- sprintf("%s-version", dep_pkg) +# if (write_file) { +# cat(sprintf("current %s version=%s: writing file\n", dep_pkg, cur_dep_version)) +# writeLines(cur_dep_version, con = fn) +# return(cur_dep_version) +# } +# fn <- system.file(fn, package=this_pkg) +# built_dep_version <- scan(file=fn, what=character(), quiet=TRUE) +# result_ok <- identical(built_dep_version, cur_dep_version) +# if(warn && !result_ok) { +# warning( +# "Package version inconsistency detected.\n", +# sprintf("%s was built with %s version %s", +# this_pkg, dep_pkg, built_dep_version), +# "\n", +# sprintf("Current %s version is %s", +# dep_pkg, cur_dep_version), +# "\n", +# sprintf("Please re-install %s from source ", this_pkg), +# "or restore original ", +# sQuote(dep_pkg), " package (see '?reinstalling' for more information)" +# ) +# } +# return(result_ok) +#} #' @name reinstalling #' @rdname reinstalling diff --git a/R/zzz.R b/R/zzz.R index 9b2a058..9ec976c 100644 --- a/R/zzz.R +++ b/R/zzz.R @@ -4,7 +4,7 @@ # See: https://mail.google.com/mail/u/0/#inbox/QgrcJHsNjpqZNGJhNMVHcfGFDLLMfrvqqHl .onLoad <- function(libname, pkgname) { #checkDepPackageVersion(dep_pkg="TMB", this_pkg="dsem") - checkDepPackageVersion(dep_pkg="Matrix", this_pkg="TMB") + #checkDepPackageVersion(dep_pkg="Matrix", this_pkg="TMB") } .onUnload <- function(libpath) {