ggplot2 3 variable plot filterable by year

Hi - I'm trying to plot a simple ranking plot using countries and overall ranking, but I would like to be able to filter the plot by year and export it to Power BI. The only reason why I'm not doing this directly into Power Bi is that the visual gives the impression that a higher ranking is bad and a lower ranking is good since it is a higher number and I don't want to do the whole multiply by -1 hack. I'm just trying to figure out what the best way to do this would be. But even just plotting all years is causing errors.

R code here

y1<-dataset$Global Rank in the WJP Rule of Law Index
y2<-dataset$Reporting Period (year of collection)

Error: Aesthetics must be either length 1 or the same as the data (336): x and y


Welcome Franklin!

x, y1 and y2 are vectors that are not part of dataset. aes() should only include names of columns that are part of dataset. Even so, the error you're getting wouldn't occur if that was the only issue. To go further, we'll need to see the full code that you ran and a sample of your data.

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