I am getting this error when I run my script.
Script:
secondata<-as.data.frame(data)
secondata$R <- as.factor(secondata$row)
secondata$C <- as.factor(secondata$col)
m0 <- SpATS(response = "PH", spatial = ~ SAP(col, row, nseg = c(10,20)),
genotype = "geno", random = ~ R + C,
data = secondata, control = list(tolerance = 1e-03))
pred1.m0 <- predict(m0, newdata = secondata)
> str(secondata)
Classes ‘data.table’ and 'data.frame': 397 obs. of 9 variables:
$ block : int 1 1 1 1 1 1 1 1 1 1 ...
$ geno : chr "CMED_155" "CMED_CoCheck01_ANTALIS" "CMED_303" "CMED_306" ...
$ rip : int 0 1 0 0 0 0 2 0 1 0 ...
$ row : int 1 2 3 4 5 6 7 8 9 10 ...
$ col : int 1 1 1 1 1 1 1 1 1 1 ...
$ environment: chr "Italy" "Italy" "Italy" "Italy" ...
$ PH : num 71 66 116 118 85 ...
$ R : Factor w/ 10 levels "1","2","3","4",..: 1 2 3 4 5 6 7 8 9 10 ...
$ C : Factor w/ 5 levels "1","2","3","4",..: 1 1 1 1 1 1 1 1 1 1 ...
- attr(*, ".internal.selfref")=<externalptr>
Error that I am getting:
Error in `[.data.table`(newdata, , na.terms) :
j (the 2nd argument inside [...]) is a single symbol but column name 'na.terms' is not found. Perhaps you intended DT[, ..na.terms]. This difference to data.frame is deliberate and explained in FAQ 1.1.
The script has always worked until today. Can anyone help me figure out what the problem is?