Repository for the 2025 ICA Pre-Conference Hackathon Breakout Session
- You can code in R
- You know (more or less) how to define a function
Wickham, H., & Bryan, J. (2023). R Packages: Organize, Document, and Share Your Code. O'Reilly Media. Link: https://r-pkgs.org/
install.packages(devtools)
install.packages(usethis)
usethis::create_package("myfirstpkg")
get_sd <- function(x){
stats::sd(x)
}
Heres are some useful functions to have, I will explain it later...
usethis::use_mit_license()
usethis::use_package("stats")
devtools::document()
Again, some useful functions:
usethis::use_git()
usethis::gh_token_help()
usethis::create_github_token()
gitcreds::gitcreds_set()
If you follow the steps, you would have written your first package. Seriously, it is that simple.
usethis::use_release_issue()
You could use the follow code to install (before putting it on CRAN)
devtools::install_github("justinchuntingho/myfirstpkg")
- Readme
- Vignette
- Unit tests
- Bug reports
- Get good at Git (optional, but seriously you would thank yourself in the future)
- Get good at R (optional, but very useful. For example this: https://adv-r.hadley.nz/index.html)
- Write a software paper (for example, Journal of Open Source Software)