Pastikan paket rmarkdown sudah terinstal. Jika belum, jalankan perintah berikut di RStudio:
install.packages(“rmarkdown”)
Buka RStudio, lalu pilih File > New File > R Markdown. Tulis kode atau analisis yang diperlukan, kemudian klik tombol Knit dan pilih Knit to HTML untuk menghasilkan file HTML.
Setelah file HTML berhasil dibuat, klik tombol Publish yang muncul di bagian Viewer di RStudio. Pilih RPubs sebagai platform publikasi.
Jika belum memiliki akun, buat akun baru di RPubs.com. Jika sudah login, lanjut ke langkah berikutnya.
Setelah dokumen berhasil diunggah, RPubs akan memberikan link yang bisa dibagikan atau disimpan.
a. Variance-Covariance Matrix
b. Correlation Matrix
c. Eigenvalues dan Eigenvectors
data <- data.frame(
Age = c(30.83, 58.67, 24.50, 27.83, 20.17),
Debt = c(0.000, 4.460, 0.500, 1.540, 5.625),
YearsEmployed = c(1.25, 3.04, 1.50, 3.75, 1.71),
Income = c(0, 560, 824, 3, 0)
)## 'data.frame': 5 obs. of 4 variables:
## $ Age : num 30.8 58.7 24.5 27.8 20.2
## $ Debt : num 0 4.46 0.5 1.54 5.62
## $ YearsEmployed: num 1.25 3.04 1.5 3.75 1.71
## $ Income : num 0 560 824 3 0
## Age Debt YearsEmployed Income
## Age 231.361400 9.345663 6.999375 2046.9725
## Debt 9.345663 6.187675 0.605225 -112.3137
## YearsEmployed 6.999375 0.605225 1.182050 -42.7750
## Income 2046.972500 -112.313750 -42.775000 151957.8000
## Age Debt YearsEmployed Income
## Age 1.0000000 0.2470022 0.4232489 0.3452272
## Debt 0.2470022 1.0000000 0.2237872 -0.1158264
## YearsEmployed 0.4232489 0.2237872 1.0000000 -0.1009278
## Income 0.3452272 -0.1158264 -0.1009278 1.0000000
## [1] 1.519855e+05 2.046288e+02 5.515401e+00 8.810774e-01
## [,1] [,2] [,3] [,4]
## [1,] -0.0134874524 0.99771613 0.055954477 -0.0353512228
## [2,] 0.0007381111 0.05468974 -0.997847290 -0.0361838792
## [3,] 0.0002807996 0.03730694 -0.034170588 0.9987194221
## [4,] -0.9999087283 -0.01340703 -0.001500938 0.0007305969