0

I'm trying to make a scatterplot of my panel dataset, which is structured as follows:

country year variable value
A 2010 1 ...
B 2010 1 ...
C 2010 1 ...
A 2011 2 ...
...

I want to scatterplot e.g. variable 1 vs. variable 2 for every country for which in a given year, there's data (value) on both variables.

Any suggestions on how to set the aes(x,y) in ggplot?

Thanks a lot!

  • 1
    you need to transform the data from long to wide first. Search for "make data wide R" and find https://stackoverflow.com/questions/5890584/how-to-reshape-data-from-long-to-wide-format – Roman Aug 02 '21 at 15:21

0 Answers0