I got a little question. I have to submit my R-script until Monday and I'm struggling with one task.

I have a Dataframe called my.matrix

my.matrix <- cbind(id, sex, weight, height)

The task is as follows: "Calculate the mean of weight of all participants with an odd id"
Is there a function to calculate the mean of weight of all participants with an odd id with the basic r studio functions?

you can just use the modulo operation (%%) on your IDs to create a subset of your data. You could improve it by using a data.frame instead of a matrix build with cbind() and making use of the native pipe |>.