Skip to content

Commit f7b7127

Browse files
authored
Merge pull request #1113 from ethanwhite/version-control-update
Update version control material
2 parents 7739fb8 + 7d1dfcc commit f7b7127

File tree

3 files changed

+38
-16
lines changed

3 files changed

+38
-16
lines changed

materials/datasets.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ title: List of datasets
2020
| Mammal life history | tsv | <https://esapubs.org/archive/ecol/E084/093/Mammal_lifehistories_v2.txt> |
2121
| Bird size | tsv | <https://esapubs.org/archive/ecol/E088/096/avian_ssd_jan07.txt> |
2222
| Example project | zip | <https://www.datacarpentry.org/semester-biology/data/example_project.zip> |
23-
| Fish scale length | csv | <https://lter.limnology.wisc.edu/sites/default/files/Gaeta_etal_CLC_data.csv> |
23+
| Fish scale length | csv | <https://datacarpentry.org/semester-biology/data/Gaeta_etal_CLC_data.csv> |
2424
| LiDAR rasters and plot locations | multiple | <https://www.datacarpentry.org/semester-biology/data/neon-airborne.zip> |
2525
| Harvard Forest NDVI | tif | <https://www.datacarpentry.org/semester-biology/data/harv-ndvi.zip> |
2626
| San Joaquin Experimental Range NDVI | tif | <https://www.datacarpentry.org/semester-biology/data/sjer-ndvi.zip> |

materials/version-control-R.md

+36-14
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ language: R
2727

2828
>
2929
> **Live coding demo and assignment are intertwined and designed to work in order.**
30+
> **Instructions for both Posit Cloud & RStudio are included so just use the setup pieces that fit your class.**
31+
> **Sign into GitHub**
3032

3133
## Introduction
3234

@@ -55,6 +57,14 @@ data files and code in a more manageable way.
5557

5658
## Version control using Git & RStudio
5759

60+
### Connecting Posit Cloud to GitHub (only if teaching in Posit Cloud)
61+
62+
1. Go to https://login.posit.cloud/ (login in necessary)
63+
2. Click `Posit User Settings`
64+
3. Go to GitHub section and click `Private repo access also enabled`
65+
4. Will be redirected to GitHub to authorize Posit Cloud
66+
5. Click `Authorize posit-hosted`
67+
5868
### Create a Git repo
5969

6070
1. Navigate to Github in a web browser and login.
@@ -65,22 +75,31 @@ data files and code in a more manageable way.
6575
5. Select `Private`.
6676
6. Select `Initialize this repository with a README`.
6777
7. Click `Create Repository`.
78+
8. From new GitHub repository, click green `Code` button ->
79+
Click the `Copy url to clipboard` button.
80+
81+
### Connect to the Git repo
82+
83+
#### Posit Cloud
84+
85+
1. Posit Cloud (in class org): New Project -> New Project from Git Repo
86+
2. Paste copied URL in `URL of your Git Repository:`.
87+
3. Click `OK`.
88+
4. Check to make sure you have a `Git` tab in the upper right window.
6889

69-
### Connect to the Git repo in RStudio
90+
#### RStudio
7091

71-
1. From new GitHub repository, click green `Clone or download` button ->
72-
Click the `Copy to clipboard` button.
73-
2. In RStudio, File -> New Project -> Version Control -> Git
74-
3. Paste copied URL in `Repository URL:`.
75-
4. Leave `Project directory name:` blank; automatically given repo name.
76-
5. Choose where to `Create project as subdirectory of:`.
77-
6. Click `Create Project`.
78-
7. Check to make sure you have a `Git` tab in the upper right window.
92+
1. RStudio, File -> New Project -> Version Control -> Git
93+
2. Paste copied URL in `Repository URL:`.
94+
3. Leave `Project directory name:` blank; automatically given repo name.
95+
4. Choose where to `Create project as subdirectory of:`.
96+
5. Click `Create Project`.
97+
6. Check to make sure you have a `Git` tab in the upper right window.
7998

8099
### Install
81100

82101
```r
83-
install.packages(c('dplyr', 'usethis', 'gitcreds'))
102+
install.packages(c('dplyr', 'readr', 'usethis', 'gitcreds'))
84103
```
85104

86105
### Introduce yourself to Git
@@ -111,7 +130,7 @@ use_git_config(user.name = "[name]", user.email = "[email]")
111130
* `Add fish size and growth rate data`
112131
* History:
113132
* One commit
114-
* Changes too large to see
133+
* Shows that the file has been added to version control
115134

116135
#### Commit R script
117136

@@ -122,8 +141,11 @@ library(dplyr)
122141
library(readr)
123142
124143
fish_data = read_csv("Gaeta_etal_CLC_data.csv")
144+
125145
```
126146

147+
**Make sure to have a new line at the end for a clean diff**
148+
127149
* Save as `fish-analysis.R`.
128150
* Git -> Select `fish-analysis.R`.
129151
* Changes in staged files will be included in next commit.
@@ -242,7 +264,7 @@ fish_data_cat = fish_data %>%
242264
* By far the most popular hosted version control site
243265
* Public and private hosted repositories
244266
* Private free for students and academics
245-
* https://education.github.com/
267+
* https://education.github.com/
246268
* For the assignment, we're using private repositories that we made at
247269
the beginning.
248270

@@ -258,6 +280,8 @@ fish_data_cat = fish_data %>%
258280
usethis::create_github_token()
259281
```
260282

283+
* You may need to allow popups and try again
284+
261285
* Select defaults
262286
* Create token
263287
* Copy token
@@ -400,5 +424,3 @@ mutate(length_cat = ifelse(length > 250, "large", "small"))
400424

401425
> Show an [example of a working repository]({{ site.github.repo }}) with
402426
> branches and forks. Navigate to pull requests.
403-
404-

schedule.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ assignments: ['Data Entry and Storage', 'Introduction to R and RStudio',
55
'Data in Tables', 'Grouping & Joining Data', 'Data Visualization',
66
'Solving Bigger Problems', 'Functions',
77
'Making Choices', 'Hurricane Catchup', 'Repeating Things 1', 'Repeating Things 2',
8-
'Spatial Data 1', 'Spatial Data 2', 'Class Choice',
8+
'Spatial Data 1', 'Spatial Data 2', 'Version Control',
99
'Fall Break', 'Class Choice']
1010
---
1111

0 commit comments

Comments
 (0)