1

I'm trying to set up a simple line plot that will reveal data by year with gganimate.

First problem is, my simple line plot shows a really weird range on the y axis.

Second problem, the animation won't work. Error message reads:

Error: along data must either be integer, numeric, POSIXct, Date, difftime, orhms

In addition:

Warning message: In min(cl[cl != 0]) : no non-missing arguments to min; returning Inf"

ggplot(data = Japan_GDP3, 
       aes(x = Japan_GDP3$Year, y = Japan_GDP3$`Exports of Goods and Services, Nominal, Domestic Currency`,
           group = 1)) +
  geom_line() +
  transition_reveal(Japan_GDP3$Year)

enter image description here

Z.Lin
  • 28,055
  • 6
  • 54
  • 94
Rob
  • 41
  • 3
  • 1
    1. Don't use `$` in `aes()`. 2. Check whether your y variable is actually numerical (looks like it's a factor). 3. If the above don't solve your problem, consider making your problem [reproducible](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) by editing your question with the ouput from `dput(Japan_GDP3)`. – Z.Lin May 03 '19 at 08:21
  • 1
    Thanks Z. Lin. You were right, the variable was a character. I imported the data into R with read_xlsx and all numbers were imported as characters. Do you know how to change that? I tried as.numeric but that didn't work – Rob May 03 '19 at 12:26
  • 1
    Hard to diagnose that without seeing your data... – Z.Lin May 03 '19 at 13:07

0 Answers0