Skip to content

Commit

Permalink
comments
Browse files Browse the repository at this point in the history
  • Loading branch information
pascal-sauer committed Feb 26, 2024
1 parent 08d1710 commit bf73304
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions R/extend.R
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ extend <- function(x,
"Try changing res, xRange or yRange.")
}

# reorder first dim of x to match order in coords
posInCoords <- match(sparseCoords, coords)

subdims1 <- getSets(x)[grep("^d1\\.", names(getSets(x)))]
notCoords <- subdims1[!subdims1 %in% c("x", "y")]

Expand All @@ -37,7 +34,12 @@ extend <- function(x,

getSets(extended) <- getSets(x)

posInCoords <- match(sparseCoords, coords)

# fill subdims for dim 1 other than x and y (e.g. country code) if they were set in x
dimnames(extended)[[1]][posInCoords] <- getItems(x, 1)

# fill extended with data from x where available
extended[posInCoords, , ] <- x

return(extended)
Expand Down

0 comments on commit bf73304

Please sign in to comment.