select last observation from longitudinal data

前端 未结 6 1186
小蘑菇
小蘑菇 2020-12-28 09:19

I have a data set with several time assessments for each participant. I want to select the last assessment for each participant. My dataset looks like this:

         


        
6条回答
  •  醉梦人生
    2020-12-28 10:11

    Another option in base: df[rev(rownames(df)),][match(unique(df$ID), rev(df$ID)), ]

提交回复
热议问题