You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: _episodes/00-intro.md
+38-42
Original file line number
Diff line number
Diff line change
@@ -5,50 +5,34 @@ title: "Before we Start"
5
5
teaching: 25
6
6
exercises: 15
7
7
questions:
8
-
- "How to find your way around RStudio?"
9
-
- "How to interact with R?"
10
-
- "How to manage your environment?"
11
-
- "How to install packages?"
8
+
- "How do you get a GitHub account?"
9
+
- "How do you use Git with RStudio?"
12
10
objectives:
13
-
- "Install latest version of R."
11
+
- "Register for a GitHub account."
14
12
- "Install latest version of RStudio."
15
-
- "Navigate the RStudio GUI."
16
-
- "Install additional packages using the packages tab."
17
-
- "Install additional packages using R code."
13
+
- "Use RStudio for version control."
18
14
keypoints:
19
15
- "Use RStudio to write and run R programs."
20
-
- "Use `install.packages()` to install packages (libraries)."
16
+
- "Use RStudio to interact with GitHub."
21
17
source: Rmd
22
18
---
23
19
24
20
25
21
26
22
## R and RStudio
27
23
28
-
R is an open source programming language originally designed and implemented by
29
-
statisticians primarily for statistical analysis. It includes high quality
30
-
graphics capabilities and tools for data analysis and reading and writing data
31
-
to/from files.
32
-
33
-
Because R is open source and is supported by a large community of developers and
34
-
users there is a very large selection of third-party add-on packages which are
35
-
freely available to extend R's native capabilities.
36
-
37
-
R is a scripted language. Rather than pointing and clicking in a graphical
38
-
environment you write code statements to ask R to do something for you. This has
39
-
the advantage of providing a record of what was done and allows for peer review
40
-
of the work undertaken.
41
-
42
-
Having this written record, something which is increasingly required as part of
43
-
a publication submission, is also an aid when seeking help with problems.
44
-
45
-
There are many online resources such as
24
+
You should already be familiar with R, either through participating in a Software
25
+
or Data Carpentry workshop or having learned R some other way. As you are probably
26
+
aware, there are a variety of online resources where you can get help and valuable
27
+
advice. These include
46
28
[stackoverflow](https://stackoverflow.com/questions/tagged/r) and the [RStudio
47
29
Community](https://community.rstudio.com/) which will allow you to seek help
48
30
from peers. Questions which are backed up with [short, reproducible code
49
31
snippets](https://www.tidyverse.org/help/) are more likely to attract knowledgeable responses.
50
32
51
-
To make it easier to interact with R, we will use RStudio. RStudio is the most popular IDE (Integrated Development Interface), to work with R. An IDE is a software that provide tools to make it easier to program.
33
+
In this course we will use RStudio to interact with R. RStudio is the most popular IDE (Integrated Development Interface),
34
+
to work with R. An IDE is a software that provide tools to make it easier to program. If you
35
+
haven't used RStudio before, now is a good time to familiarise yourself with the interface.
52
36
53
37
<figure>
54
38
<imgsrc="../fig/r+rstudio-analogy.jpg"title="RStudio extends what R can do, and make it easier to write R code and interact with R."alt="RStudio extends what R can do, and make it easier to write R code and interact with R."style="display: block; margin: auto;" />
@@ -170,27 +154,39 @@ Directory". Alternatively you can use `setwd("/path/to/working/directory")` to
170
154
reset your working directory. However, your scripts should not include this line
171
155
because it will fail on someone else's computer.
172
156
157
+
## Cloning an existing project from GitHub
173
158
174
-
### Downloading the data and getting set up
159
+
Instead of starting a new project from scratch you may wish to use an existing
160
+
project that is available online, e.g. through GitHub. Such a project may provide
161
+
a predefined directory structure containing relevant data as well as R scripts.
162
+
This allows you to build on existing work (either by you or others).
175
163
176
-
For this lesson we will use the following folders in our working directory: **`data/`**, **`data_output/`** and **`fig_output/`**. Let's write them all in lowercase to be consistent. We can create them using the RStudio interface by clicking on the "New Folder" button in the file pane (bottom right), or directly from R by typing at console:
164
+
### Forking the project repository
177
165
166
+
During this course we will work with a project from GitHub. To get this setup
167
+
on your laptop, navigate to [https://github.com/humburg/r-ggplot-project](https://github.com/humburg/r-ggplot-project)
168
+
and click on the *Fork* button.
178
169
179
-
~~~
180
-
dir.create("data")
181
-
dir.create("data_output")
182
-
dir.create("fig_output")
183
-
~~~
184
-
{: .language-r}
170
+

185
171
186
-
Go to the Fighare page for this curriculum, and download the dataset called "`SAFI_clean.csv`". The direct download link is: <https://ndownloader.figshare.com/files/11492171>. Place this downloaded file in the `data/` you just created. You can do this directly from R by copying and pasting this in your terminal (your instructor can place this chunk of code in the Etherpad):
172
+
This will create a copy of the project in your own GitHub account, allowing
173
+
you to modify it as you see fit and pushing those changes back to GitHub.
187
174
175
+
### Cloning the project repository
176
+
177
+
Before you can do any work on this project you'll need a working copy on your
178
+
computer. First, navigate to the GitHub site for your freshly forked repository.
179
+
GitHub should have loaded that for you after completing the forking process.
180
+
Click on the green *Clone or download* button and coppy the displayed url.
181
+
182
+

183
+
184
+
Now, switch back to RStudio and create a new project. Choose *Version Control* and *Git*.
185
+
This should present you with a dialogue where you can enter the details you just copied
186
+
from GitHub.
187
+
188
+

0 commit comments