0
我有這2個dataframes(反黑和datxt):過濾數據幀由科拉姆值與其他2個dataframes
> head(dats)
idpatient entryear sex infection
1 1 1995 Male HCV+ & HIV-
2 2 1995 Male HCV+ & HIV-
3 3 1995 Male HCV+ & HIV-
4 4 1995 Male HCV+ & HIV-
5 5 1995 Male HCV+ & HIV-
6 6 1995 Male HCV+ & HIV-
> head(datxt)
idpatient entryear sex infection timeaddic
1 54 1996 Female HCV+ & HIV- 168
2 55 1996 Female HCV+ & HIV- 96
3 56 1996 Female HCV+ & HIV- 108
4 57 1996 Female HCV+ & HIV- 60
5 58 1996 Female HCV+ & HIV- 96
6 59 1996 Male HCV+ & HIV- 24
在另一邊,我合併這兩個成另一種(mergedDataset):
> tail(**mergedDataset**)
idpatient entryear sex infection timeaddic
358 358 2004 Male HCV+ & HIV+ 180
359 359 2004 Male HCV+ & HIV+ 288
360 360 2004 Female HCV+ & HIV+ 192
361 361 2004 Male HCV+ & HIV- 60
362 362 2004 Male HCV+ & HIV- 108
363 363 2004 Male HCV+ & HIV+ 252
我怎麼能提取包括在反黑組及和datxt從患者megedDataset的數據?我試過這個,但沒有工作:
finalData <- mergedData[dats$idpatient == datxt$idpatient,]
你能幫我嗎?
在此先感謝!
是的,你是對的! :) –