Module I · Day 1 · 1 hour
Department of Quantitative Methods in Economics and Management · ULPGC
Department of Quantitative Methods in Economics and Management · ULPGC
April 23, 2026
analysis_final_v3_reallyfinal.R.Important
In this course every exercise you submit lives on GitHub. The workflow has to be working for you by the end of this hour.
| Git | GitHub | |
|---|---|---|
| What it is | A tool that tracks changes | A web service that hosts Git projects |
| Runs | Locally, on your laptop | On github.com |
| Needed for | Any version control at all | Sharing, collaboration, PRs |
| Cost | Free, open source | Free for public repos and education |
You need both: Git installed locally, a GitHub account online.
┌─────────────┐ git add ┌─────────────┐ git commit ┌────────────────┐
│ Working │ ──────────▶ │ Staging │ ───────────▶ │ Local repo │
│ directory │ │ (index) │ │ (your laptop) │
└─────────────┘ └─────────────┘ └────────────────┘
│
git push │
▼
┌────────────────┐
│ GitHub remote │
└────────────────┘
In this course you drive every arrow from RStudio’s Git pane, not from a terminal.
brew install git, or install the Xcode Command Line Tools.sudo apt install git (Debian/Ubuntu) or sudo dnf install git (Fedora).After install, restart RStudio. It detects Git automatically.
From the R console:
Every commit you ever make will be signed with this name and email. Use the same email you will register with on GitHub (next step).
Create a GitHub account at https://github.com/signup with your ULPGC email. Apply for the free Student Developer Pack — private repos, Copilot and more.
Create a Personal Access Token (PAT) from R:
The browser opens on GitHub. Leave the fields as prefilled, confirm 90 days, click Generate token. Copy the token immediately — GitHub never shows it again.
Back in R, paste the token into the credential store:
All rows should show ✅ green. If anything is red, re-run the step the report points to.
flowchart LR A[chrglez/<br/>course repo] -->|fork| B[yourname/<br/>course fork] B -->|clone| C[RStudio on<br/>your laptop] C -->|commit + push| B B -->|Pull Request| A A -->|review comments| B A -.->|Sync fork<br/>web button| B
The dashed arrow is the Sync fork button on GitHub — that’s how you pull course updates into your fork without a terminal.
chrglez:main.Go to https://github.com/chrglez/quantitative-methods-master-tides.
Click Fork (top-right). GitHub asks for a name — leave the default. Keep “Copy the main branch only” ticked.
You land on your own copy: github.com/<your-user>/quantitative-methods-master-tides.
On your fork’s page, click Code → HTTPS and copy the URL.
In RStudio:
~/Documents or equivalent — not Desktop or OneDrive).RStudio clones, opens the project, and the Git pane appears in the top-right.
upstream remote (safety net)Note
Main way to sync · the Sync fork button on GitHub. This step adds an upstream reference locally as a backup, in case you ever need to sync from RStudio instead of the web.
Inside RStudio, open Tools → Terminal → New Terminal and paste:
The second line should print two remotes: origin (your fork) and upstream (the course repo). Close the terminal — in the daily flow you sync from the GitHub web button.
For the alternative ways to sync a fork, see GitHub’s docs: https://docs.github.com/es/pull-requests/collaborating-with-pull-requests/working-with-forks/syncing-a-fork.
mainThe main branch of your fork is a read-only mirror of the course repo. If you accidentally commit to it, syncing with upstream becomes painful.
Every day you work on a new branch, named after the day: day-1, day-2, … day-6.
If in doubt, look at the branch selector at the top-right of the Git pane. It always tells you where you are.
gitGraph commit id: "course v0" commit id: "sync from upstream" branch day-1 checkout day-1 commit id: "Day 1 solution" checkout main commit id: "sync from upstream" branch day-2 checkout day-2 commit id: "Day 2 solution" checkout main commit id: "sync from upstream" branch day-3 checkout day-3 commit id: "Day 3 solution"
main is a mirror of the course repo — it only moves forward via Sync fork, never by your commits.day-N branch carries one day’s work and becomes one PR.Go to github.com/<your-user>/quantitative-methods-master-tides.
If Christian updated the course repo while you were away, a banner appears:
This branch is N commits behind
chrglez:main· Sync fork ▼
Click it → Update branch. Done, one click.
Then in RStudio’s Git pane click Pull (blue down arrow) to bring those commits to your laptop.
In the Git pane (top-right of RStudio):
day-1 (or day-N).You are now on day-1, main is safe.
Open exercises/day1/exercise-template.R. Fill in your solutions using what we covered in Data in R. Save (Ctrl + S).
Run the script top-to-bottom (Ctrl + Shift + Enter) to confirm it runs without errors.
In the Git pane:
exercises/day1/exercise-template.R.RStudio shows the green confirmation. Your commit exists locally.
Click the green up arrow (Push) in the Git pane.
RStudio sends your branch to GitHub. The first time per branch it sets the upstream tracking automatically (because you ticked Sync branch with remote in step ②).
Go back to your fork on GitHub. A yellow banner appears:
day-1 had recent pushes ·
[ Compare & pull request ]
Click it. The PR form opens with the right defaults:
chrglez/quantitative-methods-master-tides, branch main<your-user>/quantitative-methods-master-tides, branch day-1Title: Day 1 — Your Full Name. Click Create pull request.
You have submitted. Christian receives a notification, reads the PR, leaves inline comments, and eventually closes it.
For the next day, start again from ① Sync your fork.
.Rdata, tokens, credentials. The .gitignore already excludes most traps.main — branches exist for this.usethis::create_github_token(expiration = 90) and gitcreds::gitcreds_set() again.datasets/raw/ (gitignored) and commit the download script.exercises/README.md, tutorial hours on the welcome deck.In the next 20 minutes, do all of these:
upstream from the Terminal · one time, as a safety net.day-1 branch.exercises/day1/exercise-template.R.I’ll come around the room to catch anyone stuck.
Quantitative Methods in Tourism · Master in Tourism and Sustainable Development · TIDES · ULPGC