2.2.1 Latihan 2.2.1.1 Latihan 1
library(mosaicCalc)
## Loading required package: mosaicCore
## Loading required package: Deriv
## Loading required package: Ryacas
##
## Attaching package: 'Ryacas'
## The following object is masked from 'package:stats':
##
## integrate
## The following objects are masked from 'package:base':
##
## %*%, diag, diag<-, lower.tri, upper.tri
## Registered S3 method overwritten by 'mosaic':
## method from
## fortify.SpatialPolygonsDataFrame ggplot2
##
## Attaching package: 'mosaicCalc'
## The following object is masked from 'package:stats':
##
## D
s = read.csv(
"http://www.mosaic-web.org/go/datasets/stan-data.csv")
gf_point(temp ~ time, data=s)
h = read.csv(
"http://www.mosaic-web.org/go/datasets/hawaii.csv")
gf_point(water ~ time, data=h)
2.2.1.2 Latihan 2
Buat perintah R untuk menduplikasi setiap plot ini. Serahkan perintah Anda (bukan plot):
Utilities <- read.csv(
"http://www.mosaic-web.org/go/datasets/utilities.csv")
gf_point(
temp ~ month, data=Utilities) %>%
gf_labs(x = "Month (Jan=1, Dec=12)",
y = "Temperature (F)",
main = "Ave. Monthly Temp.")
gf_point(
gasbill ~ temp, data=Utilities) %>%
gf_labs(xlab = "Temperature (F)",
ylab = "Expenditures ($US)",
main = "Natural Gas Use") %>%
slice_plot( 300 - 5*temp ~ temp, color="blue")