Calculated value from a variable conditionated by a third variable in R : I´m working in R with a dataframe that includes Patient_ID, date, ulcer_area(cm2), initial measure(yes/no).
Each patien has one or more measures of area (ulcer_area) in different dates
I´m trying to create for EACH patient a new variable called area_dif that is a proportion of de current measure and the initial measure 

area_dif = by Patien_ID (ulcer_area/(ulcer_area WHERE initial measure=yes))

[database][1]


  [1]: https://i.stack.imgur.com/pvgD2.png