0

The issue is pretty straightforward.

I am trying to generate a bar plot containing GDP per capita for several countries. The data is incomplete as some of the values are missing.

For instance, for year 1960, I only have data for 3 countries.

When I plot the data, the graph that is returned includes NAs, which I would like to exclude from the plot.

Please see an example below:

GDP <- ggplot(data, aes(country,1960)) + geom_bar(stat = 'identity', na.rm = T)

Please note that in this case, each column represents a year. The first column of the data frame consists of the name of the countries.

If it helps, please see the attached screenshot.

Bar plot returning NA values

Thanks.

J.C.
  • 130
  • 1
  • 7

0 Answers0