%op%运算符是什么意思?例如“%in%"? [英] What do the %op% operators in mean? For example "%in%"?

查看:108
本文介绍了%op%运算符是什么意思?例如“%in%"?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试执行此简单搜索,但是在R中的百分号(%)上找不到任何内容.

I tried to do this simple search but couldn't find anything on the percent (%) symbol in R.

%in%在以下代码中是什么意思?

What does %in% mean in the following code?

time(x) %in% time(y),其中xy是矩阵.

由于无法找到帮助文件,如何查找遵循%stuff%模式的%in%和类似功能的帮助?

How do I look up help on %in% and similar functions that follow the %stuff% pattern, as I cannot locate the help file?

相关问题:

  • What does eg %+% do? in R
  • The R %*% operator
  • What does %*% mean in R
  • What does %||% do in R?
  • What does %>% mean in R

推荐答案

在其周围加上引号以查找帮助页面.这些工作中的任何一个

Put quotes around it to find the help page. Either of these work

> help("%in%")
> ?"%in%"

进入帮助页面后,您会看到

Once you get to the help page, you'll see that

%in%"当前定义为

‘%in%’ is currently defined as

‘%in%"<-函数(x,table)match(x,table,nomatch = 0)> 0’

‘"%in%" <- function(x, table) match(x, table, nomatch = 0) > 0’


由于time是泛型,所以我不知道X2是什么,不知道time(X2)返回什么.但是,%in%会告诉您左侧的哪些项目也在右侧.


Since time is a generic, I don't know what time(X2) returns without knowing what X2 is. But, %in% tells you which items from the left hand side are also in the right hand side.

> c(1:5) %in% c(3:8)
[1] FALSE FALSE  TRUE  TRUE  TRUE

另请参见intersect

> intersect(c(1:5), c(3:8))
[1] 3 4 5

这篇关于%op%运算符是什么意思?例如“%in%"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆