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 <
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
id
with(df,id[RRT==0&day==1])