match.html
来自「本程序是基于linux系统下c++代码」· HTML 代码 · 共 91 行
HTML
91 行
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html><head><title>R: Value Matching</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" type="text/css" href="../../R.css">
</head><body>
<table width="100%" summary="page for match {arules}"><tr><td>match {arules}</td><td align="right">R Documentation</td></tr></table>
<h2>Value Matching</h2>
<h3>Description</h3>
<p>
Provides the generic function <code>match</code> and the S4 methods for
associations and transactions. <code>match</code> returns a vector of the
positions of (first) matches of its first argument in its second.
</p>
<p>
<code>%in%</code> is a more intuitive interface as a binary operator, which
returns a logical vector indicating if there is a match or not for
its left operand.
</p>
<h3>Usage</h3>
<pre>
match(x, table, nomatch = NA_integer_, incomparables = NULL)
x %in% table
</pre>
<h3>Arguments</h3>
<table summary="R argblock">
<tr valign="top"><td><code>x</code></td>
<td>
an object of class <code>itemMatrix</code>, <code>transactions</code> or
<code>associations</code>.</td></tr>
<tr valign="top"><td><code>table</code></td>
<td>
a set of associations or transactions to be matched against. </td></tr>
<tr valign="top"><td><code>nomatch</code></td>
<td>
the value to be returned in the case when no match is found. </td></tr>
<tr valign="top"><td><code>incomparables</code></td>
<td>
not implemented. </td></tr>
</table>
<h3>Value</h3>
<p>
<code>match</code>: An integer vector of the same length as <code>x</code> giving the
position in <code>table</code> of the first match if there is a match, otherwise
<code>nomatch</code>.
<br>
<code>%in%</code>: A logical vector, indicating if a match was located for each
element of <code>x</code>.</p>
<h3>See Also</h3>
<p>
<code><a href="rules-class.html">rules-class</a></code>,
<code><a href="itemsets-class.html">itemsets-class</a></code>,
<code><a href="itemMatrix-class.html">itemMatrix-class</a></code>
</p>
<h3>Examples</h3>
<pre>
data("Adult")
## get unique transactions, count frequency of unique transactions
## and plot frequency of unique transactions
vals <- unique(Adult)
cnts <- tabulate(match(Adult, vals))
plot(sort(cnts, decreasing=TRUE))
## find all transactions which are equal to transaction 10 in Adult
which(Adult %in% Adult[10])
</pre>
<hr><div align="center">[Package <em>arules</em> version 0.6-6 <a href="00Index.html">Index]</a></div>
</body></html>
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?