From ee0075c98998e42eef031cd41ed8f8bb403b47ed Mon Sep 17 00:00:00 2001 From: ranke Date: Mon, 2 Jan 2006 23:27:32 +0000 Subject: A fix for a bug that kept drplot from plotting if no control data are present in the dose-response data frame. git-svn-id: http://kriemhild.uft.uni-bremen.de/svn/drfit@55 d1b72e20-2ee0-0310-a1c4-ad5adbbefcdc --- R/drfit.R | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/R/drfit.R b/R/drfit.R index ac3ad3e..9eee87a 100644 --- a/R/drfit.R +++ b/R/drfit.R @@ -34,7 +34,6 @@ drdata <- function(substances, experimentator = "%", db = "cytotox", odbcClose(channel) names(data)[[1]] <- "dose" names(data)[[2]] <- "response" - data$dosefactor <- factor(data$dose) data$substance <- factor(data$substance,levels=substances) return(data) } @@ -308,9 +307,9 @@ drplot <- function(drresults, data, nonzerodata$substance <- factor(nonzerodata$substance) # Get rid of pseudo substance names of controls zerodata <- subset(data,dose==0) nc <- length(zerodata$dose) # Number of control points - sdc <- sd(zerodata$response) # Standard deviation of control responses - controlconf <- sdc * qt((1 + alpha)/2, nc - 1) / sqrt(nc) if (nc > 0) { + sdc <- sd(zerodata$response) # Standard deviation of control responses + controlconf <- sdc * qt((1 + alpha)/2, nc - 1) / sqrt(nc) cat("There are ",nc,"data points with dose 0 (control values)\n") cat("with a standard deviation of",sdc,"\n") cat("and a confidence interval of",controlconf,"\n") -- cgit v1.2.1