如何在每个单个单元格中制作r方程
我有2列不同的尺寸A和B。A
| B
5 | 4
1 | 2
3 |
我怎么说如果Cella为<然后,Cellb给我Cellb-cella?
,因此它计算出:
“ 5(a1)大于4(b1)和2(b2)”,因此没有结果
” 1(A2)小于4(b1)和2(b2)“所以我们有3和1
“ 3(A3)小于4(b1),大于2(b2)”,所以我们有1
结果=(3,1,1)
我最接近的是: 如果(a< b){b- a}
,
但这仅与相同大小的列一起使用,我希望列A的每个单独的单独的单独的单独的单独的单独的单独的单元与B列的每个单独的单元相互作用。那会吗?
I have 2 columns of different size, A and B.
A | B
5 | 4
1 | 2
3 |
How do I say If CellA is < CellB then give me CellB-CellA?
So it calculates:
"5(A1) is bigger than 4(B1) and 2(B2)" so no results
"1(A2) is smaller than 4(B1) and 2(B2)" so we have 3 and 1
"3(A3) is smaller than 4(B1) and bigger than 2(B2)" so we have 1
Result = (3, 1, 1)
The closest I got was:if (A < B) {B - A}
But that only works with columns of same size, I want each individual cell of Column A to interact with each individual cell of column B. How can I do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于不同尺寸的列必须是列表而不是data.frame。因此,解决方案:
在2022-05-29上由 reprex软件包(v2.0.1)
Since the columns of different sizes then it must be list and not data.frame so the solution :
Created on 2022-05-29 by the reprex package (v2.0.1)