0

I am having trouble adding dots to a line graph to represent the population size of the country

This is the full homework problem:In the second graph, represent time on the X axis and GPD on the Y axis, and present the data using a linegraph. Add in dots for each year, with the size of the dots representing the population size for each year.

filter(gapminder, country == "New Zealand")
p <- ggplot(data = gapminder,
            mapping = aes(x = time(),
                          y = gdpPercap))
p + geom_line() + geom_point(aes(size = population))
stefan
  • 90,330
  • 6
  • 25
  • 51
toosi
  • 11
  • 2
    Welcome to SO! It would be easier to help you if you provide [a minimal reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example). From your question it's not clear what's your issue. Do you get any errors? Also, do you use the `gapminder` dataset from the `gapminder` package? Finally, at least `x = time()` looks wrong. If `time` is a column in your dataset then use `x=time` without any parentheses. – stefan Jan 29 '23 at 20:50
  • 1
    Your first line of code does not assign the result of the `filter` to a variable, so `data = gapminder` will still contain data for all countries. – neilfws Jan 29 '23 at 21:28

0 Answers0