Loop through unique values of a df subset, and update df with new variables
问题 I am struggling to append a df with new variables that are computed from a subset of this df. I have two goals: Merge many individual data sets into one. The index variable is "SID" (subject ID). Create new variables/columns in this master dataset. The attached data is an example of what the already merged dataset will look like, however contains only 2 (SIDs: 9003 and 1028). I need to loop through each unique SID and perform several relatively easy computations on some of the variables in