Skip to content

Commit e183a1e

Browse files
committed
Revert "Remove .Rdata demonstration."
This reverts commit 2ff2a07.
1 parent 75408c0 commit e183a1e

File tree

2 files changed

+23
-7
lines changed

2 files changed

+23
-7
lines changed

analysis/challenge.Rmd

Lines changed: 23 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,31 @@ steps:
3232

3333
The analysis purposefully contains various issues that make it difficult to
3434
reproduce. Open the file `spotify.Rmd` by clicking on it in the RStudio Files
35-
pane.
36-
37-
Next click the Knit button to re-build the document. The code fails
38-
due to an error. Click on "Output" to see the lines in the Rmd
35+
pane. In the Editor pane, click on "Run" and then click on "Run All" to execute
36+
all the code chunks in the R console (Ctrl/Cmd+Alt+Enter). Note that the code
37+
completes and produces a plot in the Plots pane.
38+
39+
Next click the Knit button to re-build the document. This time the code fails
40+
due to an error. The difference is because RStudio knits Rmd files in a clean
41+
R session. In contrast, the R session currently running in the R console already
42+
had all the analysis variables created because the workspace was restored. This
43+
is why you want to avoid saving your workspace: it can make it appear that your
44+
code is running when it is actually contains errors. In fact, if you scroll
45+
back up through the R console history, you'll see that some errors did occur.
46+
But the analysis still completed since the intermediate objects were already
47+
available.
48+
49+
To fix the workspace issue, first go to the Files pane and delete the file
50+
`.RData` that contains the saved workspace. Second, go to "Tools" -> "Global
51+
Options...". Unclick the checkbox "Restore .RData into workspace at startup" and
52+
change the dropdown "Save workspace to to .RData on exit" to Never.
53+
54+
![](assets/rstudio-workspace.png)
55+
56+
Now you can proceed to fix the analysis one error at a time. Click on Knit to
57+
produce the first error. Then click on "Output" to see the lines in the Rmd
3958
file where the error occurred.
4059

41-
Working together in small groups, reproduce the analysis by fixing the errors.
42-
Below are hints on how to fix each error you will find.
43-
4460
## File paths
4561

4662
The first error you will encounter is below:

docs/assets/rstudio-workspace.png

91 KB
Loading

0 commit comments

Comments
 (0)