Skip to content

Commit 4ef8d79

Browse files
committed
Slight restructure of layer_data
1 parent 304af85 commit 4ef8d79

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

R/layer.r

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -103,15 +103,16 @@ Layer <- ggproto("Layer", NULL,
103103

104104
layer_data = function(self, plot_data) {
105105
if (is.waive(self$data)) {
106-
return(plot_data)
106+
data <- plot_data
107107
} else if (is.function(self$data)) {
108108
data <- self$data(plot_data)
109109
if (!is.data.frame(data)) {
110110
stop("Data function must return a data.frame")
111111
}
112-
return(data)
112+
} else {
113+
data <- self$data
113114
}
114-
self$data
115+
data
115116
},
116117

117118
compute_aesthetics = function(self, data, plot) {

0 commit comments

Comments
 (0)