%>% .$column_name 等效于 R 基管 |> [英] %>% .$column_name equivalent for R base pipe |>
本文介绍了%>% .$column_name 等效于 R 基管 |>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我经常使用 dplyr 管道将一列从 tibble 转换为向量,如下所示
I frequently use the dplyr piping to get a column from a tibble into a vector as below
iris %>% .$Sepal.Length
iris %>% .$Sepal.Length %>% cut(5)
如何使用最新的 R 内置管道符号来做同样的事情 |>
How can I do the same using the latest R built-in pipe symbol |>
iris |> .$Sepal.Length
iris |> .$Sepal.Length |> cut(5)
Error: function '$' not supported in RHS call of a pipe
推荐答案
我们可以使用getElement()
.
iris |> getElement('Sepal.Length') |> cut(5)
这篇关于%>% .$column_name 等效于 R 基管 |>的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文