"This tutorial will take you through the steps of creating a new package in R.
There are five primary tasks:
Create a package skeleton (set of empty files and folders). Add your R code to the skeleton directory. Create documentation for your package (similar to knitting RMD files). Install your new package on your computer and test it out. Upload the package to GitHub."
To start making your own package, youre going to want to go to the rop right where it says R project and click new.
New Project
New Directory
Description
Function
Double check work
Youll have to repeat this step as many times as you have functions !
Check Function
Youll have to repeat this step as many times as you have functions !
You have a couple of options for sharing your new package with others. You could submit the package to the CRAN so that everyone in the world could install it in R using install.packages(“montyhall”).
We cannot use this option because (1) it’s a homework assignment so we don’t want to burden people with the task of reviewing a new package, (2) package names on the CRAN must be unique so everyone from the class would have to name it something different, and (3) the CRAN requires that the package passes some robustness checks to ensure everything is documented correctly and all of the code is running smoothly.
A simpler option is to host your package on GitHub. Complete the following steps to upload your code to a new repository on GitHub:
This last step sends all of the files to GitHub. They sould appear on your repo page shortly.
Now others should be able to install your package by typing:
devtools::install_github( “yourGitHubName/montyhall” )
There might be an extra package that you might have to download called Rtools. website is https://cran.r-project.org/bin/windows/Rtools/ its very easy to follow along.