Consider this ggplot
library(ggplot2)
ggplot(Orange, aes(age, circumference)) +
geom_point() +
geom_line(aes(color = Tree))
This has 2 calls to aes(), so on first glance, it seems I want to check this with
ex() %>% check_function("ggplot") %>% {
check_arg(., "data") %>% check_equal()
check_arg(., "mapping") %>% check_function("aes") %>% {
check_arg(., "x") %>% check_equal(eval = FALSE)
check_arg(., "y") %>% check_equal(eval = FALSE)
}
}
ex() %>% check_function("geom_point") %>% {
check_arg(., "mapping") %>% check_function("aes", index = 2) %>% {
check_arg(., "color") %>% check_equal(eval = FALSE)
}
}
But the each call to aes() is nested inside another check_function(), and I think this is restricting the scope. So I think the SCTs I really need are
ex() %>% check_function("ggplot") %>% {
check_arg(., "data") %>% check_equal()
check_arg(., "mapping") %>% check_function("aes") %>% {
check_arg(., "x") %>% check_equal(eval = FALSE)
check_arg(., "y") %>% check_equal(eval = FALSE)
}
}
ex() %>% check_function("geom_point") %>% {
check_arg(., "mapping") %>% check_function("aes") %>% { # <- this line different
check_arg(., "color") %>% check_equal(eval = FALSE)
}
}
It's worth having an example of how the index is calculated: on the whole code or on a subset of the code provided by the state.
Consider this ggplot
This has 2 calls to
aes(), so on first glance, it seems I want to check this withBut the each call to
aes()is nested inside anothercheck_function(), and I think this is restricting the scope. So I think the SCTs I really need areIt's worth having an example of how the
indexis calculated: on the whole code or on a subset of the code provided by the state.