Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Midterm project #13

Closed
chipmanj opened this issue Feb 28, 2023 · 11 comments
Closed

Midterm project #13

chipmanj opened this issue Feb 28, 2023 · 11 comments

Comments

@chipmanj
Copy link
Collaborator

@UofUEpiBio/phs7045-2023

The midterm project is online and can be found here.

More details are on the posted assignment, but in general your task is to: Develop an R package that solves a problem. This could be from your own research or you may get approval to do a related but modified example from (posted projects).

Today we'll talk through the midterm requirements, and this week through next Tuesday you'll have time in class to work on the project. It will be due next Thursday (March 9th).

Please think ahead of class today of what problem your R package will solve. This way you can use your time productively to start working on the package.

@hyejung0
Copy link

Hi @chipmanj and @gvegayon ,
For some reason the parallel using detect all available core was not working. When I googled about it, there was one Stack exchange thread saying that CRAN doesn't allow more than 2 cores for parallel when building package. When I changed my code to include just 2 cores, it worked fine. Is there any other parallel function that uses more than 2 cores?

@gvegayon
Copy link
Member

@hyejung0, what CRAN doesn't allow is to run R CMD check with more than two threads. It is OK to have a package that uses detectCores(), but all examples and vignettes must avoid using more than two threads.

hyejung0 added a commit to hyejung0/PHS7045-midterm that referenced this issue Mar 15, 2023
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"
@Daniel-K-Addo
Copy link

@gvegayon @chipmanj
I've pushed some files to Github but I wasn't sure about these ones preceded with the dot. Are any of these OKAY to be pushed as well? Screenshot is attached, hopefully.
image

@gvegayon
Copy link
Member

Hi all,

Here is a tip for better debugging. If you ever find yourself not knowing what's going on, for example, within a thread in a call to parallel::parLapply, you can always wrap pieces of code around a tryCatch function, e.g.,:

tryCatch({ code that may break }, error = function(e) e)

If { code that may break } fails, instead of stopping, the error will be captured. I usually do something like this:

res <- tryCatch({
  ...code that probably breaks...
}, error = function(e) e)

# Checking if the code failed
if (inherits(res, "error"))
  stop("OK, there's an error in ...")

Hope it helps!

@gvegayon
Copy link
Member

@Daniel-K-Addo, of those files, you only want to share .Rbuildignore and .gitignore. Neither .RData nor .Rhistory shouldn't be shared. Remember you can remove files with the command git rm --cached, the later flag to "avoid removing them physically."

@Daniel-K-Addo
Copy link

@gvegayon Thank you. I have another question. How could the tar.gz file be made available on GitHub since it is not included it in the main project folder? Looking for suggestions or best practice recommendations.

EricAnto0 added a commit to EricAnto0/Modana that referenced this issue Mar 16, 2023
@gvegayon
Copy link
Member

If you want to distribute a built version of your R package, the best way is through releases. Each release generates a tag (labeled snapshot) of your project, and you can include whatever files you want, for example, binaries for windows and osx.

SinghRavin added a commit to SinghRavin/BackPropNN that referenced this issue Mar 16, 2023
SinghRavin added a commit to SinghRavin/BackPropNN that referenced this issue Mar 16, 2023
Daniel-K-Addo added a commit to Daniel-K-Addo/WalkingDead2 that referenced this issue Mar 16, 2023
rberch added a commit to rberch/VIF-package that referenced this issue Mar 16, 2023
rberch added a commit to rberch/VIF-package that referenced this issue Mar 16, 2023
KPDuBose added a commit to KPDuBose/partyGames that referenced this issue Mar 16, 2023
hyejung0 added a commit to hyejung0/PHS7045-midterm that referenced this issue Mar 16, 2023
The version I presented in the class today.

UofUEpiBio/PHS7045-advanced-programming#13
Haojia-biostat added a commit to Haojia-biostat/ImbLassoRcpp that referenced this issue Mar 17, 2023
@gvegayon
Copy link
Member

Hey @UofUEpiBio/phs7045-2023, I've started a few pull requests [PR] to comment on your R packages. Take a look at the Pull requests tab in your repo. If you don't see any PR, be patient, I'll try to get there today.

@hyejung0
Copy link

@gvegayon
I can't even push my stuff to Github anymore. I think it has to do with some pull request you sent that I merged before. That was the error message. I have question about my code because now I'm getting some error messages with regards to number of cores for running parallel. Can I possibly meet up with you in person to discuss about these two matters?

@gvegayon
Copy link
Member

gvegayon commented Mar 29, 2023 via email

hyejung0 added a commit to hyejung0/PHS7045-midterm that referenced this issue Mar 29, 2023
…y to run the example code that's provided for boots.lmer funciton, especially this line below:

lmer.out<-boots.lmer(y="Y", X=c("X1","X2","X3"), dat=example.dat, boots.samples.list = output)

I get the following error:

Warning message:
In parallel::mclapply(boots.samples.list, function(boots.dat) { :
  all scheduled cores encountered errors in user code

But if you check my boots.lmer function, I set the number of cores to 2 so that it can pass CRAN check and all that so I'm not sure why I'm getting this error. Any suggestions?

UofUEpiBio/PHS7045-advanced-programming#13
@gvegayon
Copy link
Member

The midterm continues in issue #15 instead.

@UofUEpiBio UofUEpiBio locked as resolved and limited conversation to collaborators Mar 30, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants