diff --git a/DESCRIPTION b/DESCRIPTION index 280127d1..c24d3ac6 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -17,9 +17,9 @@ Description: Parametric and non-parametric which used to be available on CRAN. Authors@R: person("Michael", "Neely", email = "mneely@usc.edu", role = c("aut", "cre")) -Version: 1.9.6 +Version: 1.9.7 URL: http://www.lapk.org -Date: 2020-06-09 +Date: 2020-06-12 Depends: R (>= 3.5.0) Imports: diff --git a/NAMESPACE b/NAMESPACE index 81359027..3bc1ab43 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -86,8 +86,8 @@ export(setPMoptions) export(ss.PK) export(update_gfortran) importFrom(base64enc,base64decode) -importFrom(dplyr,arrange) importFrom(cubelyr,as.tbl_cube) +importFrom(dplyr,arrange) importFrom(dplyr,filter) importFrom(dplyr,mutate) importFrom(dplyr,select) diff --git a/R/PMutilities.R b/R/PMutilities.R index 82c5f027..fea4fadc 100644 --- a/R/PMutilities.R +++ b/R/PMutilities.R @@ -2005,7 +2005,7 @@ getOSname <- function() { # check for installed packages -------------------------------------------- -checkRequiredPackages <- function(pkg) { +checkRequiredPackages <- function(pkg, repos="CRAN") { managePkgs <- function(thisPkg) { # if (length(grep(thisPkg, installed.packages()[, 1])) == 0) { @@ -2014,7 +2014,12 @@ checkRequiredPackages <- function(pkg) { if (requireNamespace(thisPkg, quietly = T)) { return("ok") #package is installed } else { #package is not installed - install.packages(thisPkg, dependencies = T, quiet = T) #try to install + cat(paste0("The package ",thisPkg," is required and will be installed.\n")) + if(repos == "CRAN"){ + install.packages(thisPkg, dependencies = T, quiet = T) #try to install + }else{ + devtools::install_github(repos) + } if (requireNamespace(thisPkg, quietly = T)){ #check again return("ok") #now it is installed and ok } else {return(thisPkg) } #nope, still didn't install diff --git a/R/makeValid.R b/R/makeValid.R index 9d3b01b6..326e15c7 100644 --- a/R/makeValid.R +++ b/R/makeValid.R @@ -427,25 +427,28 @@ makeValid <- function(run,input=1,outeq=1,tad=F,binCov,doseC,timeC,tadC,...){ #NPDE -------------------------------------------------------------------- #temporarily disable NPDE until we can clean code 3/9/2020 - npdeRes <- NA - - # #prepare data for npde - # obs <- tempDF[tempDF$icen=="mean",c("id","time","obs")] - # - # #remove missing obs - # obs <- obs[obs$obs!=-99,] - # names(obs)[3] <- "out" - # - # simobs <- simFull$obs - # #remove missing simulations - # simobs <- simobs[simobs$out!=-99,] - # simobs$id <- rep(obs$id,each=nsim) - # - # #get NPDE - # assign("thisobs",obs,pos=1) - # assign("thissim",simobs,pos=1) - # npdeRes <- tryCatch(autonpde(namobs=thisobs,namsim=thissim,1,2,3,verbose=T),error=function(e) e) - # + #npdeRes <- NA + + #get npde from github + checkRequiredPackages("npde", repos = "LAPKB/npde") + + #prepare data for npde + obs <- tempDF[tempDF$icen=="mean",c("id","time","obs")] + + #remove missing obs + obs <- obs[obs$obs!=-99,] + names(obs)[3] <- "out" + + simobs <- simFull$obs + #remove missing simulations + simobs <- simobs[simobs$out!=-99,] + simobs$id <- rep(obs$id,each=nsim) + + #get NPDE + assign("thisobs",obs,pos=1) + assign("thissim",simobs,pos=1) + npdeRes <- tryCatch(npde::autonpde(namobs=thisobs,namsim=thissim,1,2,3,verbose=T),error=function(e) e) + diff --git a/R/plotPMvalid.R b/R/plotPMvalid.R index 74ba80ca..d3f17fc2 100644 --- a/R/plotPMvalid.R +++ b/R/plotPMvalid.R @@ -159,9 +159,10 @@ plot.PMvalid <- function(x,type="vpc",tad=F,icen="median",outeq=1,lower=0.025,up } if(type=="npde"){ - cat("NPDE temporarily disabled pending code cleaning.\n") - # plot(x$npde) - # par(mfrow=c(1,1)) + #cat("NPDE temporarily disabled pending code cleaning.\n") + if(is.null(x$npde)) stop("No npde object found. Re-run makeValid.\n") + plot(x$npde) + par(mfrow=c(1,1)) } } diff --git a/inst/NEWS.Rd b/inst/NEWS.Rd index 5413bc95..6e638313 100644 --- a/inst/NEWS.Rd +++ b/inst/NEWS.Rd @@ -1,5 +1,34 @@ \name{NEWS} \title{NEWS file for the Pmetrics package} +\section{Changes in version 1.9.7}{ + +\subsection{NEW FEATURES}{ +\itemize{ +\item Restored npde function by creating new git npde repository +} +} +\subsection{BUG FIXES}{ +\itemize{ +\item None +} +} +} + + +\section{Changes in version 1.9.6}{ + +\subsection{NEW FEATURES}{ +\itemize{ +\item None +} +} +\subsection{BUG FIXES}{ +\itemize{ +\item Fixed error in makePost associated with conversion to tidyverse handling +} +} +} + \section{Changes in version 1.9.5}{