Search code examples
rdrc

Error in drc "Error in parmVec[3] - respl : non-numeric argument to binary operator"


I am pretty new to using R. I am currently trying to use drc in order to run a 4PL curve to analyze ELISA data. I have manually input the standard data and generated the curve, but I am having trouble returning the concentrations of my sample data (DOSEx). When running the ED function, I receive the following error: "Error in parmVec[3] - respl : non-numeric argument to binary operator" This may be a simple question, any help is appreciated.

My code is as follows:

library(drc)
dat<- data.frame(Conc=rep(c(8000,3200,1280,512,204.8,81.92,32.77,0)),
                 OD=c(1.016,0.751,0.502,0.254,0.121,0.049,0.020,0))
curve<-drm(OD~Conc,
                   fct=LL.4(names=c("Slope", "Lower", "Upper", "ED50")),
                   data=dat)
plot(curve)

response<-c(CalData_12_18_20_withSampleIDR['Mean'])
DOSEx<-ED(curve,response,type="absolute",display=F)

Solution

  • Wrapping the c around a data.frame with single column doesn't create a vector. It is a list with a single element i.e.

    CalData_12_18_20_withSampleIDR['Mean']
    

    would still be a data.frame with a single column

    According to ?ED

    respLev - a numeric vector containing the response levels.

    We could use extractors $ or [[ or specify the , with [ to return as a vector if the data is originally a data.frame

    response<- CalData_12_18_20_withSampleIDR$Mean
    ED(curve, response, type = "absolute", display = FALSE)