Skip to content

Commit

Permalink
Merge pull request #130 from LAPKB/v2_dev
Browse files Browse the repository at this point in the history
Release 4.0.2
  • Loading branch information
Siel authored Jan 11, 2023
2 parents 7286ba5 + 8e87727 commit 7b33705
Show file tree
Hide file tree
Showing 226 changed files with 7,082 additions and 2,170 deletions.
2 changes: 1 addition & 1 deletion 404.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ Authors@R: c(
person("David", "Bayard", email = "", role = "ctb"),
person("Robert", "Leary", email = "", role = "ctb")
)
Version: 2.0.1
Version: 2.0.2
URL: https://lapkb.github.io/Pmetrics/
BugReports: https://github.com/LAPKB/Pmetrics/issues
Date: 2022-09-30
Date: 2023-01-05
Depends:
R (>= 4.0.0)
Imports:
Expand All @@ -45,7 +45,6 @@ Imports:
Matrix,
mclust,
methods,
npde,
openxlsx,
parallel,
plyr,
Expand All @@ -61,6 +60,7 @@ Imports:
xtable,
readr,
trelliscopejs,
npde,
lubridate,
mvtnorm,
tidyverse,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE-text.html

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ export(SIMrun)
export(ab)
export(ab_line)
export(add_shapes)
export(add_smooth)
export(additive)
export(combination)
export(fixed)
Expand All @@ -118,6 +119,7 @@ export(makePost)
export(makeValid)
export(make_NCA)
export(make_valid)
export(modelLibrary)
export(msd)
export(proportional)
export(qgrowth)
Expand Down
35 changes: 19 additions & 16 deletions R/Deprecated.R
Original file line number Diff line number Diff line change
@@ -1,65 +1,68 @@
#' The following functions are deprecated in Pmetrics.
#'
#'
#'
#'
#' @title Deprecated functions.
#' @aliases PMcheckMatrix, PMfixMatrix, NPload, ITload, NPreport, ITreport,
#' @aliases PMFortranConfig, PMcheckMatrix, PMfixMatrix, NPload, ITload, NPreport, ITreport,
#' PMdiag, PMreadDefaults, PMwriteDefaults, makeNPDE, PMupdate
#' @author Michael Neely
#' @export

#' @export
PMFortranConfig <- function(...) {
cat("\nPMFortranConfig is deprecated. Use setPMoptions instead to change the compilation arguments.\n")
}


PMcheckMatrix <- function(...){
#' @export
PMcheckMatrix <- function(...) {
cat("\nPMcheckMatrix is deprecated. Use PMcheck() instead to check data and model files.\n")
}

#' @export
PMfixMatrix <- function(...){
PMfixMatrix <- function(...) {
cat("\nPMfixMatrix is deprecated. Use PMcheck(...,fix=T) instead to fix data files.\n")
}

#' @export
NPload <- function(...){
NPload <- function(...) {
cat("\nNPload is deprecated. Use PMload() instead to load results of NPAG or IT2B runs.\n")
}

#' @export
ITload <- function(...){
ITload <- function(...) {
cat("\nITload is deprecated. Use PMload() instead to load results of NPAG or IT2B runs.\n")
}

#' @export
NPreport <- function(...){
NPreport <- function(...) {
cat("\nNPreport is deprecated. Use PMreport() instead to process completed NPAG or IT2B runs.\n")
}

#' @export
ITreport <- function(...){
ITreport <- function(...) {
cat("\nITreport is deprecated. Use PMreport() instead to process completed NPAG or IT2B runs.\n")
}

#' @export
PMdiag <- function(...){
PMdiag <- function(...) {
cat("\nPMdiag is deprecated. Use makeNPDE() instead to internally validate a model.\n")
}

#' @export
PMreadDefaults <- function(...){
PMreadDefaults <- function(...) {
cat("\nPMreadDefaults is deprecated. Use getPMoptions() instead to read Pmetrics options.\n")
}

#' @export
PMwriteDefaults <- function(...){
PMwriteDefaults <- function(...) {
cat("\nPMwriteDefaults is deprecated. Use setPMoptions() instead to set Pmetrics options.\n")
}

#' @export
makeNPDE <- function(...){
makeNPDE <- function(...) {
cat("\nmakeNPDE is deprecated. Use $validate() on a PM_result object or makeValid() instead.\n")
}

#' @export
PMupdate <- function(...){
PMupdate <- function(...) {
cat("\nPMupdate is deprecated. Please restart Rstudio and do not load Pmetrics. Then use the command devtools::install_github(\"LAPKB/Pmetrics\")")
}

108 changes: 0 additions & 108 deletions R/PMFortranConfig.R

This file was deleted.

41 changes: 25 additions & 16 deletions R/PM_fit.R
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
#' @title
#' Object to define and run a model and data in Pmetrics
#'
#' @description
#'
#' @description
#' `PM_fit` objects comprise a `PM_data` and `PM_model` object ready for analysis
#'
#' @details
#'
#' @details
#' Data and model objects can be previously created as [PM_data] or [PM_model] objects,
#' or created on the fly when making a new PM_fit object. PM_fit objects contain
#' methods to cross-check data and model objects for compatibility, as well as to
#' methods to cross-check data and model objects for compatibility, as well as to
#' run the analysis.
#' @export

Expand All @@ -19,7 +19,7 @@ PM_fit <- R6::R6Class("PM_fit",
#' @param data Either the name of a [PM_data]
#' object in memory or the quoted name of a Pmetrics
#' data file in the current working directory, which will crate a `PM_data`
#' object on the fly. However, if created on the fly, this object
#' object on the fly. However, if created on the fly, this object
#' will not be available to other
#' methods or other instances of `PM_fit`.
#' @param model Similarly, this is either the name of a [PM_model]
Expand All @@ -44,28 +44,36 @@ PM_fit <- R6::R6Class("PM_fit",
#' @description Fit the model to the data
#' @param ... Other arguments passed to [NPrun]
#' @param engine "NPAG" (default) or "IT2B"
run = function(..., engine = "NPAG") {
#' @param rundir This argument specifies an *existing* folder that will store the run inside.
run = function(..., engine = "NPAG", rundir = getwd()) {
wd <- getwd()
if (!dir.exists(rundir)) {
stop("You have specified a directory that does not exist, please create it first.")
}
setwd(rundir)
engine <- tolower(engine)
if (inherits(private$model, "PM_model_legacy")) {
cat(sprintf("Runing Legacy"))
if(engine=="npag"){
if (engine == "npag") {
Pmetrics::NPrun(private$model$legacy_file_path, private$data$standard_data, ...)
} else if(engine=="it2b") {
} else if (engine == "it2b") {
Pmetrics::ITrun(private$model$legacy_file_path, private$data$standard_data, ...)
} else{
endNicely(paste0("Unknown engine: ",engine,". \n"))
} else {
endNicely(paste0("Unknown engine: ", engine, ". \n"))
}
} else if (inherits(private$model, "PM_model_list")) {
engine <- tolower(engine)
model_path <- private$model$write(engine = engine)
cat(sprintf("Creating model file at: %s\n", model_path))
if(engine == "npag"){
if (engine == "npag") {
Pmetrics::NPrun(model_path, private$data$standard_data, ...)
} else {
Pmetrics::ITrun(model_path, private$data$standard_data, ...)
}
} else if (inherits(private$model, "PM_model_julia")) {
if(engine != "npag") {stop("Julia is only for NPAG currently.")}
if (engine != "npag") {
stop("Julia is only for NPAG currently.")
}
cat(sprintf("Runing Julia: %s-%s\n", private$data, private$model$name))
return(
julia_call(
Expand All @@ -81,6 +89,7 @@ PM_fit <- R6::R6Class("PM_fit",
)
)
}
setwd(wd)
},
#' @description
#' Save the current PM_fit object to a .rds file.
Expand All @@ -96,10 +105,10 @@ PM_fit <- R6::R6Class("PM_fit",
#' function.
#' @param file_name Name of the file to be read, the default is "PMfit.rds".
#' @return A `PM_fit` object.
load = function(file_name){
load = function(file_name) {
return(invisible())
},
#' @description
#' @description
#' Checks for errors in data and model objects and agreement between them.
check = function() {
if (inherits(private$model, "PM_model_list")) {
Expand All @@ -122,4 +131,4 @@ PM_fit <- R6::R6Class("PM_fit",
#' @export
PM_fit$load <- function(file_name = "PMfit.rds") {
readRDS(file_name)
}
}
Loading

0 comments on commit 7b33705

Please sign in to comment.