Filter on ggplot scatterplot

Hello R experts,

I'm trying to run this code to plot a scatterplot:

ggscatter(Correlation, x = "AverageTemperature", y = "Confirmed",
add = "reg.line", conf.int = TRUE,
cor.coef = TRUE, cor.method = "pearson",
xlab = "AverageTemperature", ylab = "Confirmed")

The dataset im working with looks somthing like this:

Country Confirmed Deaths Recovered Date AverageTemperature AverageTemperatureUncertainty
1 Afghanistan 281 6 10 2013-08-01 26.031 0.347
2 Albania 304 17 89 2013-08-01 24.793 0.928
3 Algeria 1171 105 62 2013-08-01 33.234 0.798

Now I would like to only include the cases which have 500 or more ''confirmed'' cases. Im new to R and have no clue whatsoever on how to achieve this. I've tried adding filter (n > 500) but I get the following error:

Error in n > 500 :
comparison (6) is possible only for atomic and list types

Would love an answer!
Kind regards,
Jop

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

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