Fix/workflow-scripts (#1406)

* missing verb and article, and wrong shortcut

* Update workflow-scripts.qmd

---------

Co-authored-by: Mine Cetinkaya-Rundel <cetinkaya.mine@gmail.com>
This commit is contained in:
Mitsuo Shiota 2023-04-08 23:30:12 +09:00 committed by GitHub
parent dc2e531499
commit 4be5b37d87
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -63,7 +63,7 @@ Doing this regularly is a great way to ensure that you've captured all the impor
We recommend you always start your script with the packages you need.
That way, if you share your code with others, they can easily see which packages they need to install.
Note, however, that you should never include `install.packages()` in a script you share.
It's inconsiderate to hand off a script that will something on their computer if they're not being careful!
It's inconsiderate to hand off a script that will change something on their computer if they're not being careful!
When working through future chapters, we highly recommend starting in the script editor and practicing your keyboard shortcuts.
Over time, sending code to the console in this way will become so natural that you won't even think about it.
@ -138,7 +138,7 @@ There are a variety of problems here: it's hard to find which file to run first,
[^workflow-scripts-1]: Not to mention that you're tempting fate by using "final" in the name 😆 The comic Piled Higher and Deeper has a [fun strip on this](https://phdcomics.com/comics/archive.php?comicid=1531).
Here's better way of naming and organizing the same set of files:
Here's a better way of naming and organizing the same set of files:
01-load-data.R
02-exploratory-analysis.R
@ -175,7 +175,7 @@ With your R scripts (and your data files), you can recreate the environment.
With only your environment, it's much harder to recreate your R scripts: you'll either have to retype a lot of code from memory (inevitably making mistakes along the way) or you'll have to carefully mine your R history.
To help keep your R scripts as the source of truth for your analysis, we highly recommend that you instruct RStudio not to preserve your workspace between sessions.
You can do this either by running `usethis::use_blank_slate()`[^workflow-scripts-2] or by mimicking the options shown in @fig-blank-slate. This will cause you some short-term pain, because now when you restart RStudio, it will no longer remember the code that you ran last time nor will the objects you created or datasets you read be available to use.
You can do this either by running `usethis::use_blank_slate()`[^workflow-scripts-2] or by mimicking the options shown in @fig-blank-slate. This will cause you some short-term pain, because now when you restart RStudio, it will no longer remember the code that you ran last time nor will the objects you created or the datasets you read be available to use.
But this short-term pain saves you long-term agony because it forces you to capture all important procedures in your code.
There's nothing worse than discovering three months after the fact that you've only stored the results of an important calculation in your environment, not the calculation itself in your code.
@ -198,7 +198,7 @@ knitr::include_graphics("diagrams/rstudio/clean-slate.png", dpi = 270)
There is a great pair of keyboard shortcuts that will work together to make sure you've captured the important parts of your code in the editor:
1. Press Cmd/Ctrl + Shift + 0 to restart R.
1. Press Cmd/Ctrl + Shift + 0/F10 to restart R.
2. Press Cmd/Ctrl + Shift + S to re-run the current script.
We collectively use this pattern hundreds of times a week.