<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><title>R: Classify list elments into unique but non-exclusive cases</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="R.css" />
</head><body>

<table width="100%" summary="page for list.class"><tr><td>list.class</td><td style="text-align: right;">R Documentation</td></tr></table>

<h2>Classify list elments into unique but non-exclusive cases</h2>

<h3>Description</h3>

<p>In non-tabular data, a certain field may take multiple values in a
collection non-exclusively. To classify these elements into different
cases, this function detects all possible cases and for each case all
elements are examined whether to belong to that case.
</p>


<h3>Usage</h3>

<pre>
list.class(.data, ..., sorted = TRUE)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>.data</code></td>
<td>
<p>A <code>list</code> or <code>vector</code></p>
</td></tr>
<tr valign="top"><td><code>...</code></td>
<td>
<p>keys</p>
</td></tr>
<tr valign="top"><td><code>sorted</code></td>
<td>
<p><code>TRUE</code> to sort the group keys. Ignored when the key has
multiple entries.</p>
</td></tr>
</table>


<h3>Value</h3>

<p>a list of possible cases each of which contains elements belonging to
the case non-exclusively.
</p>


<h3>Examples</h3>

<pre>
x &lt;-
  list(
    p1=list(name='Ken',age=24,
      interest=c('reading','music','movies'),
      lang=list(r=2,csharp=4,python=3)),
    p2=list(name='James',age=25,
      interest=c('sports','music'),
      lang=list(r=3,java=2,cpp=5)),
    p3=list(name='Penny',age=24,
      interest=c('movies','reading'),
      lang=list(r=1,cpp=4,python=2)))
list.class(x,interest)
list.class(x,names(lang))
</pre>


</body></html>
