创建带有循环的新数据框

时间:2019-02-18 17:45:09

标签: loops dataframe

我想知道是否有任何直接方法可以做到这一点:

AB.births = births.can_prov[births.can_prov$Area =="AB",]
BC.births = births.can_prov[births.can_prov$Area =="BC",]
MB.births = births.can_prov[births.can_prov$Area =="MB",]
NB.births = births.can_prov[births.can_prov$Area =="NB",]
NL.births = births.can_prov[births.can_prov$Area =="NL",]
NT.births = births.can_prov[births.can_prov$Area =="NT",]

Area.Birth是基于另一个数据帧的Area变量的新数据帧。

基本:

Area.births = births.can_prov[births.can_prov$Area =="Area",]

0 个答案:

没有答案