Check That Your Code Runs (Data Analysis)
Sometimes you think you’re code runs, but it only actually works because of something else you did previously. To make sure it actually runs you should save your work and then run it in a clean environment.
Follow these steps in RStudio to make sure your code really runs:
1. Restart R (see above) by clicking Session
in the menu bar and selecting Restart R
:
2. If the Environment
tab isn’t empty click on the broom icon to clear it:
The Environment
tab should now say “Environment Is Empty”:
3. Rerun your entire homework assignment using “Source with Echo” to make sure it runs from start to finish and produces the expected results.
4. Make sure that you saved your code with the name assignment
somewhere in the file name. You should see the file in the Files
tab and the name of the file should be black (not red with an *
in the tab at the top of the text editor):