diff options
| author | Johannes Ranke <jranke@uni-bremen.de> | 2015-10-07 17:19:21 +0200 | 
|---|---|---|
| committer | Johannes Ranke <jranke@uni-bremen.de> | 2015-10-07 17:19:21 +0200 | 
| commit | cc66ea8e99f809c53cb5a23430b814f68efdb126 (patch) | |
| tree | 5bfd2ce2608560ffa399b7761003de14a0ede1de /R | |
| parent | 5de108a65125a443d12bff7fbbde946ffa92f644 (diff) | |
Maintenance changes for the release of 0.6.4v0.6.4
Diffstat (limited to 'R')
| -rw-r--r-- | R/checkexperiment.R | 14 | ||||
| -rw-r--r-- | R/checksubstance.R | 10 | ||||
| -rw-r--r-- | R/drdata.R | 16 | 
3 files changed, 26 insertions, 14 deletions
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", @@ -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.") +  }  }  | 
