setwd("C:/Users/Ngoc Loi/Downloads")
Dt <- read.csv("C:/Users/Ngoc Loi/Downloads/dataset.csv")

1 Thống kê mô tả Biến purpose

## Bảng tần suất của biến purpose
table(Dt$purpose)
## 
## For Rent For Sale 
##    43183   110247
## Bảng tần suất của biến purpose theo tỉ lệ %
table(Dt$purpose)/sum(table(Dt$purpose))
## 
##  For Rent  For Sale 
## 0.2814508 0.7185492
  • Dựa vào kết quả của bảng tần suất purpose thì tỉ lệ rao bán chiếm cao nhất khoảng 71.8%, còn lại là tỉ lệ cho thuê chiếm khoảng 28.1%

1.1 Đồ thị cột của biến purpose

library("ggplot2")
## Warning: package 'ggplot2' was built under R version 4.3.1
Dt |> ggplot(aes(Dt$purpose)) +
  geom_bar(olor = 'pink', fill = 'pink') + theme_classic() + labs(x = '', y = 'Tần số')
## Warning in geom_bar(olor = "pink", fill = "pink"): Ignoring unknown parameters:
## `olor`
## Warning: Use of `Dt$purpose` is discouraged.
## ℹ Use `purpose` instead.

Dựa vào biểu đồ cột, cho ta thu được kết quả, For Rent chiếm xấp sỉ 35000 quan sát và For Sale chiếm hơn 90000 quan sát.

2