# Query regarding finding max & min from dataset using sum, groupby or filter

Hi All,

I've recently come across this coding exercise but as I've just started learning R, I'm not sure how to solve these. Below is my dataset screenshot,

Below are the queries,
a. What regions have the maximum and minimum total Indigenous populations(given in column 'Value') in 2016 and 2031?
b. What region/s have the maximum and minimum growth or decay rates of their total Indigenous population between 2016 and 2031?
Calculate these rates as the percentage difference between the 2016 and 2031,
e.g., if 2031 population = 5500 & 2016 population = 5000, then rate = (5500 – 5000) / 5000 = 500/5000 = 0.1, so 10% growth

Can anyone help me out with these?
Thanks

There is a homework policy around here; and it is usually not considered good manners to post your data as a screenshot (what are we supposed to do with it?)

However, to get you started: have a look at chapter 5 of the R4DS book, paying close attention to commands:

• `arrange()` used to sort a data frame according to a column value
• `filter()` to filter data according to a condition
• the special case of `top_n()` used to select the first n rows from a sorted data frame.
• to create new variables from existing ones `mutate()`will be your friend.

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.