<!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: Ensure that the class of the control list is one of those...</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" type="text/css" href="https://rpkg.net/assets/examples.css" />
</head><body>

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

<h2>Ensure that the class of the control list is one of those that can
be used by the calling function</h2>

<h3>Description</h3>

<p>This function converts an ordinary <code>list</code> into a control list (if
needed) and checks that the control list passed is appropriate for
the function to be controlled.
</p>


<h3>Usage</h3>

<pre>
check.control.class(
  OKnames = as.character(ult(sys.calls(), 2)[[1L]]),
  myname = as.character(ult(sys.calls(), 2)[[1L]]),
  control = get("control", pos = parent.frame())
)
</pre>


<h3>Arguments</h3>

<table summary="R argblock">
<tr valign="top"><td><code>OKnames</code></td>
<td>
<p>List of control function names which are acceptable.</p>
</td></tr>
<tr valign="top"><td><code>myname</code></td>
<td>
<p>Name of the calling function (used in the error
message).</p>
</td></tr>
<tr valign="top"><td><code>control</code></td>
<td>
<p>The control list or a list to be converted to a
control list using <code>control.myname()</code>. Defaults to the
<code>control</code> variable in the calling function. See Details for
detailed behavior.</p>
</td></tr>
</table>


<h3>Details</h3>

<p><code>check.control.class()</code> performs the check by looking up
the class of the <code>control</code> argument (defaulting to the <code>control</code>
variable in the calling function) and checking if it matches a
list of acceptable given by <code>OKnames</code>.
</p>
<p>Before performing any checks, the <code>control</code> argument (including
the default) will be converted to a control list by calling
<code>as.control.list()</code> on it with the first element of <code>OKnames</code> to
construct the control function.
</p>
<p>If <code>control</code> is missing, it will be assumed that the user wants
to modify it in place, and a variable with that name in the
parent environment will be overwritten.
</p>


<h3>Value</h3>

<p>A valid control list for the function in which it is to be
used. If <code>control</code> argument is missing, it will also overwrite
the variable <code>control</code> in the calling environment with it.
</p>


<h3>Note</h3>

<p>In earlier versions, <code>OKnames</code> and <code>myname</code> were
autodetected. This capability has been deprecated and results in
a warning issued once per session. They now need to be set
explicitly.
</p>


<h3>See Also</h3>

<p><code>set.control.class()</code>, <code>print.control.list()</code>, <code>as.control.list()</code>
</p>


</body></html>
