filter id in cluster according another variable in R

前端 未结 2 827
眼角桃花
眼角桃花 2021-01-29 01:17

I have a data with 100 patients and each patient has values from 7 days (1 to 7). How can I select only patients according another variable only in day 1?

df <         


        
2条回答
  •  萌比男神i
    2021-01-29 02:03

    You can use the subset function in base R:

    subset(df,RRT==0&day==1)
    

    if you only need the id column the you can select

    with(df,id[RRT==0&day==1])
    

提交回复
热议问题