Note that there are some explanatory texts on larger screens.

plurals
  1. POhow an ecdf object can be used inside an R package?
    text
    copied!<p>I am trying to build an <code>R</code> package and it has several <em>ecdf</em> objects in it. They have been created by ecdf(some variables such as p1). I put them in a list and save that as <em>rda</em> file in data folder, however when I run the function inside the package (suppose named b1) after installing the package I got the following error:</p> <pre><code>b1(zzz[1,]) (zzz is a data frame and I ran the function on one row of it) Error in fc(p1) : could not find function ".approxfun" </code></pre> <p>fc is a ecdf function stored in the saved list, I called the list by data(list1), and then <code>fc&lt;-list[[1]]</code>, inside the function. </p> <p>I also did data(list1), and when I typed: <code>fc&lt;-list1[[1]]</code>, I can see fc as an ecdf object, but when I type <code>fc(1)</code>, I got the following error:</p> <pre><code>Error in fc(1) : could not find function ".approxfun" </code></pre> <p>If I give the choice to R to choose fc as a function or data, when I used package.skeleton and put fc in mylist, it chooses as a function, and creates fc.R, but it does not run, something like this will be saved in fc.R:</p> <pre><code>fc &lt;- structure(function (v) .approxfun(x, y, v, method, yleft, yright, f), class = c("ecdf", "stepfun", "function"), call = quote(ecdf(yyy$p1))) </code></pre> <p>however the object fc is:</p> <pre><code>Empirical CDF: 4825 unique values with summary &lt;br/&gt; Min. 1st Qu. Median Mean 3rd Qu. Max. &lt;br/&gt; 0.01227 0.03857 0.05602 0.10730 0.15250 0.68020 &lt;br/&gt; </code></pre> <p>I really appreciate any help that I can get. Thank you very much for your time in advance. I think I need to figure it out that how should I save fc for the building package. The stats library version is 3.0.1 (I thought that could be the reason, but do not know.) </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