Hi
I'm trying to make a systematic sample from a dataframe thats generated by several loops I'm running. Meaning the number of rows/observations will vary from each iteration. The dataframe consists of four variables/columns:
"ID" "Width" "Length" "Rank"
The "Rank" ranges from 1 to N. This variable is supposed to represent the order of my observations and is what I want to samply by. The goal is to select every n'th observation according to rank. The sample size is gonna vary by the "for" loop im running (samplesize=4,6,8,10).
Example: If the current dataframe consists of 20 observations and Im in the samplesize=4 part of the "for" loop. "Rank" will then be 1,2,3,4,(...),20. The n'th selection will be 20/4=5 = every 5th observation.
Id then like to make a new dataframe with every 5th observation (according to "Rank").
Any ideas on how to set something like that up? This might be really easy but Im a bit stuck.
Thanks for any help you might provide!