creates packages their own way… but here’s a conclusive guide of the steps I follow. I’ll be coming back to this frequently, so watch this space.

## Do once stuff:

• Download R and Rstudio, but you should alreay know that :)
• git config --global user.email "you@example.com"
• git config --global user.name "Your Name"
• Download Rtools by going here: https://cran.rstudio.com/bin/windows/Rtools/Rtools35.exe

OK, now you’re ready for the rest:

## to set up a package:

• Create new project, new R package, and make sure to enable git!

• delete hello.R from the /R folder

• delete hello.Rd from the /man folder (the documentation)

• Modify the DESCRIPTION file to say what you’re doing

• next, we’ll be engaging easymode using usethis. So first call library(usethis)

• use_testthat() for easy testing

• use_readme_rmd() to make it easy to make an easy frontpage for your package’s website AND a front-page to the github repo. Saving time for the win!

• usethis::use_lifecycle_badge(stage = "Experimental") to show that this is a brand new package. Eventually you’ll be moving to “Maturing” or “Stable”. Copy the markdown into your README.Rmd

• use_cran_badge() to show how if you’re on CRAN or not. Like above, Copy the markdown into your README.Rmd.

• now copypaste your functions file into R, or create a new file in R and write new functions.

• Now documentation. Make sure you’ve installed sinew. To do it, run entire function, then doubleclick your title and run sinew’s createOxygen addin. It will automatically add all the guts required for documentation. In order to save time, it’s better to use explicit package::function notation at least once per function, as this will be picked up by sinew and will automatically add in @importFrom blocks.

• Ok, presumably, you’ve added some dependencies to other packages as mentioned above. Next step is to make sure that the DESCRIPTION file knows about this. So go to that file and put the package name under a new Imports: section.

• Under the build menu, go to more and Configure Build tools to build documentation each time every time you Install and Restart. This way you don’t have to ever think of it again. Eventually if you have tons of documentation you might want to remove that.

## Quality Control:

• When trying to CHECK your package:
• Make sure to delete crap every time! When you build, it’ll create a .Rcheck folder as well as the .tar file. Make sure to delete these everytime you try to check your package, as they cause no end of nonsense.
• You might see a ton of errors like below. This might be one of two things:

no visible binding for global variable blah

• you have maybe forgotten to @importFrom some functions. Make sure all of these are perfectly done or your package will probably be buggy.
• you have used tidyverse (to be precise, the NSE portion of it), and it doesn’t know that “Species” is iris$Species. In order to eliminate this error, evertime you’ve used Species alone, you are going to have to replace it with .data$Species AND make sure that you add @importFrom rlang .data to each function where this is an issue (but this is kinda a major pain and might introduce several bugs, so it might not be worth fixing).

## When you’re kinda finished:

• use_pkgdown() to have a nice website for our package. Ignore the yml file for now
• pkgdown::build_site() will build the documentation site. You’ll have to do this frequently, before every major build I think.
• If you’ve done this, you’ll have 3 places to make write stuff: In the documentation for each function’s Roxygen text, in README.Rmd (make sure to knit every time), and in the DESCRIPTION. Give a final look.
• git commit everything
• use_github(protocol = "https") to set yourself up in github (CAREFUL, this will make your work public… you might want to consider private = TRUE if you want it to be kept private. If it protests about no github auth_token, you’ll have to set one up, but the usethis instructions are kinda clear, follow them.
• OK, you’re on github! Last step, make the package website visible. Go into the repo’s Settings page (careful to not enter github settings), and under Github Pages, mark the docs folder as the source. This will pop up a URL. Copy it.

• Now go back and click on the Edit butotn on the top right hand side of your your Repo’s title, and paste that URL into the Website textbox.

## Extra stuff to consider

• use_vignette` if you’re building something cool that other people are supposed to use, then you should probably show them HOW to use it. That’s what a vignette is for.
• Travis-CI. It’s super useful but can be tough to set up, don’t want to get into the whole thing now.