|
本帖最后由 flying_cattle 于 2017-4-29 17:10 编辑
df1=data.frame(name=c("aa","bb"),age=c(20,29),sex=c("f","m"))
df2=data.frame(name=c("dd","bb","cc"),
age=c(40,35,36),sex=c("f","m","f"),type=c("aaas","wewe","www"))
df1$name=as.vector(df1$name) ##这步不可少,试了好几次,原数据框name列为因子,需要转换为字符向量才可以
data=subset(df2,name==df1$name)
长的对象长度不是短的对象长度的整倍数如何解决 谢谢
|
|