HELP: Calculating Population Change Over Time with R

Im not sure if Im doing this exercise correctly and i dont see any feedback or help available to check my answers. Im also not sure if there is a glitch.

I update all my variables and write a print statement but when i hit save, nothing seems to happen.

Also, when i use print(calculate_annual_growth), it prints out the whole function.

Please help!

1 Like

Make sure when you call the print() function with the calculate_annual_growth() function that you include the specified arguments like so:

print(calculate_annual_growth(1927,2017,pop_year_one,pop_year_two,city_name))

At the very bottom of the browser window you should see the following if you have done everything correctly:

[1] "From 1927 to 2017 the population of Istanbul, Turkey grew by approximately 23.0555250040199 % each year."
[1] 23.05553

The first [1] is the message printed by the calculate_annual_growth() function.
The second [1] is the value returned to the function caller which was the print() function, so it also gets printed.
Hope this helps!

3 Likes

Yup, that was it. Thank you so much for your help! I didnt realize i needed to add in the arguments to the print statement

2 Likes

I’m also not sure if I am doing the exercise correctly. Even after trying what you suggested, I don’t have the option to “run” the code so nothing shows! I even called the print(f) function you posted and nothing happened.

When you click “Save”, your code runs. You should see the code itself, and any printed output in the browser window on the right.