Skip to content

Commit 7185485

Browse files
committed
Force ncol = 2 in matrix
1 parent a30a030 commit 7185485

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

R/specifySpecies.R

+2-2
Original file line numberDiff line numberDiff line change
@@ -1690,7 +1690,7 @@ specifySpecies$set('private', 'addData', function(dataList, responseCounts, resp
16901690
naCovs <- names(naRows)[sapply(naRows, length) > 0] # identify covs with missing data
16911691
for(cov in naCovs){ # fill missing values for rows/covs using nearest neighbour
16921692
fullGeomCovs[naRows[[cov]], cov] <-
1693-
nearestValue(st_coordinates(fullGeom[naRows[[cov]],])[,c("X","Y")],
1693+
nearestValue(matrix(st_coordinates(fullGeom[naRows[[cov]],])[,c("X","Y")], ncol = 2),
16941694
get('spatialcovariates', envir = private$spatcovsEnv)[cov])
16951695
# out <- inlabru::bru_fill_missing(where = fullGeom[naRows[[cov]],],
16961696
# data = get('spatialcovariates',
@@ -1741,7 +1741,7 @@ specifySpecies$set('private', 'addData', function(dataList, responseCounts, resp
17411741
naCovs <- names(naRows)[sapply(naRows, length) > 0] # identify covs with missing data
17421742
for(cov in naCovs){ # fill missing values for rows/covs using nearest neighbour
17431743
meshCovs[naRows[[cov]], cov] <-
1744-
nearestValue(st_coordinates(private$IPS[naRows[[cov]],])[,c("X","Y")],
1744+
nearestValue(matrix(st_coordinates(private$IPS[naRows[[cov]],])[,c("X","Y")], ncol = 2),
17451745
get('spatialcovariates', envir = private$spatcovsEnv)[cov])
17461746
}
17471747

0 commit comments

Comments
 (0)