aboutsummaryrefslogtreecommitdiff
path: root/R
diff options
context:
space:
mode:
Diffstat (limited to 'R')
-rw-r--r--R/checkexperiment.R16
-rw-r--r--R/checkplate.R1
2 files changed, 9 insertions, 8 deletions
diff --git a/R/checkexperiment.R b/R/checkexperiment.R
index 7fa1a60..865d678 100644
--- a/R/checkexperiment.R
+++ b/R/checkexperiment.R
@@ -1,7 +1,7 @@
utils::globalVariables(c("type", "conc", "substance"))
-checkexperiment <- function(id,
- db = c("ecotox", "cytotox", "enzymes"),
+checkexperiment <- function(id,
+ db = c("ecotox", "cytotox", "enzymes"),
endpoint = "%")
{
db = match.arg(db)
@@ -27,13 +27,14 @@ checkexperiment <- function(id,
comment <- as.character(commentdata[[1]])
expquery <- paste0("SELECT ",
- "experimentator, substance, ", testtype, ", conc, unit,", responsename, ",
- type, raw_0, duration, performed, ok ",
+ "experimentator, substance, ", testtype, ", conc, unit, ", responsename, ", ",
+ if (db == "ecotox") "type, raw_0, duration, ",
+ "performed, ok ",
"FROM ", db, " ",
"WHERE ", exptype, "=", id)
if (db == "ecotox") {
- expquery <- paste0(expquery, " AND type LIKE '", endpoint, "'")
+ expquery <- paste0(expquery, " AND type LIKE '", endpoint, "'")
}
expdata <- dbGetQuery(con, expquery)
@@ -61,7 +62,7 @@ checkexperiment <- function(id,
} else {
# Use raw response for ecotox
expdata$response <- expdata$raw_response
-
+
if (nlevels(expdata$type) > 1) {
message("There are data for more than one type of raw response in your data.\n",
"The types are ", paste(levels(expdata$type), collapse = " and "), ".\n",
@@ -168,8 +169,7 @@ checkexperiment <- function(id,
lld <- log10(min(subset(drdata,conc!=0)$conc))
lhd <- log10(max(drdata$conc))
- ylab <- if (db == "ecotox") endpoint
- else responsename
+ ylab <- if (db == "ecotox") endpoint else responsename
plot(1,type="n",
xlim = c(lld - 0.5, lhd + 2),
diff --git a/R/checkplate.R b/R/checkplate.R
index 1421179..d66e1be 100644
--- a/R/checkplate.R
+++ b/R/checkplate.R
@@ -1,4 +1,5 @@
checkplate <- function(id, db = c("cytotox", "enzymes"))
{
+ db <- match.arg(db)
checkexperiment(id, db = db)
}

Contact - Imprint