Great Deal! Get Instant \$10 FREE in Account on First Order + 10% Cashback on Every Order Order Now

# CIS XXXXXXXXXXData Visualization Summer 2020 Exam # 2 – Part 2 Due: July 24th mid night (11:59 PM) Maximum points: 20 or 20% of the course grade Note: You must include R code along with the output...

CIS XXXXXXXXXXData Visualization
Summer 2020
Exam # 2 – Part 2
Due: July 24th mid night (11:59 PM)
Maximum points: 20 or 20% of the course grade
Note: You must include R code along with the output graph(s) for your answer. The simplest
way is to copy the R code along with the plot within a word document and submit it. You
must use the ggplot function for the ggplot2 package to write the R code for visualizing data.
Your work must involve using co
ect variables for the dataset of your choice to plot
meaningful visualizations. Just producing visual plots which are inco
any credit. Partial credit will be assigned for work demonstrating significant efforts.
The first four questions are worth 3 points each and the last two are 4 points each.
1. Create the following scatter plot for mtcars dataset. Hint: Use theme_classic() and
scale_color_grey() to get a black and white plot with no background. (3 points)

2. Create the following plot for the mtcars dataset. (3 points)

3. Using the heightweight data set, create a new column that indicates if the height in inches
is less than the mean height value or >= mean height value. This dataset is part of the
gcookbook package. Name this new column as heightgroup and store it as a new column
in the heightweight data set. Name the new dataset as heightweight_mod. Now create the
following plot based on this new categorical variable of heightgroup as shown below. (3
points)
4. Create the following scatter plot for the faithful dataset using eruptions > 3 to highlight
two categories of eruptions. (3 points)

5. Create the following histogram for the airquality data set. Hint: Use binwidth = 5, color =
“black” and aes(fill = ..count..) within geom_histogram. Also remember to include the
plot title “Frequency histogram of mean ozone”. (4 points)

6. Create the following boxplot for the airquality dataset. Hint: Use theme_classic() to
create the plot with no background. (4 points)
Answered Same Day Jul 21, 2021

## Solution

Suraj answered on Jul 22 2021
1.
Scatter Plot
R-Code
data("mtcars")
wt<-mtcars\$wt
mpg<-mtcars\$mpg
li
ary(ggplot2)
ggplot(mtcars, aes(x=wt, y=mpg, shape=factor(cyl))) +
geom_point(size=1)+ scale_shape_manual(values=c(1,2,7))+theme_classic() + scale_color_grey()

2.
R-Code
data("mtcars")
wt<-mtcars\$wt
mpg<-mtcars\$mpg
li
ary(ggplot2)
ggplot(mtcars, aes(x=wt, y=mpg,color=factor(cyl),label=rownames(mtcars) )) +
geom_point(size=1)+...
SOLUTION.PDF