Cannot get gganimate map to work in RMarkdown, Flexdashboard template

I created a flexdashboard using RMarkdown. I have gotten all but one of my graphics to work in the dashboard, but for the life of me I cannot get my gganimated map to work. It will run on its own, just not in the RMarkdown, flexdashboard template. I got the weirdest error code that makes no sense to me.

Below is my code and the error message. I appreciate your help!

mapData<- read_xlsx("State_AA_policies.xlsx") %>%
mutate(region = str_to_lower(region))

us <- map_data("state")

us<- us %>% left_join(mapData, by = "region") %>% drop_na(policies)

gg <-ggplot()

gg + geom_map(data=us, map=us, aes(x=long, y=lat, map_id=region, fill = policies), size=0.15) +
theme_classic() +
labs(x = NULL, y = NULL, color = "Legend") +
ggtitle("Nine States Banned Affirmative Action") +
theme(axis.ticks = element_blank()) +
theme(axis.text = element_blank())+
transition_manual(frames = region, cumulative = T)

I think the error comes from here in gganimate

Can you share a full reproducible example ?
Also can you try in a regular Rmd without flexdashboard ?

Thanks

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.