I have basic knowledge of R, but I'm not sure how to go about the following programming:
I have a large data frame of data from 25 participants. Each participant has a different total number of sound files (i.e., #1 might have 105 and #2 might have 98). For each participant, we've coded whether or not they're in a specific location (i.e., if they're in their apartment, 1, if not, 0).
I want to get the count of how many times Apartment=1 for each participant. This is where I'm confused: my Excel sheet is organized such that all of the participants are stacked on top of each other. So the first 105 rows are for Participant #1, and the next 98 rows are for Participant #2.
Do I need to aggregate my data by participant number, and then get the count?
I've never written a for loop, but is that another possible solution?