首页 > > 详细

解析BIST 515迭代、数据结构解析、讲解数据结构语言、C/C++ Assignment解析、解析R编程

BIST 515: Introduction to Statistical Software Homework 5
Due date: Tuesday, October 18
1. This problem will use the diamonds dataset from the ggplot2 package. You can use the following
commands to load the dataset,
library(ggplot2)
head(diamonds)
(a) Create a histogram of carat with bars colored steelblue using the hist function. (5 points)
(b) Create a histogram of depth using the qplot function from the ggplot2 library. (5 points)
(c) Create boxplots showing how price varies across diamond cut using the qplot function from ggplot2.
Specify fill = cut to get all the boxplots to be coloured differently. (5 points)
2. This problem will use the Cars93 data set in the MASS library. You can use the following commands
to load the dataset,
library(MASS)
head(Cars93)
(a) Create a ggplot object using the Cars93 data set that you can use to view Price on the y-axis,
MPG.highway on the x-axis, and set the size mapping to be based on Horsepower. Then create a
scatterplot from your ggplot object with geom_point(). (5 points)
(b) Repeat part (a), this time also setting the colour mapping to be based on Origin. (5 points)
(c) Repeat part (b), this time using the scale_colour_manual() layer to specify that you want to
use cbPalette as your color palette. (5 points)
3. More ggplot2 practice
(a) Repeat part 2(b), this time using stat_smooth() to add a layer showing the smoothed curve rep-
resenting how Price varies with MPG.highway. (5 points)
(b) Create scatterplots of Price against MPG.highway, broken down by (conditioned on) Origin using
your ggplot object from 2(b) along with the geom_point() and facet_grid layers. (5 points)
(c) Modify your solution to part (b) to also display regression lines for each scatterplot. (5 points)

联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!