%op% 运算符是什么意思?例如“%in%"? [英] What do the %op% operators in mean? For example "%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)
其中 x
和 y
是矩阵.
time(x) %in% time(y)
where x
and y
are matrices.
如何查找关于 %in%
和类似函数的帮助,这些函数遵循 %stuff%
模式,因为我找不到帮助文件?
How do I look up help on %in%
and similar functions that follow the %stuff%
pattern, as I cannot locate the help file?
相关问题:
推荐答案
在它周围加上引号以找到帮助页面.这些工作中的任何一个
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%"<- function(x, table) match(x, table, nomatch = 0) >0’
‘"%in%" <- function(x, table) match(x, table, nomatch = 0) > 0’
由于 time
是泛型,我不知道 time(X2)
返回什么而不知道 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(c(1:5), c(3:8))
[1] 3 4 5
这篇关于%op% 运算符是什么意思?例如“%in%"?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!