Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Are you sure the <em>R</em> versions are compatible here? The internal parts of <code>ecdf()</code> and <code>approxfun()</code> objects {yes, they <em>are</em> functions} have been changed relatively recently and now go via the <code>.approxfun(..)</code> wrapper which is a hidden in the "stats" namespace.</p> <p>But I really assume the problem comes because you use data(.) in order to use such objects in your package, and on R package building, R may resave the data and ends up losing the important property that <code>environment(fc)</code> must have <code>"stats"</code> as a parent environment. </p> <pre><code>&gt; set.seed(7); Fn &lt;- ecdf(rnorm(12)) &gt; save(Fn, file="/tmp/Fn.rda") &gt; rm(Fn) &gt; load(file="/tmp/Fn.rda") &gt; Fn Empirical CDF Call: ecdf(rnorm(12)) x[1:12] = -1.1968, -0.97067, -0.94728, ..., 2.2872, 2.7168 &gt; plot(Fn) &gt; Fn(1) [1] 0.75 &gt; q() ... restart R &gt; (load(file="/tmp/Fn.rda")) [1] "Fn" &gt; Fn(1) [1] 0.75 &gt; parent.env(environment(Fn)) &lt;environment: namespace:stats&gt; </code></pre> <p>So everything works with regular save()ing and load()ing of ecdf objects.</p> <p>Solution proposal: Don't use <code>data()</code> for storing objects that are used inside your functions. <code>data()</code> is not at all thought for this (but rather for providing illuminating data sets).</p> <p>Rather put it into something like /inst/internal/ecdf_lst.rda and get it into your function by something like <code>load(system.file("internal/ecdf_lst.rda", package="&lt;pkg&gt;"))</code></p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload