From 8596a3e82235385b5de50cc5a722ccb68247f084 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 7 Apr 2021 11:38:05 +0200 Subject: Argument 'legend_x' for 'calplot' Also, keep check and test logs in the repository. --- .Rbuildignore | 2 ++ DESCRIPTION | 4 ++-- GNUmakefile | 5 ++-- NEWS.md | 4 ++++ R/calplot.R | 14 +++++++---- build.log | 3 ++- check.log | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ man/calplot.lm.Rd | 6 ++++- test.log | 13 ++++++++++ 9 files changed, 112 insertions(+), 11 deletions(-) create mode 100644 check.log create mode 100644 test.log diff --git a/.Rbuildignore b/.Rbuildignore index 5491af5..3115cf6 100644 --- a/.Rbuildignore +++ b/.Rbuildignore @@ -1,8 +1,10 @@ GNUmakefile build.log$ +check.log$ chemCal_.*.tar.gz docs _pkgdown.yml README.html .travis.yml experimental +test.log$ diff --git a/DESCRIPTION b/DESCRIPTION index cacf80c..8858e19 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: chemCal -Version: 0.2.2 -Date: 2018-07-21 +Version: 0.2.3 +Date: 2021-04-07 Title: Calibration Functions for Analytical Chemistry Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre", "cph"), email = "jranke@uni-bremen.de", diff --git a/GNUmakefile b/GNUmakefile index 7992c5e..9eee6b9 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -37,7 +37,7 @@ install: build "$(RBIN)/R" CMD INSTALL $(TGZ) check: build - "$(RBIN)/R" CMD check --as-cran $(TGZ) + "$(RBIN)/R" CMD check --as-cran $(TGZ) 2>&1 | tee check.log vignettes/%.html: vignettes/%.Rmd vignettes/refs.bib "$(RBIN)/Rscript" -e "tools::buildVignette(file = 'vignettes/$*.Rmd', dir = 'vignettes')" @@ -56,7 +56,8 @@ winbuilder: build curl -T $(TGZ) ftp://anonymous@win-builder.r-project.org/R-devel/ test: install - NOT_CRAN=true "$(RBIN)/Rscript" -e 'devtools::test()' + NOT_CRAN=true "$(RBIN)/Rscript" -e 'devtools::test()' 2>&1 | tee test.log + sed -i -e "s/\r.*\r//" test.log clean: $(RM) -r vignettes/*_cache diff --git a/NEWS.md b/NEWS.md index 04c75b2..dee859d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# chemCal 0.2.3 + +- 'calplot' gains an argument 'legend_x' for better control of the legend position + # chemCal 0.2.2 - Added the cadmium dataset from Rocke and Lorenzato (1995) diff --git a/R/calplot.R b/R/calplot.R index 6aed9c0..fd49a54 100644 --- a/R/calplot.R +++ b/R/calplot.R @@ -1,7 +1,8 @@ calplot <- function(object, xlim = c("auto", "auto"), ylim = c("auto", "auto"), - xlab = "Concentration", ylab = "Response", alpha = 0.05, - varfunc = NULL) + xlab = "Concentration", ylab = "Response", + legend_x = "auto", + alpha = 0.05, varfunc = NULL) { UseMethod("calplot") } @@ -9,6 +10,7 @@ calplot <- function(object, calplot.default <- function(object, xlim = c("auto","auto"), ylim = c("auto","auto"), xlab = "Concentration", ylab = "Response", + legend_x = "auto", alpha=0.05, varfunc = NULL) { stop("Calibration plots only implemented for univariate lm objects.") @@ -16,8 +18,9 @@ calplot.default <- function(object, calplot.lm <- function(object, xlim = c("auto","auto"), ylim = c("auto","auto"), - xlab = "Concentration", ylab = "Response", alpha=0.05, - varfunc = NULL) + xlab = "Concentration", ylab = "Response", + legend_x = "auto", + alpha=0.05, varfunc = NULL) { if (length(object$coef) > 2) stop("More than one independent variable in your model - not implemented") @@ -47,6 +50,7 @@ calplot.lm <- function(object, yrange.auto <- range(c(0,pred.lim)) if (ylim[1] == "auto") ylim[1] <- yrange.auto[1] if (ylim[2] == "auto") ylim[2] <- yrange.auto[2] + if (legend_x[1] == "auto") legend_x <- min(object$model[[2]]) plot(1, type = "n", xlab = xlab, @@ -68,7 +72,7 @@ calplot.lm <- function(object, } else { matlines(newdata[[1]], conf.lim, lty = c(1, 3, 3), col = c("black", "green4", "green4")) - legend(min(x), + legend(legend_x, max(pred.lim, na.rm = TRUE), legend = c("Fitted Line", "Confidence Bands", "Prediction Bands"), diff --git a/build.log b/build.log index 738bec1..2fe8e6c 100644 --- a/build.log +++ b/build.log @@ -5,5 +5,6 @@ * creating vignettes ... OK * checking for LF line-endings in source and make files and shell scripts * checking for empty or unneeded directories -* building ‘chemCal_0.2.2.tar.gz’ +* re-saving image files +* building ‘chemCal_0.2.3.tar.gz’ diff --git a/check.log b/check.log new file mode 100644 index 0000000..bb10d21 --- /dev/null +++ b/check.log @@ -0,0 +1,72 @@ +* using log directory ‘/home/jranke/git/chemCal/chemCal.Rcheck’ +* using R version 4.0.5 (2021-03-31) +* using platform: x86_64-pc-linux-gnu (64-bit) +* using session charset: UTF-8 +* using option ‘--as-cran’ +* checking for file ‘chemCal/DESCRIPTION’ ... OK +* this is package ‘chemCal’ version ‘0.2.3’ +* package encoding: UTF-8 +* checking CRAN incoming feasibility ... Note_to_CRAN_maintainers +Maintainer: ‘Johannes Ranke ’ +* checking package namespace information ... OK +* checking package dependencies ... OK +* checking if this is a source package ... OK +* checking if there is a namespace ... OK +* checking for executable files ... OK +* checking for hidden files and directories ... OK +* checking for portable file names ... OK +* checking for sufficient/correct file permissions ... OK +* checking serialization versions ... OK +* checking whether package ‘chemCal’ can be installed ... OK +* checking installed package size ... OK +* checking package directory ... OK +* checking for future file timestamps ... OK +* checking ‘build’ directory ... OK +* checking DESCRIPTION meta-information ... OK +* checking top-level files ... OK +* checking for left-over files ... OK +* checking index information ... OK +* checking package subdirectories ... OK +* checking R files for non-ASCII characters ... OK +* checking R files for syntax errors ... OK +* checking whether the package can be loaded ... OK +* checking whether the package can be loaded with stated dependencies ... OK +* checking whether the package can be unloaded cleanly ... OK +* checking whether the namespace can be loaded with stated dependencies ... OK +* checking whether the namespace can be unloaded cleanly ... OK +* checking loading without being on the library search path ... OK +* checking use of S3 registration ... OK +* checking dependencies in R code ... OK +* checking S3 generic/method consistency ... OK +* checking replacement functions ... OK +* checking foreign function calls ... OK +* checking R code for possible problems ... OK +* checking Rd files ... OK +* checking Rd metadata ... OK +* checking Rd line widths ... OK +* checking Rd cross-references ... OK +* checking for missing documentation entries ... OK +* checking for code/documentation mismatches ... OK +* checking Rd \usage sections ... OK +* checking Rd contents ... OK +* checking for unstated dependencies in examples ... OK +* checking contents of ‘data’ directory ... OK +* checking data for non-ASCII characters ... OK +* checking data for ASCII and uncompressed saves ... OK +* checking installed files from ‘inst/doc’ ... OK +* checking files in ‘vignettes’ ... OK +* checking examples ... OK +* checking for unstated dependencies in ‘tests’ ... OK +* checking tests ... + Running ‘testthat.R’ + OK +* checking for unstated dependencies in vignettes ... OK +* checking package vignettes in ‘inst/doc’ ... OK +* checking re-building of vignette outputs ... OK +* checking PDF version of manual ... OK +* checking for non-standard things in the check directory ... OK +* checking for detritus in the temp directory ... OK +* DONE + +Status: OK + diff --git a/man/calplot.lm.Rd b/man/calplot.lm.Rd index 734e696..39f20de 100644 --- a/man/calplot.lm.Rd +++ b/man/calplot.lm.Rd @@ -9,7 +9,8 @@ } \usage{ calplot(object, xlim = c("auto", "auto"), ylim = c("auto", "auto"), - xlab = "Concentration", ylab = "Response", alpha=0.05, varfunc = NULL) + xlab = "Concentration", ylab = "Response", legend_x = "auto", + alpha=0.05, varfunc = NULL) } \arguments{ \item{object}{ @@ -29,6 +30,9 @@ \item{ylab}{ The label of the y axis. } + \item{legend_x}{ + An optional numeric value for adjusting the x coordinate of the legend. + } \item{alpha}{ The error tolerance level for the confidence and prediction bands. Note that this includes both tails of the Gaussian distribution, unlike the alpha and beta parameters diff --git a/test.log b/test.log new file mode 100644 index 0000000..1da1e42 --- /dev/null +++ b/test.log @@ -0,0 +1,13 @@ +Loading chemCal +Testing chemCal +✔ | OK F W S | Context +✔ | 16 | Compare with investr::calibrate [0.2 s] +✔ | 5 | Known results for the dataset provided in DIN 32645 +✔ | 15 | Inverse predictions +✔ | 8 | LOD and LOQ +✔ | 10 | Known results for the example datasets provided by Massart (1997) + +══ Results ═════════════════════════════════════════════════════════════════════ +Duration: 0.4 s + +[ FAIL 0 | WARN 0 | SKIP 0 | PASS 54 ] -- cgit v1.2.1