data_thing <- gapminder %>%
filter(continent == c("Americas", "Africa", "Asia"))
#> Error in gapminder %>% filter(continent == c("Americas", "Africa", "Asia")): could not find function "%>%"
ggplot(data_thing, aes(x = gdpPercap, y = lifeExp, size = pop, color = country)) +
geom_point() +
theme(legend.position = "none") +
scale_x_log10()
#> Error in ggplot(data_thing, aes(x = gdpPercap, y = lifeExp, size = pop, : could not find function "ggplot"
facet_wrap(~continent) +
labs(title = "Year: {frame_time}") +
transition_time(year) +
shadow_wake(wake_length = 0.1, alpha = FALSE)
#> Error in facet_wrap(~continent): could not find function "facet_wrap"
Created on 2019-09-26 by the reprex package (v0.3.0)
mara
September 26, 2019, 4:49pm
2
At least in your reprex above, your functions and content can't be found without the libraries you're using (that's why you get could not find function
errors).
As Mara said, you are missing library calls and also a +
symbol after scale_x_log10()
.
This code produces an animation:
library(tidyverse)
library(gganimate)
library(gapminder)
data_thing <- gapminder %>%
filter(continent == c("Americas", "Africa", "Asia"))
ggplot(data_thing, aes(x = gdpPercap, y = lifeExp, size = pop, color = country)) +
geom_point() +
theme(legend.position = "none") +
scale_x_log10() +
facet_wrap(~continent) +
labs(title = "Year: {frame_time}") +
transition_time(year) +
shadow_wake(wake_length = 0.1, alpha = FALSE)
If you get an error message instead, then very likely you don't have a renderer program installed in your system
system
Closed
October 17, 2019, 6:45pm
4
This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.