I am practicing my R skills and I want to know if someone is skilled in functions or loops for counting. My idea is quite vague, but I can give an example.
For an example:
I have 4 book-shelves each above the other. The first (bottom) one can carry 6 books, the second shelf 4 books, the third shelf 6 books and the fourth shelf 4 books.
How can I make a function/loop where my input is a number of books I buy, and the output is how many shelves are full. I want the system to start at the bottom and work it's way up.
I have thought of finding the average number of books that can fit on the shelves, but if the input is 5 the program would think the first shelf is full when it isn't.