From cc66ea8e99f809c53cb5a23430b814f68efdb126 Mon Sep 17 00:00:00 2001 From: Johannes Ranke Date: Wed, 7 Oct 2015 17:19:21 +0200 Subject: Maintenance changes for the release of 0.6.4 --- ChangeLog | 7 +++++++ DESCRIPTION | 32 +++++++++++++++++--------------- NAMESPACE | 8 +------- R/checkexperiment.R | 14 +++++++++----- R/checksubstance.R | 10 +++++++--- R/drdata.R | 16 ++++++++++------ 6 files changed, 51 insertions(+), 36 deletions(-) diff --git a/ChangeLog b/ChangeLog index c29f20a..4ccb21e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2015-10-07 Johannes Ranke + + * Suggest RODBC instead of depending on it, as it is not available + on all CRAN check systems. + + * Adress various NOTES given by R CMD check + 2014-07-28 Johannes Ranke * DESCRIPTION: New verson 0.6.3 diff --git a/DESCRIPTION b/DESCRIPTION index d45a28e..c98693e 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,25 +1,27 @@ Package: drfit Version: 0.6.4 -Date: 2015-07-02 -Title: Dose-response data evaluation +Date: 2015-10-07 +Title: Dose-Response Data Evaluation Authors@R: c(person("Johannes", "Ranke", role = c("aut", "cre"), email = "jranke@uni-bremen.de")) -Imports: graphics, grDevices, MASS, RODBC, drc -Description: drfit provides basic and easy-to-use functions for fitting - dose-response curves to dose-response data, calculating some - (eco)toxicological parameters and plotting the results. Functions that are - fitted are the cumulative density function of the lognormal distribution - (probit fit), of the logistic distribution (logit fit), of the weibull - distribution (weibull fit) and a linear-logistic model ("linlogit" fit), - derived from the latter, which is used to describe data showing stimulation - at low doses (hormesis). In addition, functions checking, plotting and - retrieving dose-response data retrieved from a database accessed via RODBC - are included. As an alternative to the original fitting methods, the - algorithms from the drc package can be used. +Imports: graphics, grDevices, MASS, drc +Suggests: RODBC +Description: A somewhat outdated package of basic and easy-to-use functions for + fitting dose-response curves to continuous dose-response data, calculating some + (eco)toxicological parameters and plotting the results. Please consider using + the more powerful and actively developed 'drc' package. Functions that are + fitted are the cumulative density function of the lognormal distribution + (probit fit), of the logistic distribution (logit fit), of the weibull + distribution (weibull fit) and a linear-logistic model ("linlogit" fit), + derived from the latter, which is used to describe data showing stimulation at + low doses (hormesis). In addition, functions checking, plotting and retrieving + dose-response data retrieved from a database accessed via RODBC are included. + As an alternative to the original fitting methods, the algorithms from the drc + package can be used. Encoding: latin1 License: GPL (>= 2) LazyLoad: yes LazyData: yes URL: http://www.r-project.org, http://www.uft.uni-bremen.de/chemie/ranke?page=drfit, - http://kriemhild.uft.uni-bremen.de/viewcvs/?root=drfit + http://cgit.jrwb.de/drfit/ diff --git a/NAMESPACE b/NAMESPACE index e2772d7..91a4d4a 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -1,16 +1,10 @@ -# Default NAMESPACE created by R -# Remove the previous line if you edit this file - -# Export all names exportPattern(".") -# Import all packages listed as Imports or Depends import( graphics, grDevices, stats, - MASS, - RODBC + MASS ) importFrom("drc", drm, ED, LN.2, LL.2, BC.4, W1.2) diff --git a/R/checkexperiment.R b/R/checkexperiment.R index 2bf0ce7..8c2f472 100644 --- a/R/checkexperiment.R +++ b/R/checkexperiment.R @@ -9,7 +9,11 @@ checkexperiment <- function(id, db = "ecotox", endpoint = "%") if (!(db %in% rownames(databases))) stop("Database is not supported") - channel <- odbcConnect(db,uid="cytotox",pwd="cytotox",case="tolower") + if (requireNamespace("RODBC")) { + channel <- RODBC::odbcConnect(db, uid="cytotox", pwd="cytotox", case="tolower") + } else { + stop("For this function, the RODBC package has to be installed and configured.") + } responsename = as.character(databases[db,1]) @@ -19,7 +23,7 @@ checkexperiment <- function(id, db = "ecotox", endpoint = "%") exptable <- paste(exptype, "s", sep="") commentquery <- paste("SELECT comment FROM ", exptable , " WHERE ", exptype, " = ", id) - commentdata <- sqlQuery(channel,commentquery) + commentdata <- RODBC::sqlQuery(channel,commentquery) comment <- as.character(commentdata[[1]]) expquery <- paste("SELECT experimentator,substance, ", @@ -32,15 +36,15 @@ checkexperiment <- function(id, db = "ecotox", endpoint = "%") endpoint, "'", sep = "") } - expdata <- sqlQuery(channel,expquery) + expdata <- RODBC::sqlQuery(channel,expquery) if (db %in% c("cytotox","enzymes")) { controlquery <- paste("SELECT type,response FROM controls WHERE plate=",id) - controldata <- sqlQuery(channel,controlquery) + controldata <- RODBC::sqlQuery(channel,controlquery) } - odbcClose(channel) + RODBC::odbcClose(channel) op <- par(ask=TRUE) on.exit(par(op)) diff --git a/R/checksubstance.R b/R/checksubstance.R index b50c3da..3e07f92 100644 --- a/R/checksubstance.R +++ b/R/checksubstance.R @@ -11,7 +11,11 @@ checksubstance <- function(substance, db = "cytotox", experimentator = "%", if (!(db %in% rownames(databases))) stop("Database is not supported") - channel <- odbcConnect(db,uid="cytotox",pwd="cytotox",case="tolower") + if (requireNamespace("RODBC")) { + channel <- RODBC::odbcConnect(db, uid="cytotox", pwd="cytotox", case="tolower") + } else { + stop("For this function, the RODBC package has to be installed and configured.") + } responsename = as.character(databases[db,1]) testtype = as.character(databases[db,2]) @@ -41,8 +45,8 @@ checksubstance <- function(substance, db = "cytotox", experimentator = "%", endpoint, "'", sep = "") } - data <- sqlQuery(channel,query) - odbcClose(channel) + data <- RODBC::sqlQuery(channel,query) + RODBC::odbcClose(channel) if (length(data$experimentator) < 1) { stop(paste("\nNo response data for",substance,"in database", diff --git a/R/drdata.R b/R/drdata.R index 15c61ac..0bf9597 100644 --- a/R/drdata.R +++ b/R/drdata.R @@ -1,9 +1,10 @@ drdata <- function(substances, experimentator = "%", db = "cytotox", - celltype="IPC-81",enzymetype="AChE", - organism="Vibrio fischeri",endpoint="Luminescence",whereClause="1", - ok="'ok','no fit'") + celltype = "IPC-81", enzymetype = "AChE", + organism = "Vibrio fischeri", endpoint = "Luminescence", whereClause = "1", + ok = "'ok','no fit'") { - channel <- odbcConnect(db,uid="cytotox",pwd="cytotox",case="tolower") + if (requireNamespace("RODBC")) { + channel <- RODBC::odbcConnect(db,uid="cytotox",pwd="cytotox",case="tolower") slist <- paste(substances,collapse="','") if (db == "cytotox") { responsetype <- "viability" @@ -29,10 +30,13 @@ drdata <- function(substances, experimentator = "%", db = "cytotox", whereClause," AND ok in (", ok,")",sep="") if (db == "ecotox") query <- paste(query," AND type LIKE '",endpoint,"'",sep="") - data <- sqlQuery(channel,query) - odbcClose(channel) + data <- RODBC::sqlQuery(channel,query) + RODBC::odbcClose(channel) names(data)[[1]] <- "dose" names(data)[[2]] <- "response" data$substance <- factor(data$substance,levels=substances) return(data) + } else { + stop("For this function, the RODBC package has to be installed and configured.") + } } -- cgit v1.2.1