vignettes/140_packaging.Rmd
140_packaging.Rmd
When organizing your analyses for a research project, it’s important to maximize two aspects: reproducibility and ease of sharing. This will make the life of your collaborators, and crucially the life of “future you”, much easier. R packages provide a great tool to create collaborative and reproducible code. An R package bundles together the data your project requires, custom-made functions that can be used throughout your code, vignettes that describe your analyses step-by-step, and a thorough documentation that helps you and others to reproduce your analyses in the future. In practice, creating an R package boils down to:
Once you have populated your package (even just a little), you are ready to build it. This can be done directly from RStudio, inside the R project containing your package. If this is your first package even, go to Build > Configure Build Tools… Here you should tick the checkbox Generate documentation with Roxygen and then tick Build & Reload in the window this prompts. You can now build your package. Go to Build > Build and Reload (or Clean and Rebuild, depending on the version). This will build your package and install it. You can now load it using library(packagename)
and start calling your functions.
Temple University, jmg5214@gmail.com↩︎
Temple University, sebastiano.debona@gmail.com↩︎
Temple University, mrhelmus@temple.edu↩︎
Temple University, jebehm@temple.edu↩︎