Directions

During ANLY 512 we will be studying the theory and practice of data visualization. We will be using R and the packages within R to assemble data and construct many different types of visualizations. We begin by studying some of the theoretical aspects of visualization. To do that we must appreciate the actual steps in the process of making a visualization.

Most of us use softare to do this and have done so for so long that we have lost an appreciation for the mechanistic steps involved in accurately graphing data. We will fix that this week by creating a series of analog (meaning you draw them by hand) graphics. The visualizations you create must be numerically and visually accurate and precisely scaled. Because of that the data sets we visualize will be small.

The final product of your homework (this file) should include scanned or photographed images for each question below and a short summary of the process.

To submit this homework you will create the document in Rstudio, using the knitr package (button included in Rstudio) and then submit the document to your Rpubs account. Once uploaded your will submit the link to that document on Moodle.

Questions

Find the mtcars data in R. This is the dataset that you will use to create your graphics. Use that data to draw by hand graphics for the next 4 questions.

SS: The below images were created using Microsoft Excel. Data from Mtcars was exported to Microsoft Excel using the following command: “write.csv(mtcars,”mtcars.csv“).” Once the file was created, each of the graphs were created using various excel functions and options (explained in detail below). The final charts were snipped into PNG images and stored in one folder. The final images are read into and printed on this output file.

  1. Draw a pie chart showing the proportion of cars from the mtcars data set that have different carb values.

SS: An excel piechart was created.

library(imager)
## Loading required package: plyr
## Loading required package: magrittr
## 
## Attaching package: 'imager'
## The following object is masked from 'package:magrittr':
## 
##     add
## The following object is masked from 'package:plyr':
## 
##     liply
## The following objects are masked from 'package:stats':
## 
##     convolve, spectrum
## The following object is masked from 'package:graphics':
## 
##     frame
## The following object is masked from 'package:base':
## 
##     save.image
im1 = load.image("C:\\Users\\shrin\\OneDrive\\Harrisburg\\Data Visualization\\A1Q1.PNG")
plot(im1)

  1. Draw a bar graph, that shows the number of each gear type in mtcars.

SS: Data was split into either one of the three categories: 3, 4 or 5 gear cars. The final bar graph was created using pivot tables.

im2 = load.image("C:\\Users\\shrin\\OneDrive\\Harrisburg\\Data Visualization\\A1Q2.PNG")
plot(im2)

  1. Next show a stacked bar graph of the number of each gear type and how they are further divded out by cyl.

SS: Using bar graphs in excel.

im3 = load.image("C:\\Users\\shrin\\OneDrive\\Harrisburg\\Data Visualization\\A1Q3.PNG")
plot(im3)

  1. Draw a scatter plot showing the relationship between wt and mpg.

SS: An excel scatterplot was created.

im4 = load.image("C:\\Users\\shrin\\OneDrive\\Harrisburg\\Data Visualization\\A1Q4.PNG")
plot(im4)

  1. Design a visualization of your choice using the data.

SS: An excel scatterplot between mpg and gears was created to identify patterns (if any). Cars with lower gears (3) definitely tend to have lower mileage but one cannot ascertain if the inverse is true from this dataset.

im5 = load.image("C:\\Users\\shrin\\OneDrive\\Harrisburg\\Data Visualization\\A1Q5.PNG")
plot(im5)