instal packages
install.packages("readr",repos = "http://cran.us.r-project.org")
## Warning: cannot remove prior installation of package 'readr'
## Warning in file.copy(savedcopy, lib, recursive = TRUE): problem copying F:
## \Local Disk C\R-4.1.1\library\00LOCK\readr\libs\x64\readr.dll to F:\Local Disk
## C\R-4.1.1\library\readr\libs\x64\readr.dll: Permission denied
## Warning: restored 'readr'
membaca data
library(readr)
siswa <- read_csv("data-siswa.csv")
## Rows: 9 Columns: 2
## -- Column specification --------------------------------------------------------
## Delimiter: ","
## dbl (2): BB, TB
##
## i Use `spec()` to retrieve the full column specification for this data.
## i Specify the column types or set `show_col_types = FALSE` to quiet this message.
ukuran pemusatan data
mean(siswa$BB)
## [1] 54
median(siswa$BB)
## [1] 54
modus <- function(x) {
uniqx <- unique(x)
uniqx[which.max(tabulate(match(x, uniqx)))]
}
modus(siswa$BB)
## [1] 50
visualisasi
hist(siswa$BB, main = "histogram berat badan")
plot(siswa$BB, main = "plot berat badan")
boxplot(siswa$BB, main = "boxplot berat badan")
Daftar Pustaka