'Error in switch(tolower(device), ragg_png = , png = paste0(files, ".png"), : EXPR must be a length 1 vector
I am very new to R, so apologies if I don't make any sense. I am trying to make a flexdashboard for a class project and wanted to create an animated graph. The following code worked just fine in a regular R script, but I keep getting the error
Quitting from lines 114-156 (FInal-Project-Markdown.Rmd)
Error in switch(tolower(device), ragg_png = , png = paste0(files, ".png"), :
EXPR must be a length 1 vector
Calls: <Anonymous> ... <Anonymous> -> animate.gganim -> do.call -> <Anonymous>
I have all of the correct packages downloaded, and I made sure to load the data frames into the markdown file. As I said, I am quite new to R, so I apologize if this is too little or too much information.
graph1 <- ggplot(USA.2012to2021, aes(x = region, y = refugees, color = region, fill = region)) + geom_col()
graph1.animation = graph1 + transition_time(year)
file_renderer(dir = ".", prefix = "gganim_plot", overwrite = FALSE)
graph1.animation
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
