EVOLUTION-MANAGER
Edit File: eapply.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: Apply a Function Over Values in an Environment</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 eapply {base}"><tr><td>eapply {base}</td><td style="text-align: right;">R Documentation</td></tr></table> <h2>Apply a Function Over Values in an Environment</h2> <h3>Description</h3> <p><code>eapply</code> applies <code>FUN</code> to the named values from an <code><a href="environment.html">environment</a></code> and returns the results as a list. The user can request that all named objects are used (normally names that begin with a dot are not). The output is not sorted and no enclosing environments are searched. </p> <p>This is a <a href="Primitive.html">primitive</a> function. </p> <h3>Usage</h3> <pre> eapply(env, FUN, ..., all.names = FALSE, USE.NAMES = TRUE) </pre> <h3>Arguments</h3> <table summary="R argblock"> <tr valign="top"><td><code>env</code></td> <td> <p>environment to be used.</p> </td></tr> <tr valign="top"><td><code>FUN</code></td> <td> <p>the function to be applied, found <em>via</em> <code><a href="match.fun.html">match.fun</a></code>. In the case of functions like <code>+</code>, <code>%*%</code>, etc., the function name must be backquoted or quoted.</p> </td></tr> <tr valign="top"><td><code>...</code></td> <td> <p>optional arguments to <code>FUN</code>.</p> </td></tr> <tr valign="top"><td><code>all.names</code></td> <td> <p>a logical indicating whether to apply the function to all values.</p> </td></tr> <tr valign="top"><td><code>USE.NAMES</code></td> <td> <p>logical indicating whether the resulting list should have <code><a href="names.html">names</a></code>.</p> </td></tr> </table> <h3>Value</h3> <p>A named (unless <code>USE.NAMES = FALSE</code>) list. Note that the order of the components is arbitrary for hashed environments. </p> <h3>See Also</h3> <p><code><a href="environment.html">environment</a></code>, <code><a href="lapply.html">lapply</a></code>. </p> <h3>Examples</h3> <pre> require(stats) env <- new.env(hash = FALSE) # so the order is fixed env$a <- 1:10 env$beta <- exp(-3:3) env$logic <- c(TRUE, FALSE, FALSE, TRUE) # what have we there? utils::ls.str(env) # compute the mean for each list element eapply(env, mean) unlist(eapply(env, mean, USE.NAMES = FALSE)) # median and quartiles for each element (making use of "..." passing): eapply(env, quantile, probs = 1:3/4) eapply(env, quantile) </pre> <hr /><div style="text-align: center;">[Package <em>base</em> version 3.6.0 <a href="00Index.html">Index</a>]</div> </body></html>