My dataset is a series of surveys. Each survey is divided up into several time periods and each time period has several observations. Each line in the dataset is a single observation. It looks something like this:
Survey Period Observation
1.1 1 A
1.1 1 A
1.1 1 B
1.1 2 A
1.1 2 B
1.2 1 A
1.2 2 B
1.2 3 C
1.2 4 D
This is a simplified version of my dataset, but it demonstrates the point (several periods for each survey, several observations for each period). What I want to do is make a dataframe consisting of all the observations from a single, randomly selected, period in each survey, so that in the resulting dataframe each survey only has a single period, but all of the associated observations. I'm completely stumped on this one and don't even know where to start.
Thanks for your help