Getting started with GIT and Github
By now you should have installed GIT on your computer and created a Github account. As a quick reminder here are the links:
Rmarkdown and Homework 01
We will also go through the Rmarkdown document and associated R code to get you started working with a dataset and running some statistics and making some plots with R code. See the files at the Github repository for Homework 2.
Create an R Project Linked to Github
- Open RStudio
- Click File/New Project
- Choose Version Control
- Choose GIT
- Go to YOUR Github repository for Homework 2, click “Clone or Download” and click the little icon to the right of the URL to copy the link to the clipboard
- Go back to RStudio and paste in the URL
- Make sure the “Project Directory Name” matches the name of the repository.
- Make sure you are creating the new project directory in the folder on your ocmputer you prefer.
Work on your homework - RStudio Project
Now you are working in your repository.
- Open the RMD file - this is the Rmarkdown file with text and code combined.
- To get help on Rmarkdown, click Help/Markdown Quick Reference. You can also get help online at https://bookdown.org/yihui/rmarkdown/ and at https://rmarkdown.rstudio.com/
- Follow the instructions for the homework to update your document and R code as needed.
- SAVE YOUR WORK. When you are finished “KNIT” your document by clicking on the little blue icon that looks like a ball of yarn, and choose “Knit to HTML” or “Knit to Word”. Once you have created these files you can then save the document as a PDF.
- OPTIONAL - if you want to “Knit to PDF” directly inside RStudio, you need to install a
- option 1 (recommended) - install the
tinytex R package - click on Tools/Install Packages and type in
tinytex. Follow the instructions at https://yihui.name/tinytex/ - after installing run these 2 lines of code in your console:
tinytex::install_tinytex() to make sure the package is installed and ready to go
tinytex::pdflatex('test.tex') - to test if a PDF document gets created
- option 2 (for those that want to do more with
LaTeX) - If you want to do more with
LaTeX you’ll need a standalone program. Here are the download sites and installation options for Windows or Mac users:
Save and Submit your homework
- Make sure you save all your files in your homework repository
- Backup/Sync your files with your Github repository
- Click on Terminal tab (next to Console)
- Type in these GIT commands
git status to see your updated files
git add . to add all currently changed or new files
git commit -m "my message here" to commit your files, include an informative message about this commit
git push to move these changes up to the cloud to your Github repository
git status to check to make sure everything is ready to go
- SUBMIT your homework file(s) - usually a PDF document - to Canvas by the posted deadline
Copyright © Melinda Higgins, Ph.D.. All contents under (CC) BY-NC-SA license, unless otherwise noted.
Feedback, Comments (email me)?