0

I have a data frame which looks like this

ZIPCODE Geometry         2020 2019 2018 2017 2016 2015
10000   shapefileinfo1    x1   x2   x3   x4   x5   x6
10001   shapefileinfo2    y1   y2   y3   y4   y5   y6
10002   shapefileinfo3    z1   z2   z3   z4   z5   z6
.           .              .    .    .   .    .     . 
.           .              .    .    .   .    .     . 
.           .              .    .    .   .    .     . 

The shapefile information I obtained by importing a shapefile and merging it with my other dataset using left_join. I now want to create a gif map projecting the information for each year. How would I be able to do this using this data frame, and if that is not possible, how would I have to arrange my data to be able to create the gif?

1 Answers1

1

Have you looked into ggannimate? https://gganimate.com/articles/gganimate.html

You will need to specify the transition variable in transition_states(), so you might want to gather() the years first to put your dataframe in long format

Jo_
  • 69
  • 6