r - R 中的 %<-% 运算符是什么?

标签 r operators

我遇到了一个新的管道 R 运算符 %<-%在这个博客上:https://blogs.rstudio.com/ai/posts/2019-09-30-bert-r/tokenize_fun()功能。

这个运算符叫什么?它有什么作用?

我在谷歌上找不到任何关于它的信息。我知道其他管道运营商,如 %>% , %T>% , %$%

最佳答案

它是来自 zeallot 的多重赋值运算符

%<-% and %->% invisibly returnvalue.

These operators are used primarily for their assignment side-effect. %<-% and %->% assign into the environment in which they are evaluated.

即它从一行代码创建多个对象

> library(zeallot)
> c(x, y, z) %<-% c(1, 3, 5)
> x
[1] 1
> y
[1] 3
> z
[1] 5

关于r - R 中的 %<-% 运算符是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/68970084/

相关文章:

c# - 运算符和泛型类

r - 如何在 Kruskal Wallis 事后检验后获得显着性代码

r - 读取蟾蜍导出的 csv 文件后,第一列名称中添加了奇怪的字符

r - tidyverse,plyr和dplyr

c++ - 类不支持运算符

c++ - 运算符重载的基本规则和惯用法是什么?

删除使用plotmath制作的ggrepel标签之间的空间

r - 在 ggplot2 中居中对齐图例标题和图例键,用于长图例标题

c++ - 将 Char* 与 String 和运算符进行比较

c# - 运算符 "<<"在 C# 中是什么意思?