What I am looking to do is something similar to a pivot table in excel but using R to determine the median. I have 3 data frames. The first being whether someone moved or not. I want to determine the median number of knocks this person received as well as the months they had lived there to see if either of them had anything to do with the move. Ideally I would end up with 4 medians (2 for knocks based on whether they moved or not and 2 for months lived).
Any ideas?