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 %>%
mutate(
date = as.Date(sprintf("%s-%s-%s", dateCreatedYYYY, dateCreatedMM, dateCreatedDD))
) %>%
group_by(date) %>%
mutate(pctNA = sum(is.na(browser))/length(browser) * 100)
')
p =
ggplot(data = ds) +
geom_point(mapping = aes(x = date, y = pctNA)) +
labs(y = "%%NA for: browser")
print(p)
Thanks!