EVOLUTION-MANAGER
Edit File: vec_is_list.html
<!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: List checks</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 vec_is_list {vctrs}"><tr><td>vec_is_list {vctrs}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>List checks</h2> <h3>Description</h3> <ul> <li> <p><code>vec_is_list()</code> tests if <code>x</code> is considered a list in the vctrs sense. It returns <code>TRUE</code> if: </p> <ul> <li> <p><code>x</code> is a bare list with no class. </p> </li> <li> <p><code>x</code> is a list explicitly inheriting from <code>"list"</code>. </p> </li></ul> </li> <li> <p><code>list_all_vectors()</code> takes a list and returns <code>TRUE</code> if all elements of that list are vectors. </p> </li> <li> <p><code>list_all_size()</code> takes a list and returns <code>TRUE</code> if all elements of that list have the same <code>size</code>. </p> </li> <li> <p><code>vec_check_list()</code>, <code>list_check_all_vectors()</code>, and <code>list_check_all_size()</code> use the above functions, but throw a standardized and informative error if they return <code>FALSE</code>. </p> </li></ul> <h3>Usage</h3> <pre> vec_is_list(x) vec_check_list(x, ..., arg = caller_arg(x), call = caller_env()) list_all_vectors(x) list_check_all_vectors(x, ..., arg = caller_arg(x), call = caller_env()) list_all_size(x, size) list_check_all_size(x, size, ..., arg = caller_arg(x), call = caller_env()) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>x</code></td> <td> <p>For <code style="white-space: pre;">vec_*()</code> functions, an object. For <code style="white-space: pre;">list_*()</code> functions, a list.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>These dots are for future extensions and must be empty.</p> </td></tr> <tr valign="top"><td><code>arg</code></td> <td> <p>An argument name as a string. This argument will be mentioned in error messages as the input that is at the origin of a problem.</p> </td></tr> <tr valign="top"><td><code>call</code></td> <td> <p>The execution environment of a currently running function, e.g. <code>caller_env()</code>. The function will be mentioned in error messages as the source of the error. See the <code>call</code> argument of <code><a href="../../rlang/html/abort.html">abort()</a></code> for more information.</p> </td></tr> <tr valign="top"><td><code>size</code></td> <td> <p>The size to check each element for.</p> </td></tr> </table> <h3>Details</h3> <p>Notably, data frames and S3 record style classes like POSIXlt are not considered lists. </p> <h3>See Also</h3> <p><code><a href="vec_size.html">list_sizes()</a></code> </p> <h3>Examples</h3> <pre> vec_is_list(list()) vec_is_list(list_of(1)) vec_is_list(data.frame()) list_all_vectors(list(1, mtcars)) list_all_vectors(list(1, environment())) list_all_size(list(1:2, 2:3), 2) list_all_size(list(1:2, 2:4), 2) # `list_`-prefixed functions assume a list: try(list_all_vectors(environment())) </pre> <hr /><div style="text-align: center;">[Package <em>vctrs</em> version 0.5.0 <a href="00Index.html">Index</a>]</div> </body></html>