How to optimize this piece of code?

Any idea of why the following code takes so long to run?
The command inside myeval needs to be as string (because some specific reasons).

Probably, there is something I'm not optimizing there.

myeval = function(code) {
  eval(parse(text = code))

# this is the code that takes a lot to run
ds = myeval('
dataset %>%
    date = as.Date(sprintf("%s-%s-%s", dateCreatedYYYY, dateCreatedMM, dateCreatedDD))
) %>%
group_by(date) %>%
mutate(pctNA = sum( * 100)
p =
ggplot(data = ds) +
geom_point(mapping = aes(x = date, y = pctNA)) +
labs(y = "%%NA for: browser")


Hi mate. Can you actually make a couple of fake dataframes. One with the imput and one with the expected output, small ones, just a few rows and approximately tell us the dimension of your real one (at least rows )and how much time it tooks to run? It may be the case that there is no much to optimice :slight_smile: