I have a data set as I've shown below:
df <- tribble(
~id, ~clicks,
"1", 10,
"2", 5,
"3", 7,
"4", 6,
"5", 3,
"6", 4,
"7", 5,
"8", 6,
"9", 1,
"10", 9,
)
Now, I want to set an interval from id column for the columns and then sum the rows for each interval. Simply, here is my desired data:
desired_df <- tribble(
~"1-2", ~"2-5", ~"5-10""26.7%", "28.5%", "44.6%"
)
How can I get the desired data?