Skip to content

Commit

Permalink
Hi George @gvegayon,
Browse files Browse the repository at this point in the history
I have something funky going on with mclapply function. Please refer to "create_lmer_fits.Rms" vignette file. Starting at line 70, When I apply boots.lmer function to just one bootstrap data set (the 100th bootstrap data out of 5000), I don't get any error. But when I apply boots.lmer to the first 100 bootstrap samples, I get error. The error says: 'Warning in parallel::mclapply(boots.samples.list, function(boots.dat) { :
  all scheduled cores encountered errors in user code'.
Could you please look into it? Thank you!

"UofUEpiBio/PHS7045-advanced-programming#13"
  • Loading branch information
hyejung0 committed Mar 15, 2023
1 parent 4dd13b7 commit 982765e
Show file tree
Hide file tree
Showing 20 changed files with 314 additions and 237 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
.Rproj.user
.Rhistory
.RData
.Ruserdata
4 changes: 2 additions & 2 deletions boots.lmer.Rcheck/00_pkg_src/boots.lmer/DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Roxygen: list(markdown = TRUE)
RoxygenNote: 7.2.3
Suggests: knitr, rmarkdown
VignetteBuilder: knitr
Imports: data.table
Depends: data.table, lme4, rlang, parallel, stringr
NeedsCompilation: no
Packaged: 2023-03-14 21:35:01 UTC; u1317537
Packaged: 2023-03-14 22:14:56 UTC; u1317537
Author: Hyejung Lee [aut, cre] (<https://orcid.org/0000-0002-5293-4134>)
Maintainer: Hyejung Lee <[email protected]>
1 change: 0 additions & 1 deletion boots.lmer.Rcheck/00_pkg_src/boots.lmer/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,3 @@

export(boots.lmer)
export(boots.samples)
import(data.table)
7 changes: 4 additions & 3 deletions boots.lmer.Rcheck/00_pkg_src/boots.lmer/R/boots.samples.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@
#' "subjects"=example.subject)
#' output<-boots.samples(dat=example.dat,sub.id = "subjects",B=4) #create 4 bootstrap samples
#' output[[1]] #This is the first one!
#' @import data.table
#' @export
boots.samples<-function(dat, sub.id,B){

Expand Down Expand Up @@ -49,8 +48,10 @@ boots.samples<-function(dat, sub.id,B){
#bind the index and no.repeat.id. as rows
temp.dat<-do.call(rbind, lapply(temp, data.table::data.table))
complete.dat<-data.table::as.data.table(dat[temp.dat$index,])
complete.dat[,no.repeat.sub.id:=(temp.dat$no.repeat.id)] # add the new subject ID column, with no repetition
}
# complete.dat[,no.repeat.sub.id:=(temp.dat$no.repeat.id)] # add the new subject ID column, with no repetition
complete.dat[,"no.repeat.sub.id"]<-temp.dat$no.repeat.id
return(complete.dat)
}
)

output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,18 @@ <h1 class="title toc-ignore">create_bootstrap_samples</h1>



<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(boots.lmer)</span></code></pre></div>
<div class="sourceCode" id="cb1"><pre class="sourceCode r"><code class="sourceCode r"><span id="cb1-1"><a href="#cb1-1" aria-hidden="true" tabindex="-1"></a><span class="fu">library</span>(boots.lmer)</span>
<span id="cb1-2"><a href="#cb1-2" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; Loading required package: data.table</span></span>
<span id="cb1-3"><a href="#cb1-3" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; Loading required package: lme4</span></span>
<span id="cb1-4"><a href="#cb1-4" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; Loading required package: Matrix</span></span>
<span id="cb1-5"><a href="#cb1-5" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; Loading required package: rlang</span></span>
<span id="cb1-6"><a href="#cb1-6" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; </span></span>
<span id="cb1-7"><a href="#cb1-7" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; Attaching package: &#39;rlang&#39;</span></span>
<span id="cb1-8"><a href="#cb1-8" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; The following object is masked from &#39;package:data.table&#39;:</span></span>
<span id="cb1-9"><a href="#cb1-9" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; </span></span>
<span id="cb1-10"><a href="#cb1-10" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; :=</span></span>
<span id="cb1-11"><a href="#cb1-11" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; Loading required package: parallel</span></span>
<span id="cb1-12"><a href="#cb1-12" aria-hidden="true" tabindex="-1"></a><span class="co">#&gt; Loading required package: stringr</span></span></code></pre></div>
<p>This vignette contains a walk-through of <code>boots.lmer::boots.samples</code> function.</p>
<p>The <code>boots.samples</code> function produces a list of bootstrap samples, made especially for longitudinal data. Longitudinal data formatted where multiple observations should be chosen cautiously when sampling for boostrap:</p>
<ol style="list-style-type: decimal">
Expand Down
Loading

0 comments on commit 982765e

Please sign in to comment.