data <- data.frame(
Nama = c("Ana", "Faye", "Carl", "Gege", "Ema"),
Umur = c(25, 30, 22, 35, 28),
Gaji = c(50000, 60000, 45000, 70000, 55000),
Pendidikan = c("S1", "S2", "D3", "S2", "D4"),
Status = c("Pegawai", "Manajer", "Pegawai", "Manajer", "Pegawai")
); data
## Nama Umur Gaji Pendidikan Status
## 1 Ana 25 50000 S1 Pegawai
## 2 Faye 30 60000 S2 Manajer
## 3 Carl 22 45000 D3 Pegawai
## 4 Gege 35 70000 S2 Manajer
## 5 Ema 28 55000 D4 Pegawai
dataStatus <- data[,c(4,5)]; dataStatus
## Pendidikan Status
## 1 S1 Pegawai
## 2 S2 Manajer
## 3 D3 Pegawai
## 4 S2 Manajer
## 5 D4 Pegawai
cor(data[, c(2,3)]);
## Umur Gaji
## Umur 1.0000000 0.9977913
## Gaji 0.9977913 1.0000000
boxplot(data [, c(2,3)], main= "Plot Boxplot", col= "red")
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
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.