I wish to learn a more efficient to get averaged values that have different suffixes, such as _L and _R.
For every brain region, I would like to create a new variable that is the averaged between the left and right hemispheres. This is denoted by the suffix _L
and _R
.
I am doing this manually in excel but it could be error prone.
The dataset is currently in a long format. Example: For each subject, the goal is to create a new region
called odi.lobar.Temporal_Average
which is the averaged of 0.030767
and 0.371568
.
subject region value
1 odi.lobar.Temporal_L 0.030767
1 odi.lobar.Temporal_R 0.371568
2 odi.lobar.Temporal_L 0.371568
2 odi.lobar.Temporal_R 0.369251
Many thanks.