If you find any typos, errors, or places where the text may be improved, please let us know by providing feedback either in the feedback survey (given during class) or by using GitHub.
On GitHub open an issue or submit a pull request by clicking the " Edit this page" link at the side of this page.
4 Introduction to course
4.1 The Big Picture
4.2 Exercise: Discuss the types of workflows you use
Time: 15 minutes.
Take 2 min to think about your workflow you use in your work. How do you exactly do the things you do (like what apps you use, how you collaborate, how you name your files and folders, where you save your work)?
Then for about 10 min, in your group/table share and discuss each others workflows. How do they compare to each other? What are things you’d like to try out in your own work? How do all your workflows compare with what has been described so far?
For the remaining time, as the whole group, we’ll briefly share what you’ve all thought and discussed.
4.3 Setting up our project
Now that we’ve gone over the overview, let’s get our project ready for the next steps. But first, we need to do a few things. Since we did all that work in the pre-course tasks downloading the data and unzipping it, we need to save these changes to the Git history. Open the Git interface with either the Git icon at the top near the menu bar, or with or with the Palette (, then type “commit”). When the Git inferface opens up we’ll click the checkbox beside the .gitignore
and data-raw/mmash.R
files. Then we write a commit message in the text box on the right, something like Code to download data zip file
. Click the “Commit” button and close the Git interface.
Next, delete these two files we don’t need by using the fs package.
In the Console, type out:
fs::file_delete("TODO.md")
fs::file_delete("doc/report.Rmd")
Then, open up the README.md
and fix some of the TODO items. After cleaning everything up, now we need to use Git to add and commit all the current files into the history. Open up the Git interface in RStudio with or with the Palette (, then type “commit”) or through the Git button. Write a message in the commit textbox saying Added initial files
.
4.4 Styling your files
Before moving to the next session, there’s one more “setup” thing to do. Since we write code for other humans (including ourselves in the future), code should also look pretty, clean, and organized. To do that, we’ll follow a the tidyverse style guide and use the package called styler, which automatically fixes code to fit the style guide. With styler you can style multiple files at once, one file at a time, or based on code you select and highlight. Throughout the course, we will re-style the file were are working on a lot. We’ll do that by using the Command Palette by typing , followed by typing “style file”. The first one that pops up, which should say “Style active file”, will be the one to select and use. We’ll get lots of chances to use it as we go through the course. The thing to note is that styler isn’t always perfect, so you might need to sometimes manually fix code