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: 09-package_development.Rmd
+54-5
Original file line number
Diff line number
Diff line change
@@ -32,7 +32,8 @@ believe me, it will make things a thousand times easier.
32
32
33
33
Code that is inside packages is very easy to document and test, especially if you're using Rstudio.
34
34
It also makes it possible to use the wonderful `{covr}` package, which tells you which lines in
35
-
which functions are called by your tests. If some lines are missing, write tests that invoke them and increase the coverage of your tests! Documenting and testing your code is very important; it gives
35
+
which functions are called by your tests. If some lines are missing, write tests that invoke them and
36
+
increase the coverage of your tests! Documenting and testing your code is very important; it gives
36
37
you assurance that the code your writing works, but most importantly, it gives *others* assurance
37
38
that what you wrote works. And I include future you in these *others* too.
38
39
@@ -50,25 +51,73 @@ distributing this package easy, we're going to put it up on Github, so you'll ne
50
51
51
52
Let's start by creating a Github account.
52
53
53
-
### Setting up Github account
54
+
### Setting up a Github account
54
55
55
-
### Starting your package
56
+
Setting up a Github account is very easy; just go over to [https://github.com/](https://github.com/)
57
+
and simply sign up!
58
+
59
+
Then you will need to generate a ssh key on your computer. This is a way for you to securely
60
+
interact with your Github account, and push your code to the repository without having to always
61
+
type your password. I will assume you never created any ssh
62
+
keys before, because if you already did, you could skip these steps. I will also assume that you are
63
+
on a GNU+Linux or macOS system; if you're using windows, the instructions are very similar, but
64
+
you'll first need to install Git available [here](https://git-scm.com/downloads). Git is available
65
+
by default on any GNU+Linux system, and as far as I know also on macOS, but I might be wrong and
66
+
you might also need to install git on macOS (but then the instructions are the same whether
67
+
you're using GNU+Linux or macOS). If you have trouble installing git, read the following section
68
+
from the [Pro Git book](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
69
+
70
+
Then, open a terminal (or the git command line on Windows) and type the following:
71
+
72
+
```
73
+
ssh-keygen
74
+
```
75
+
76
+
This command will generate several files in the `.ssh` directory inside your `HOME` directory. Look
77
+
for the file that ends with the `.pub` extension, and copy its contents. You will need to paste
78
+
these contents on Github.
79
+
80
+
So now sign in to Github; once you are signed in, go to settings and then `SSH and GPG keys`:
81
+
82
+
```{r, echo=FALSE}
83
+
knitr::include_graphics("pics/github_ssh.png")
84
+
```
56
85
86
+
In the screenshot above, you see my ssh key associated with my account; this will be empty for you.
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
@@ -395,7 +395,8 @@ <h2><span class="header-section-number">9.1</span> Why you need to write your ow
395
395
believe me, it will make things a thousand times easier.</p>
396
396
<p>Code that is inside packages is very easy to document and test, especially if you’re using Rstudio.
397
397
It also makes it possible to use the wonderful <code>{covr}</code> package, which tells you which lines in
398
-
which functions are called by your tests. If some lines are missing, write tests that invoke them and increase the coverage of your tests! Documenting and testing your code is very important; it gives
398
+
which functions are called by your tests. If some lines are missing, write tests that invoke them and
399
+
increase the coverage of your tests! Documenting and testing your code is very important; it gives
399
400
you assurance that the code your writing works, but most importantly, it gives <em>others</em> assurance
400
401
that what you wrote works. And I include future you in these <em>others</em> too.</p>
401
402
<p>In order to share this package with these <em>others</em> we are going to use git. If you’re familiar with
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
<liclass="chapter" data-level="9.1" data-path="package-development.html"><ahref="package-development.html#why-you-need-to-write-your-own-package"><iclass="fa fa-check"></i><b>9.1</b> Why you need to write your own package</a></li>
334
334
<liclass="chapter" data-level="9.2" data-path="package-development.html"><ahref="package-development.html#starting-easy-creating-a-package-to-share-data"><iclass="fa fa-check"></i><b>9.2</b> Starting easy: creating a package to share data</a><ul>
335
-
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up Github account</a></li>
335
+
<liclass="chapter" data-level="9.2.1" data-path="package-development.html"><ahref="package-development.html#setting-up-a-github-account"><iclass="fa fa-check"></i><b>9.2.1</b> Setting up a Github account</a></li>
336
336
<liclass="chapter" data-level="9.2.2" data-path="package-development.html"><ahref="package-development.html#starting-your-package"><iclass="fa fa-check"></i><b>9.2.2</b> Starting your package</a></li>
337
337
</ul></li>
338
338
<liclass="chapter" data-level="9.3" data-path="package-development.html"><ahref="package-development.html#adding-functions-to-your-package"><iclass="fa fa-check"></i><b>9.3</b> Adding functions to your package</a></li>
0 commit comments