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: part-tools/04-scripts-notebooks.qmd
+9-11Lines changed: 9 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -86,8 +86,8 @@ There are lots of other things you *can* do, but those are the two big ones.
86
86
Let's try launching R and python from a system terminal, and then see that we can get the same windows within RStudio.
87
87
Keeping all of the windows you need for programming in one place is one of the most important features of an **integrated development environment (IDE)** like RStudio.
88
88
89
-
::: callout-tip
90
-
### Your Turn - Interactive Command Prompts in R and Python
89
+
::: diy
90
+
### Try it out! Interactive Command Prompts in R and Python
91
91
92
92
::: panel-tabset
93
93
@@ -159,10 +159,8 @@ In many languages, scripts are intended to run on their own, from start to finis
159
159
We often call this **executing** a script, and this is typically done from a terminal prompt.
160
160
161
161
162
-
::: callout-tip
163
-
164
-
165
-
#### Your Turn - Scripts and Terminals
162
+
::: diy
163
+
#### Try it out! Scripts and Terminals
166
164
167
165
Let's take a minute and see how someone might **call** or **run** a script from the terminal.
168
166
@@ -249,8 +247,8 @@ This is because in R, to include a file of commands within another script, you r
249
247
250
248
The difference between sourcing, running, and executing a script is fairly nuanced and the vocabulary is often used interchangeably, which doesn't help you as you're learning!
251
249
252
-
::: callout-tip
253
-
#### Your Turn - Sourcing a Script
250
+
::: diy
251
+
#### Try it out! Sourcing a Script
254
252
255
253
If you haven't already, download [scripts.zip](../files/scripts.zip) and unzip the file.
256
254
@@ -363,7 +361,7 @@ We will use quarto markdown documents for most of the components of this class b
363
361
364
362
While literate documents aren't ideal for jobs where a computer is doing things unobserved (such as pulling data from a web page every hour), they are extremely useful in situations where it is desireable to have both code and an explanation of what the code is doing and what the results of that code are in the same document.
365
363
366
-
::: callout-tip
364
+
::: diy
367
365
368
366
#### Your Turn - Words in quarto
369
367
@@ -385,7 +383,7 @@ Congratulations, you've just compiled your first Quarto document!
385
383
:::
386
384
387
385
388
-
::: callout-tip
386
+
::: diy
389
387
#### Your turn - Quarto Markdown
390
388
391
389
In RStudio, create a new quarto markdown document: File \> New File \> Quarto Document. Give your document a title and an author, and select HTML as the output.
@@ -451,7 +449,7 @@ Where quarto comes primarily out of the R community and those who are agnostic w
451
449
Quarto supports using the jupyter engine for chunk compilation, but jupyter notebooks have some (rather technical) features that make them less desirable for an introductory computing class [@xieFirstNotebookWar2018].
452
450
As a result, this book makes an opinionated decision to prefer quarto over jupyter.
453
451
454
-
::: callout-learnmore
452
+
::: learnmore
455
453
#### Learn More about Notebooks
456
454
457
455
There are some excellent opinions surrounding the use of notebooks in data analysis:
Copy file name to clipboardExpand all lines: part-tools/05-git-and-github.qmd
+8-7Lines changed: 8 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -13,7 +13,8 @@ There is an entire textbook on how to use git and GitHub with R, Happy Git and G
13
13
## What is Version Control ?
14
14
15
15
::: {.callout-note}
16
-
Most of this section is either heavily inspired by Happy Git and Github for the UseR [@bryanHappyGitGitHub2021] or directly links to that book. There's no sense trying to repeat something that's pretty close to perfect.
16
+
Most of this section is either heavily inspired by Happy Git and Github for the UseR [@bryanHappyGitGitHub2021] or directly links to that book.
17
+
There's no sense trying to repeat something that's pretty close to perfect.
17
18
:::
18
19
19
20
Git is a **version control system** - a structured way for tracking changes to files over the course of a project that may also make it easy to have multiple people working on the same files at the same time.
@@ -100,10 +101,7 @@ Make sure you've completed the steps in @sec-setting-up-github before you proce
100
101
**Repositories** are single-project containers. You may have code, documentation, data, TODO lists, and more associated with a project. If you combine a git repository with an RStudio project, you get a very powerful combination that will make your life much easier, allowing you to focus on writing code instead of figuring out where all of your files are for each different project you start.
101
102
102
103
To create a repository, you can start with your local computer first, or you can start with the online repository first.
103
-
104
-
::: {.callout-important}
105
-
Both methods are relatively simple, but the options you choose depend on which method you're using, so be careful not to get them confused.
106
-
:::
104
+
Both methods are relatively simple, but the options you choose depend on which method you're using, so be careful to pick one approach (and remember which one you picked!) for each new project.
107
105
108
106
::: panel-tabset
109
107
@@ -231,7 +229,10 @@ These files are used by your operating system or by RStudio, and pushing them ma
231
229
Tracking changes to these files also doesn't really do much good.
232
230
This is why I recommend that you run `usethis::git_vaccinate()`, which tells git to ignore these files for every repository on a machine.
233
231
234
-
I **highly** recommend that you make a point to only add and commit files which you consciously want to track.
232
+
233
+
**While you are learning, you should only add and commit files which you created manually and consciously want to track.**
234
+
You do not need to commit both a quarto `.qmd` file and the `.html` file it generates -- keeping only the quarto file is enough.
235
+
You *do* need to make sure to commit any pictures or files referenced in the files you create, though (as long as they're relatively small in size and not confidential), because otherwise, your project won't be self-contained.
235
236
236
237
### Staging your changes
237
238
@@ -268,7 +269,7 @@ Work to commit every time you've accomplished a small task. This will do two th
268
269
When you're working alone, you generally won't need to worry about having to update your local copy of the repository (unless you're using multiple machines).
269
270
However, statistics is collaborative, and one of the most powerful parts of git is that you can use it to keep track of changes when multiple people are working on the same document.
270
271
271
-
::: .watch-out
272
+
::: callout-caution
272
273
If you are working collaboratively and you and your collaborator are working on the same file, git will be able to resolve the change you make SO LONG AS YOU'RE NOT EDITING THE SAME LINE.
273
274
Git works based on lines of text - it detects when there is a change in any line of a text document.
Copy file name to clipboardExpand all lines: part-tools/06-documents.qmd
+6-6Lines changed: 6 additions & 6 deletions
Original file line number
Diff line number
Diff line change
@@ -258,7 +258,7 @@ I'm not convinced LaTeX succeeds at freeing you from layout concerns, but it's c
258
258
The philosophy of LaTeX is that presentation shouldn't get in the way of content: you should be able to change the presentation formatting systematically, without having to mess with the content.
259
259
This (theoretically) allows you to switch templates easily, make document-wide changes in a single command, and more.
260
260
261
-
::: callout-tip
261
+
::: diy
262
262
263
263
### Try it out
264
264
@@ -303,7 +303,7 @@ You can, for instance, start your document with `\documentclass[12pt]{article}`
303
303
One of the most useful features in LaTeX is math mode, which you can enter by enclosing text in `$ ... $` (for inline statements), `$$ ... $$` or `\[ ... \]` (for statements on their own line), or using other environments like `\begin{array} ... \end{array}` that come in math-specific packages.
304
304
Once in math mode, you can use [math symbol commands](https://www.caam.rice.edu/~heinken/latex/symbols.pdf) to get characters like $\theta, \pi, \sum, \int, \infty$, and more.
305
305
306
-
::: callout-tip
306
+
::: diy
307
307
### Try it out
308
308
309
309
With any document creation software, the easiest way to learn how to do it is to find a sample document, tinker with it, see if you can make things the way you want them to be, and then google the errors when you inevitably screw something up.
@@ -394,7 +394,7 @@ Standard trade-offs (formatting details vs. document complexity) apply.
394
394
Check out the [UNL-themed Beamer quarto template](https://github.com/unl-statistics/Templates/tree/main/slides-beamer-markdown)
395
395
:::
396
396
397
-
::: callout-tip
397
+
::: diy
398
398
#### Try it out
399
399
400
400
Download and compile [beamer-demo.Rnw](../files/beamer-demo.Rnw).
@@ -477,7 +477,7 @@ UNL themed HTML presentations:
477
477
-[quarto reveal.js](https://github.com/unl-statistics/Templates/tree/main/slides-revealjs-quarto) ([zip of all required files](https://github.com/unl-statistics/Templates/raw/main/slides-revealjs-quarto.zip))
478
478
:::
479
479
480
-
::: callout-tip
480
+
::: diy
481
481
### Try it out
482
482
483
483
Take a few minutes and try each of them out to see what feels right to you.
@@ -500,7 +500,7 @@ As with beamer, you can easily integrate knitr code chunks into a document, so t
500
500
501
501
Basic code for a poster in beamer (along with the necessary style files) that I've minimally customized to meet UNL branding requirements can be found [here](https://github.com/unl-statistics/Templates/raw/main/poster-beamer.zip).
502
502
503
-
::: callout-tip
503
+
::: diy
504
504
#### Try it out
505
505
506
506
Download the beamer template and do the following:
@@ -538,7 +538,7 @@ The `pagedown` package also has a couple of poster templates, including [poster-
538
538
539
539
There are also templates for letters, business cards, and more in pagedown, if you're feeling ambitious.
540
540
541
-
::: callout-tip
541
+
::: diy
542
542
#### Try it out
543
543
544
544
Download the pagedown template and do the following:
0 commit comments