4 L04: Basics III

4.1 Data Visualization; Functions

4.2 Goals

Getting to know the basics of data visualization; writing simple functions (reusable, packaged code)

4.4 Topics

  • Basics of using ggplot2
    • Basic geoms in ggplot2
      • Histogram
      • Lines
      • Bar plots
      • Faceting
    • Labels
    • Create your own plots
  • Writing your own functions
    • Explanation of functions
    • Function calls
    • Function definition

4.5 Reference materials

Consult relevant chapters from:

  • Healy, Kieran Data Visualization: A Practical Guide. Princeton University Press, 2018. ISBN: 978-0691181622. http://socviz.co/
  • Hadley Wickham & Garrett Grolemund, R for Data Science: Import, Tidy, Transform, Visualize, and Model Data. O’Reilly, 2017. ISBN: 978-1491910399. https://r4ds.had.co.nz/
  • Wickham, Hadley. Advanced R, Second Edition. 2 edition. Boca Raton: Chapman and Hall/CRC, 2019. http://adv-r.had.co.nz/

4.6 Homework

  • Finish your worksheets and submit as described below.

  • During the break:

    • Additional I: I strongly recommend that you keep practicing R. You can use the swirl library for this:
      • To install: install.packages("swirl")
      • To run: library(swirl)
      • Then: swirl()
      • Additional courses/tutorials for swirl() can be found at https://swirlstats.com/scn/title.html
        • I would recommend the following ones (in this order):
          • R Programming by Team swirl
          • Getting and Cleaning Data by Team swirl
          • Exploratory Data Analysis by Team swirl
          • Advanced R Programming by Roger Peng
          • (try others as well; there are also some courses in German and Spanish)
    • Additional II:
      • I strongly recommend that you start looking for the GIS-related readings that you will be reviewing
      • You should also start looking for or thinking about the dataset for your final project (if you do not have one)

4.7 Submitting homework

  • Homework assignment must be submitted by the beginning of the next class;
  • Email your homework to the instructor as attachments.
    • In the subject of your email, please, add the following: 070184-LXX-HW-YourLastName-YourMatriculationNumber, where LXX is the numnber of the lesson for which you submit homework; YourLastName is your last name; and YourMatriculationNumber is your matriculation number.