I am trying to create a new variable by subtracting variable "A" from dataframe "data1" and variable "B" from dataframe "data2".
AB = data1$A - data2$B worked in that I created value AB and can run basic descriptive analyses on it. However, I want to save this value as a variable to data2.
I tried data2$AB = data1$A - data2$B but got the error below:
Error: Assigned data `MergeFinal.ScreenBaseline$pain_severity_score - MergeFinal.FU$pain_severity_score` must be compatible with existing data.
x Existing data has 99 rows.
x Assigned data has 49 rows.
ℹ Only vectors of size 1 are recycled.