Skip to content

Commit

Permalink
Perform validation checks using grep
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhesh195 committed Mar 15, 2024
1 parent 7f31bda commit bce3430
Showing 1 changed file with 2 additions and 12 deletions.
14 changes: 2 additions & 12 deletions R/geom-.r
Original file line number Diff line number Diff line change
Expand Up @@ -148,17 +148,6 @@ Geom <- gganimintproto("Geom",
list(g = g, g.data = g.data)
},

get_off_params = function(input_string) {
pattern <- "_off$"
# Return parameter name without the _off suffix
if (grepl(pattern, input_string)) {
result <- sub(pattern, "", input_string)
return(result)
} else {
return("")
}
},

## Save a layer to disk, save and return meta-data.
## l- one layer of the ggplot object.
## d- one layer of calculated data from ggplot_build(p).
Expand All @@ -185,7 +174,8 @@ Geom <- gganimintproto("Geom",
## e.g. colour.
## 'colour', 'size' etc. have been moved to aes_params
g$params <- getLayerParams(l)
geom_params <- c(names(l$aes_params), sapply(names(l$extra_params), l$geom$get_off_params))
off_params <- sub("_off", "", grep("_off", names(l$extra_params), value = TRUE))
geom_params <- c(names(l$aes_params), off_params)
duplicate_aes <- intersect(geom_params, names(g$aes))

if(length(duplicate_aes) > 0) {
Expand Down

0 comments on commit bce3430

Please sign in to comment.