I have a dataframe with patients that have answered twice in same questionnaire in couple of years. Now I need to calculate how many patient developed problem, how many improved and how many maintained having problems. The answers are in scale 1-6 where <3 is no problem, 3-4.75 is sometimes problem and >= 5 is problems.
I have merged these two dataframe to one and tried to calculate difference by coding dat5$noproblem = ((dat5$sleepProblems.x)<3)-((dat5$sleepProblems.y)<3) but I only get a dataframe there is zero and minus 1 and which dimension is NULL.
I tried do the same with diff((dat5$sleepProblems.x<3) - lag((dat5$sleepProblems.y<3))) but I still get just list of different values.
How I can get the amount of patients?
(Sorry for unclear description)