growthcurver
growthcurver copied to clipboard
Error in UseMethod("predict")
Hello, when running the code it is looping through my data to remove the blank and I get this error Error in UseMethod("predict") : no applicable method for 'predict' applied to an object of class "character" I use background correction option 2 for my data. During my trouble shooting I have noticed that when I change the trim at time parameter the column at which the error occurs changes too. For example, when I try to have it read through all my data at time 293600 it only reads through 7 columns of 97. I have also tried changing the time to 243600 and that time it only calculated through n=2. What advice do you recommend in solving the problem? Is it related to the time trimming or something else?
Hi, for me the the problem occured when curve prediction was not possible and therefore gc_fit$model ended up just containing "". I fixed the issue by adding an if condition before plotting the lines, allowing is just to plot the data when curve prediction is not possible
a <- is.character(gc_fit$model) if (a == 'TRUE') {lines(gc_fit$data$t)} else {lines(gc_fit$data$t, predict(gc_fit$model), col = "red")