r - 基于现有数据框的数据框中的子集行
问题描述
我希望代码在从另一个数据帧进行子集化后返回剩余的行。
Month = c('January','February','March','April','May','June')
Names = c("Jack", "Steve", "CJ", "Polar", "Ren", "Vent")
Color = c("Red", "Grey", "Yellow", "Blue", "Yellow", "Pink")
df= data.frame(Month, Names, Color)
Month = ""
Names = c("Jack", "Steve", "CJ", "Polar", "Ren", "Vent", "Keegan", "Fabian")
Color = c("Red", "Grey", "Yellow", "Blue", "Yellow", "Pink", "Pink", "Red")
df2 = data.frame(Month, Names, Color)
df$Month
已填满,而df2$Month
将是一个空列。基本上我想做的是df
从df2
. 它应该还给我
Month Names Color
1 Keegan Pink
2 Fabian Red
解决方案
推荐阅读
- mysql - mysql,使用默认值创建列
- python - 如何循环转换DF中的值?
- firebase - get() 和 getAfter() 之间的 Firebase 安全规则差异
- python - tkinter 画布未绘制顶部和左侧线
- javascript - 如何将弹出式浏览器窗口置于最前面,使其位于所有浏览器窗口之上?
- amazon-web-services - 如何修复“使用这些代码失败的健康检查:”在 elasticbeanstalk 实例上?
- python - For 循环覆盖先前的结果
- c - 通过 fgets 从 txt 文件中检索到的部分文本在 c 中丢失了
- ios - 检测更改文本的键盘组合
- kotlin - 使用 remoteMessage.notification.body 的实际有效负载时,smallIcon 是圆形灰色斑点