library(mosaic)
## Registered S3 method overwritten by 'mosaic':
##   method                           from   
##   fortify.SpatialPolygonsDataFrame ggplot2
## 
## The 'mosaic' package masks several functions from core packages in order to add 
## additional features.  The original behavior of these functions should not be affected by this.
## 
## Attaching package: 'mosaic'
## The following objects are masked from 'package:dplyr':
## 
##     count, do, tally
## The following object is masked from 'package:Matrix':
## 
##     mean
## The following object is masked from 'package:ggplot2':
## 
##     stat
## The following objects are masked from 'package:stats':
## 
##     binom.test, cor, cor.test, cov, fivenum, IQR, median, prop.test,
##     quantile, sd, t.test, var
## The following objects are masked from 'package:base':
## 
##     max, mean, min, prod, range, sample, sum
library(dplyr)
Housing = read.csv("http://www.mosaic-web.org/go/datasets/Income-Housing.csv")

Dataset ini mencakup berbagai variabel, seperti Income, CrimeProblem, dan lainnya.

gf_point(
  CrimeProblem ~ Income, data = Housing
) %>%
  gf_labs(
    x = "Income Bracket ($US per household)/year",
    y = "Fraction of Households",
    main = "Crime Problem"
  ) %>%
  gf_lims(x = range(0, 100000), y = range(0, 50))

Kode ini menggunakan fungsi gf_point dari paket Mosaic untuk membuat scatterplot antara variabel CrimeProblem dan Income. Axis-label dan judul grafik disesuaikan agar lebih informatif.

Interpretasi Scatterplot: Grafik menunjukkan hubungan antara pendapatan rumah tangga dan tingkat masalah kejahatan di suatu wilayah. Dengan meningkatnya pendapatan, terlihat adanya tren penurunan tingkat masalah kejahatan.