From 786f2f24d360a3ab53dc4ece50c66e813e797024 Mon Sep 17 00:00:00 2001 From: Philip Delff Date: Sat, 18 Jan 2025 15:06:45 -0500 Subject: [PATCH] documentation --- R/NMcheckData.R | 25 +++++++++++++------------ R/compareCols.R | 6 +++--- man/NMreadInits.Rd | 9 ++++++++- man/NMreadSection.Rd | 4 ++-- man/NMwriteData.Rd | 6 +++--- tests/testthat/test_compareCols.R | 17 +++++++++++++++++ 6 files changed, 46 insertions(+), 21 deletions(-) diff --git a/R/NMcheckData.R b/R/NMcheckData.R index 1edf864e..c10455ec 100644 --- a/R/NMcheckData.R +++ b/R/NMcheckData.R @@ -219,30 +219,31 @@ NMcheckData <- function(data,file,covs,covs.occ,cols.num,col.id="ID", ADDL <- NULL AMT <- NULL CMT <- NULL + column <- NULL + check <- NULL + checkTimeInc <- NULL + cov <- NULL ## DV <- NULL EVID <- NULL ID.jump <- NULL ## ID <- NULL II <- NULL + isnewID <- NULL + level <- NULL MDVDV <- NULL MDV <- NULL - N <- NULL + newID <- NULL + NidByUID <- NULL + Nids <- NULL Nrep <- NULL + Nrows <- NULL + NUID <- NULL + occ <- NULL RATE <- NULL + reset <- NULL ROW <- NULL SS <- NULL - column <- NULL - check <- NULL - checkTimeInc <- NULL - cov <- NULL - newID <- NULL - isnewID <- NULL - level <- NULL - occ <- NULL - reset <- NULL variable <- NULL - NUID <- NULL - NidByUID <- NULL usubjNotUnique <- NULL ### Section end: Dummy variables, only not to get NOTE's in pacakge checks diff --git a/R/compareCols.R b/R/compareCols.R index 12f1eabd..374e2702 100644 --- a/R/compareCols.R +++ b/R/compareCols.R @@ -183,7 +183,7 @@ compareCols <- function(...,list.data,keep.names=TRUE,test.equal=FALSE,diff.only res.dims <- dims(list.data=dots) message("Dimensions:") - print(as.fun(res.dims)) + message(print(as.fun(res.dims))) } if(nrow(dt.cols)==0&&ndots==1){ @@ -193,12 +193,12 @@ compareCols <- function(...,list.data,keep.names=TRUE,test.equal=FALSE,diff.only } else { if(diff.only){ message("\nColumns that differ:") - print(as.fun(dt.cols)) + message(print(as.fun(dt.cols))) message() messageWrap(paste0("\nColumns where no differences were found: ",paste(dt.cols.full[nu==1&n==ndots,column],collapse=", "),"."),fun.msg=message) } else { message("\nOverview of all columns:") - print(as.fun(dt.cols)) + message(print(as.fun(dt.cols))) } } return(invisible(as.fun(dt.cols))) diff --git a/man/NMreadInits.Rd b/man/NMreadInits.Rd index 9f2fdc09..e2eb47c1 100644 --- a/man/NMreadInits.Rd +++ b/man/NMreadInits.Rd @@ -16,7 +16,14 @@ or "sigma". Default is those three.} \item{as.fun}{See ?NMscanData} } +\value{ +By default (when \code{return="pars"}, a parameter table + with initial values, FIX, lower and upper bounds etc. In most + cases, that is what is needed to derive information about + parameter definitions. If \code{return="all"}, two additional + tables are returned which can be used if the aim is to modify + and write the resulting parameters to a control stream. +} \description{ Tabulate information from parameter sections in control streams } -\keyword{internal} diff --git a/man/NMreadSection.Rd b/man/NMreadSection.Rd index 8ff211cb..be38cc48 100644 --- a/man/NMreadSection.Rd +++ b/man/NMreadSection.Rd @@ -94,9 +94,9 @@ suitable for the results part too. } \section{Functions}{ \itemize{ -\item \code{NMgetSection}: Deprecated function name. Use NMreadSection. -}} +\item \code{NMgetSection()}: Deprecated function name. Use NMreadSection. +}} \examples{ NMreadSection(system.file("examples/nonmem/xgxr001.lst", package="NMdata"),section="DATA") diff --git a/man/NMwriteData.Rd b/man/NMwriteData.Rd index 742ed98d..906d4d81 100644 --- a/man/NMwriteData.Rd +++ b/man/NMwriteData.Rd @@ -17,7 +17,7 @@ NMwriteData( quiet, args.NMgenText, csv.trunc.as.nm = FALSE, - genText = TRUE, + genText, save = TRUE, write.csv, write.rds, @@ -88,8 +88,8 @@ columns of non-numeric class like character and factor for post-processing.} \item{genText}{Run and report results of NMgenText? Default is -TRUE. You may want to disable this if data set is not for -Nonmem.} +`TRUE` if a csv file is written, otherwise `FALSE`. You may +want to disable this if data set is not for Nonmem.} \item{save}{Save defined files? Default is TRUE. If a variable is used to control whether a script generates outputs (say diff --git a/tests/testthat/test_compareCols.R b/tests/testthat/test_compareCols.R index 4adc20bd..ac1c2ca9 100644 --- a/tests/testthat/test_compareCols.R +++ b/tests/testthat/test_compareCols.R @@ -120,3 +120,20 @@ test_that("list.data",{ expect_equal(res1,res2) }) + +test_that("basic - not quiet",{ + + fileRef <- "testReference/compareCols_06.rds" + + pk <- readRDS(file=system.file("examples/data/xgxr2.rds",package="NMdata")) + + pk.reduced <- pk[1:(.N%/%2)] + pk.reduced[,CYCLE:=NULL] + pk.reduced[,AMT:=as.character(AMT)] + + + suppressMessages(res1 <- compareCols(pk,pk.reduced,quiet=FALSE)) + + expect_equal_to_reference(res1,fileRef) + +})