UofUEpiBio / PHS7045-advanced-programming

https://uofuepibio.github.io/PHS7045-advanced-programming
3 stars 4 forks source link

Midterm project #13

Closed chipmanj closed 1 year ago

chipmanj commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@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.

Daniel-K-Addo commented 1 year ago

@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 commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

@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.

gvegayon commented 1 year ago

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.

gvegayon commented 1 year ago

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 commented 1 year ago

@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 commented 1 year ago

Did you pull the changes? Before pushing, you should always pull changes.

George G. Vega Yon, Ph.D. +1 (626) 381 8171 https://ggvy.cl Pronouns https://www.aclunc.org/article/frequently-asked-questions-whats-pronoun: he/him/él

On Wed, Mar 29, 2023 at 11:22 AM Hyejung Lee @.***> wrote:

@gvegayon https://github.com/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?

— Reply to this email directly, view it on GitHub https://github.com/UofUEpiBio/PHS7045-advanced-programming/issues/13#issuecomment-1489007100, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAG2FMYIZ46G26T5R4Z2K5LW6RVVRANCNFSM6AAAAAAVKYI4DE . You are receiving this because you were mentioned.Message ID: @.***>

gvegayon commented 1 year ago

The midterm continues in issue https://github.com/UofUEpiBio/PHS7045-advanced-programming/issues/15 instead.