Chapter 2 Start Here: Example Scripts

This is a manual for the R tools hosted at our GitHub repository. A RStudio tutorial is beyond the scope of this readme, but there are great resources to get you started with installing R and RStudio.

How to use GitHub

Getting Set Up

  1. Create an account.
  2. Work through chapters 6-12 here if you need to install git, and connect it all with RStudio:
  3. Choose your own adventure from here: do you want the working branch you created synced with the main repository, or do you want your main branch synced? Once you’ve decided, move onto the next step.
  • having your working branch synced makes sure you can easily pull the latest files into your work space, but to work around that you should make your own copies of files you alter to make sure files don’t conflict when you pull updates
  • having your main branch synced is a bit more of a conventional structure, and means that changes pulled won’t automatically propagate to your working branch. you could e.g. pull changes to the main branch, and use that as a reference to see what changes you want to pull into your working copy, and resolve conflicts before merging
  1. Follow the instructions (at least through 5) here under “How to do this using RStudio and GitHub?”
  • the repository to fork
  • you don’t need to enter the back ticks in the shell
  • this example is a bit misleading because it doesn’t include the .git, copy the link to the clipboard like before
  • RESTART RSTUDIO BEFORE MOVING ONTO STEP 6 IN THIS TUTORIAL
  1. If you want to pull updates from here to your copy, see chapter 31.

Result

By following these instructions, you should now…

  • have a local copy of the repository

  • be working on your own branch

  • have an upstream connection to the main CTT repository

  • “example.R” shows you example implementations of the data management and node health functions (also read comments, functions that produce files are commented out)

  • “locate_example.R” is a template script for running the location functions

I suggest making your own copy of these scripts, renaming them, and modifying them with your file path inputs.