I'm working with a dataset which I've 'attached' allowing me to use functions like mean(), summary(), by simply inputting the variable name, eg. mean(age).
I'd like to be able to define which part of the column the function looks at when returning these values.
Let me explain (look at image below). Study 1 is separated from Study 2. The last sample of study 1 is on row 510, the first of Study 2 is on row 511. I want to be able to use the mean, summary, etc. functions on rows (0-510], and [511, >) separately.