class: center, middle, inverse, title-slide # Data visualization ## How to learn coding ### Ben Baumer ### SDS 192Sep 16, 2020(
http://beanumber.github.io/sds192/lectures/mdsr_viz_07-coding.html
) --- ## About Googling... .pull-left[ ![](https://media.giphy.com/media/DWlJeG2pGW4jC/giphy.gif) ] .pull-right[ - use `ggplot2` in your searches - use [`ggplot2` tag on Stack Overflow](https://stackoverflow.com/questions/tagged/ggplot2) - beware of base R and `lattice` solutions - ~~`plot()`~~ - ~~`xyplot()`~~ ] --- ## Don't copy-and-paste code .pull-left[ - Coding is a [form of expression](https://femgineer.com/2012/09/software-engineering-another-form-of-self-expression/) - It's like taking notes - Write it yourself from scratch - **Don't submit code that you don't understand** - See Syllabus for [Collaboration policy](../syllabus.html#policies) ] .pull-right[ ![](https://media.giphy.com/media/XcqjhVYVCgNgs/giphy.gif) ] -- > "Imagine learning to write by copying-and-pasting sentences!" (student in SDS 410) --- ## Bad filenames - Problems: - spaces and special characters in filenames are bad - file extensions are important - Solutions: - use underscores (`_`) and/or dashes (`-`) - use `.Rmd` - Jenny Bryan on [naming things](https://speakerdeck.com/jennybc/how-to-name-files?slide=3) --- background-image: url(http://hackwrite.com/img/file-name-guides.png) --- ## Ongoing confusion .pull-left[ R session (active) - Console pane - interactive - full benefit of RStudio IDE - Environment/History pane - Files/Plots/Packages/Help pane ] .pull-right[ R session (passive) - R Markdown pane - **sequential** - invisible - created when you Knit - creates HTML output ] --- ## When you need to clean up... - Broom icon in Environment to sweep away objects - Run all chunks above - Middle triangle over bar, next to arrow - `Ctrl + Alt + P` - `Session` -> `Restart R` --- ## Navigating R help - Will come with experience - R help: - rigorously formatted - often incomplete - often complete but inscrutable - examples can be hit-or-miss - argument descriptions are usually good