R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

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.5, 3.75, 1.71), Income = c(0, 560, 824, 3, 0) ) print(data)

Menghitung covariance matriks

covariance_matrix <- cov(data) print(covariance_matrix)

Menghitung eigenvalues dan eigenvectors

eigen_result <- eigen(covariance_matrix)

Menampilkan hasil Eigenvalues

print(“Eigenvalues:”) print(eigen_result$values)

Menampilkan hasil Eigenvectors

print(“Eigenvectors:”) print(eigen_result$vectors)

Menghitung Correlation Matrix

correlation_matrix <- cor(data)

print(“Correlation Matrix:”) correlation_matrix