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/drdata.R | |
parent | 5de108a65125a443d12bff7fbbde946ffa92f644 (diff) |
Maintenance changes for the release of 0.6.4v0.6.4
Diffstat (limited to 'R/drdata.R')
-rw-r--r-- | R/drdata.R | 16 |
1 files changed, 10 insertions, 6 deletions
@@ -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.") + } } |