在运行以下示例场景的R代码时需要帮助:
Set_1 = data.frame(Enc=c(23345,23345,23349,23349,23349,23354,23367,23367,23372,23372,23382),
CPT = c("97110","97140","99396","36415","99000","99203O","73030","99024","99213O","36415","81002"),
Paid_Status = c("Paid","Non Paid","Paid","Non Paid","Non Paid","Paid","Paid","Non Paid","Paid","Non Paid","Non Paid"))
Set_2 = data.frame(Main_CPT = c("26010","26010","26010","26010","26025","26025","26025","26025","26025","26025","26034",26034","26034","26034","26034"),
Child_CPT = c("01810",01995","0213T","0216T","64490","64491","64492","64493","64494","64495","64530","69990","99148","99149","99150"))
从第一个数据开始,我需要从每个编号中验证Enc
明智的行CPT
和Paid_Status
。其中一个CPT
为Main_CPT
,其他CPT
为Child_CPT
,详细信息可与第二个数据集进行比较。
现在,我想看看与第二个数据集的CPT
匹配的Main_CPT
并且支付特定CPT的状态的第1个新列数据设置为" P"在该行中,那个Enc的剩余CPT应该与第二个数据集的Child CPT匹配,并且第一个数据集的新列中的相应行应该是" A"。