Hi here, I would like to know how to create a new variable that is based on the average/mean of a set of existing variables in my dataset. My data looks like this:
amb1 amb2 amb3
4 7 5
4 4 5
5 4 5
5 6 6
.........................
How do I create a new variable column based on the mean values of amb1, amb2, and amb3? I suppose I could simply type the entire formula for the mean in the following code, but I am sure there is a simpler way of using some kind of function command?
mutate(mscstart, amb =(amb1 + amb2 + amb3)/3)
Thanks!