9

When i use a package named HydroMe to fit a model, some data groups will return the following errors:

Error in qr.default(.swts * attr(rhs, "gradient")) : 
 NA/NaN/Inf in foreign function call (arg 1)

Actually,there is no missing value in the data groups. the codes are as followed:

library(HydroMe)
fortst<-read.csv(file="F:/fortst.csv")
van.lis <-nlsList(y~SSvan(x,Thr, Ths, alp, scal)|Sample,data=fortst)

the example data canbe download from here:

http://www.fileden.com/files/2012/9/13/3346981/fortst.csv
Ma Changchen
  • 115
  • 1
  • 1
  • 6

2 Answers2

3

The variables Thr, Ths, alp, and scal are not in your data frame or in fortst.csv. Thus, when they're referred to in the y~SSvan(x,Thr, Ths, alp, scal)|Sample formula, they're NA.

David Robinson
  • 77,383
  • 16
  • 167
  • 187
  • while,in fact,Thr,Ths,alp and scal are just what i want to get through this process.x and y are in my data frame and were referred in this formula. Another data with the similar structure perform well.Such as the following data. – Ma Changchen Sep 15 '12 at 06:04
2

One reason for this error could be that the variable defined in your data frame is different from their actual data type. for eg you define 'Char' for 'Date' vaiable .

Nim J
  • 993
  • 2
  • 9
  • 15