I am a beginner on R, working on water quality data. PLease excuse my formatting mistakes. I am trying to run "nls" on my dataset. Running the script:
testingQModel<-nls(GR ~ GRm * (1-Kq/Q), data = testingQ, start = list(Kq = min(testingQ$Q), GRm = max(testingQ$GR)))
I get the following error:
Warning messages: 1: In min(x) : no non-missing arguments to min; returning Inf 2: In max(x) : no non-missing arguments to max; returning -Inf
The dataset does not have NAs and is all numeric. I ran range(testingQ, na.rm = TRUE) also with range(testingQ, na.rm = FALSE) just to give it a try either way and it returned maximum and minimum values in dataset all right. I am not sure what else to try.
Look forward to a solution from someone! Thanks.
range(testingQ$Q)andrange(testingQ$GR)to see if you still get a max and min that aren'tInffor yourstart=values. I suspect that is where the problem lies. - thelatemailtestingQa data frame? - jlhowardtestingQis the data frame consisting of two columns Q and GR. Ran the scriptrange(testingQ$Q)andrange(testingQ$GR), both return[1] Inf -Inf. I have no clue though why it would be like that. I assumed it would return max and min values in respective columns. I tried plugging in initial values forGRmandKqtoo instead oftestingQ$GRetc but it returned same warning messages. Those are the two parameters I am trying to calculate the values of. I would appreciate little more help! - Learner-InftoInf. Try justtestingQ[,"Q"]and see what it returns - also checkstr(testingQ[,"Q"])andlength(testingQ[,"Q"])to see what the structure of the object is. - thelatemailError in[.data.frame(testingQ, , "Q") : undefined columns selectedwhereas a call forQreturns the column I defined asQ. Just for record, I defined Q asQ<-testingQ[,1]andGR<-testingQ[,2]. This is how I defined variables while working with different functions and it worked fine. Or maybe I was just lucky not to encounter this problem. - Learner