R %operator% 含义

%foo% is the syntax for a binary operator.

In base R:

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

%/% and %% perform integer division and modular division respectively, and are described on the ?Arithmetic help page.

%o% gives the outer product of arrays.

%*% performs matrix multiplication.

%x% performs the Kronecker product of arrays.

In ggplot2:

%+% replaces the data frame in a ggplot.

%+replace% modifies theme elements in a ggplot.

%inside% (internal) checks for values in a range.

%||% (internal) provides a default value in case of NULL values. This function also appears internally in devtools, reshape2, roxygen2 and knitr. (In knitr it is called %n%.)

In magrittr:

%>% pipes the left-hand side into an expression on the right-hand side.

%<>% pipes the left-hand side into an expression on the right-hand side, and then assigns the result back into the left-hand side object.

%T>% pipes the left-hand side into an expression on the right-hand side, which it uses only for its side effects, returning the left-hand side.

%,% builds a functional sequence.

%$% exposes exposes columns of a data.frame or members of a list.

In data.table:

%between% checks for values in a range.

%chin% is like %in%, optimised for character vectors.

%like% checks for regular expression matches.

In Hmisc:

%nin% returns the opposite of %in%.

In devtools:

%:::% (internal) gets a variable from a namespace passed as a string.

In sp:

%over% performs a spatial join (e.g., which polygon corresponds to some points?)

In rebus:

%R% concatenates elements of a regex object.

posted on 2016-05-05 13:02  Arkenstone  阅读(603)  评论(0编辑  收藏  举报