Skip to content

Commit bf73304

Browse files
committed
comments
1 parent 08d1710 commit bf73304

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

R/extend.R

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,6 @@ extend <- function(x,
2020
"Try changing res, xRange or yRange.")
2121
}
2222

23-
# reorder first dim of x to match order in coords
24-
posInCoords <- match(sparseCoords, coords)
25-
2623
subdims1 <- getSets(x)[grep("^d1\\.", names(getSets(x)))]
2724
notCoords <- subdims1[!subdims1 %in% c("x", "y")]
2825

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

3835
getSets(extended) <- getSets(x)
3936

37+
posInCoords <- match(sparseCoords, coords)
38+
39+
# fill subdims for dim 1 other than x and y (e.g. country code) if they were set in x
4040
dimnames(extended)[[1]][posInCoords] <- getItems(x, 1)
41+
42+
# fill extended with data from x where available
4143
extended[posInCoords, , ] <- x
4244

4345
return(extended)

0 commit comments

Comments
 (0)