compare values in R when within a string of letters
问题 I need to check if the values of two columns fulfil certain conditions, but the value in one column is within a string of letters. If the value of CURRENT_ID is equal to the value of CURRENT_TEXT_1 or CURRENT_TEXT_2 plus 2, when CURRENT_TEXT_1 or CURRENT_TEXT_2 are equal to DISPLAY_BOUNDARY, then I need in the OUTPUT column a value of 1, otherwise a value of zero. Here are some example lines of my datafile ( df ) and the output I would like to obtain: PARTICIPANT ITEM CONDITION CURRENT_TEXT_1