Skip to content

Commit 8cf5d1e

Browse files
committed
simplify logic block
1 parent 0fc9a62 commit 8cf5d1e

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

R/layer-sf.R

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,9 @@ LayerSf <- ggproto("LayerSf", Layer,
4444

4545
# automatically determine the name of the geometry column
4646
# and add the mapping if it doesn't exist
47-
if ((isTRUE(self$inherit.aes) && is.null(self$computed_mapping$geometry) &&
48-
is.null(self$computed_mapping$geometry)) ||
49-
(!isTRUE(self$inherit.aes) && is.null(self$computed_mapping$geometry))) {
50-
if (is_sf(data)) {
51-
geometry_col <- attr(data, "sf_column")
52-
self$computed_mapping$geometry <- sym(geometry_col)
53-
}
47+
if (is.null(self$computed_mapping$geometry) && is_sf(data)) {
48+
geometry_col <- attr(data, "sf_column")
49+
self$computed_mapping$geometry <- sym(geometry_col)
5450
}
5551
data
5652
},

0 commit comments

Comments
 (0)