如何根据表上的特定列进行比较多个列?

发布于 2025-02-12 17:06:56 字数 182 浏览 0 评论 0原文

我有一个表,我想根据表上的特定列比较多个列,

例如:

我的表名是x2,并且有四个列(a,b,c,speed)

A  B  C  speed 
5  4  5    5
2  4  2    2
6  2  7    2

我想比较A和B列A和B和B和C基于列速

i have a table and i want to compare multiple columns based on specific column on the table

for example :

my table names is x2 and has four columns which they ( A , B , C , speed )

A  B  C  speed 
5  4  5    5
2  4  2    2
6  2  7    2

I want to compare columns A and B and C based on column speed

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

分分钟 2025-02-19 17:06:56

一个可能的解决方案,如果我们想检查列是否等于speed一个:

outer(list(df$speed), list(df$A, df$B, df$C), Vectorize(\(x,y) all(x == y)))

#>       [,1]  [,2]  [,3]
#> [1,] FALSE FALSE FALSE

A possible solution, in case we want to check whether columns are equal to the speed one:

outer(list(df$speed), list(df$A, df$B, df$C), Vectorize(\(x,y) all(x == y)))

#>       [,1]  [,2]  [,3]
#> [1,] FALSE FALSE FALSE
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文