This might be a long shot, but here goes. I performed experiments based on a Box Behnken design using R, I plugged in my HPLC data and the 3 conditions at 3 levels.
I am trying to produce response surface and contour plots from my code using R-studio. My code (more like one that's being used in the lab) is able to perform all the statistical calculations, but it gives me an error when I need it to generate the plots. Please refer to the image for the code, the next chunk (not shown in the image), this is the code is the one that gives me an error message screengrab of the code
pdf("HPLC_BB1_PR.pdf" ,paper="a4r")
for (i in 1:length(myvar)){
par(mfrow=c(2,2),cex.axis=0.4,cex.lab=0.65,cex.sub=0.7)
persp(mymodel[[i]],~x1+x2+x3,at=summary(mymodel[[i]])$canonical$xs,zlab=myvar[i],col=rainbow(100),contours="colors")
print(i)
}[enter image description here][1]
dev.off()
the Error message I get is: Error in contour.lm(x, form, at, bounds, zlim, xlabs, atpos = atpos, plot.it = FALSE) : 'at' must be a NAMED list of values used for surface slices
Any help would be greatly appreciated. I've been stuck for like a week now.