diff options
author | Johannes Ranke <jranke@uni-bremen.de> | 2017-03-24 15:24:04 +0100 |
---|---|---|
committer | Johannes Ranke <jranke@uni-bremen.de> | 2017-03-24 15:24:04 +0100 |
commit | 22c11d5dbc118881f9cfd7c9c2ac9711295a0f16 (patch) | |
tree | a2c88069b82633027047c60bf656e53c4b561182 /R/checkexperiment.R | |
parent | b05f8438729e8070f4e0cbbf628bbbcbbe3f1a7a (diff) |
Suppress error messages in dr(c)fit, maintenance
- Checking examples fails if error messages in dr(c)fit stemming from
failed fits are printed
- Delete trailing whitespace
- Update packaging
Diffstat (limited to 'R/checkexperiment.R')
-rw-r--r-- | R/checkexperiment.R | 30 |
1 files changed, 15 insertions, 15 deletions
diff --git a/R/checkexperiment.R b/R/checkexperiment.R index b264243..b69b81f 100644 --- a/R/checkexperiment.R +++ b/R/checkexperiment.R @@ -9,7 +9,7 @@ checkexperiment <- function(id, db = "ecotox", endpoint = "%") if (!(db %in% rownames(databases))) stop("Database is not supported") - if (require("RODBC")) { + 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.") @@ -25,21 +25,21 @@ checkexperiment <- function(id, db = "ecotox", endpoint = "%") " WHERE ", exptype, " = ", id) commentdata <- RODBC::sqlQuery(channel,commentquery) comment <- as.character(commentdata[[1]]) - + expquery <- paste("SELECT experimentator,substance, ", testtype, ",conc,unit,", responsename, ",performed,ok", - " FROM ",db," WHERE ",exptype,"=", id, + " FROM ",db," WHERE ",exptype,"=", id, sep = "") if (db == "ecotox") { - expquery <- paste(expquery, " AND type LIKE '", + expquery <- paste(expquery, " AND type LIKE '", endpoint, "'", sep = "") } expdata <- RODBC::sqlQuery(channel,expquery) if (db %in% c("cytotox","enzymes")) { - controlquery <- paste("SELECT type,response FROM controls + controlquery <- paste("SELECT type,response FROM controls WHERE plate=",id) controldata <- RODBC::sqlQuery(channel,controlquery) } @@ -63,7 +63,7 @@ checkexperiment <- function(id, db = "ecotox", endpoint = "%") numberOfBlinds <- NA meanOfBlinds <- NA stdOfBlinds <- NA - + } numberOfControls <- length(controls$response) if (numberOfControls > 0) { @@ -78,7 +78,7 @@ checkexperiment <- function(id, db = "ecotox", endpoint = "%") if (length(expdata$experimentator) < 1) { stop("There is no response data for ",exptype," ", id," in database ",db,"\n") - } + } exptypestring <- paste(toupper(substring(exptype,1,1)), substring(exptype,2),sep="") expdata$experimentator <- factor(expdata$experimentator) @@ -87,7 +87,7 @@ checkexperiment <- function(id, db = "ecotox", endpoint = "%") expdata$substance <- factor(expdata$substance) expdata$unit <- factor(expdata$unit) expdata$ok <- factor(expdata$ok) - + cat("\n",exptypestring,id,"from database",db,":\n\n", "\tExperimentator(s):\t",levels(expdata$experimentator),"\n", "\tType(s):\t\t",levels(expdata$type),"\n", @@ -100,7 +100,7 @@ checkexperiment <- function(id, db = "ecotox", endpoint = "%") "\tblind\t",numberOfBlinds,"\t",meanOfBlinds,"\t",stdOfBlinds,"\n", "\tcontrol\t",numberOfControls,"\t",meanOfControls,"\t", stdOfControls,"\t\t",percentstdOfcontrols,"\n") - + if (db == "ecotox") { boxplot(controls$response, @@ -116,22 +116,22 @@ checkexperiment <- function(id, db = "ecotox", endpoint = "%") boxwex=0.4, main=paste("Plate ",id)) } - + drdata <- expdata[c(2,4,6)] drdata$substance <- factor(drdata$substance) substances <- levels(drdata$substance) - + lld <- log10(min(subset(drdata,conc!=0)$conc)) lhd <- log10(max(drdata$conc)) plot(1,type="n", - xlim=c(lld - 0.5, lhd + 2), - ylim= c(-0.1, 2), + xlim=c(lld - 0.5, lhd + 2), + ylim= c(-0.1, 2), xlab=paste("decadic logarithm of the concentration in ",levels(expdata$unit)), ylab=responsename) - + drdatalist <- split(drdata,drdata$substance) - + for (i in 1:length(drdatalist)) { points(log10(drdatalist[[i]]$conc),drdatalist[[i]][[responsename]],col=i); } |