@@ -1169,6 +1169,15 @@ specifyISDM$set('public', 'initialize', function(data, projection, Inlamesh, in
1169
1169
1170
1170
if (! missing(offset )) private $ Offset <- offset
1171
1171
1172
+ private $ Spatial <- spatial
1173
+ private $ Intercepts <- intercepts
1174
+
1175
+ private $ covariateFormula <- formulas $ covariateFormula
1176
+ private $ biasFormula <- formulas $ biasFormula
1177
+
1178
+ private $ Projection <- projection
1179
+ private $ INLAmesh <- Inlamesh
1180
+
1172
1181
private $ pointCovariates <- pointcovariates
1173
1182
1174
1183
if (! is.null(spatialcovariates )) private $ spatialCovariates(spatialcovariates )
@@ -1188,14 +1197,6 @@ specifyISDM$set('public', 'initialize', function(data, projection, Inlamesh, in
1188
1197
}
1189
1198
private $ IPS <- ips
1190
1199
1191
- private $ Spatial <- spatial
1192
- private $ Intercepts <- intercepts
1193
-
1194
- private $ covariateFormula <- formulas $ covariateFormula
1195
- private $ biasFormula <- formulas $ biasFormula
1196
-
1197
- private $ Projection <- projection
1198
- private $ INLAmesh <- Inlamesh
1199
1200
1200
1201
private $ addData(dataList = data , responseCounts = responsecounts ,
1201
1202
responsePA = responsepa , trialsPA = trialspa ,
@@ -1317,6 +1318,18 @@ specifyISDM$set('private', 'addData', function(dataList, responseCounts, respons
1317
1318
1318
1319
private $ temporalVars <- pointData $ timeIndex
1319
1320
1321
+ numTime <- length(unique(unlist(private $ temporalVars )))
1322
+
1323
+ newIPS <- rep(list (private $ IPS ), numTime )
1324
+
1325
+ newIPS <- do.call(rbind , newIPS )
1326
+
1327
+ newIPS [, private $ temporalName ] <- rep(1 : numTime , each = nrow(private $ IPS ))
1328
+
1329
+ newIPS <- st_transform(newIPS , private $ Projection )
1330
+
1331
+ private $ IPS <- newIPS
1332
+
1320
1333
}
1321
1334
1322
1335
# #How does this work?
@@ -1385,6 +1398,8 @@ specifyISDM$set('private', 'addData', function(dataList, responseCounts, respons
1385
1398
envir = private $ spatcovsEnv )[cov ],
1386
1399
layer = cov )
1387
1400
1401
+ if (is.character(pointData $ Data [[data ]][[species ]][[covIndex ]])) pointData $ Data [[data ]][[species ]][[covIndex ]] <- as.factor(pointData $ Data [[data ]][[species ]][[covIndex ]])
1402
+
1388
1403
if (any(is.na(pointData $ Data [[data ]][[species ]][[covIndex ]]))) {
1389
1404
1390
1405
pointData $ Data [[data ]][[species ]][[covIndex ]] <- inlabru :: bru_fill_missing(where = pointData $ Data [[data ]][[species ]],
@@ -1416,6 +1431,8 @@ specifyISDM$set('private', 'addData', function(dataList, responseCounts, respons
1416
1431
layer = covIPS
1417
1432
)
1418
1433
1434
+ if (is.character(private $ IPS [[covADD ]])) private $ IPS [[covADD ]] <- as.factor(private $ IPS [[covADD ]])
1435
+
1419
1436
if (any(is.na(private $ IPS [[covADD ]]))) {
1420
1437
1421
1438
private $ IPS [[covADD ]] <- inlabru :: bru_fill_missing(where = private $ IPS ,
0 commit comments