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.
datakesehatan <- read.csv("data_kesehatan.csv")
zzz
library(readxl)
dataexcel <- read_xlsx("df_mahasiswa.xlsx")
zzz
databaru <- data.frame(datasets::Titanic)
zz
?Titanic
## starting httpd help server ... done
str(Titanic)
## 'table' num [1:4, 1:2, 1:2, 1:2] 0 0 35 0 0 0 17 0 118 154 ...
## - attr(*, "dimnames")=List of 4
## ..$ Class : chr [1:4] "1st" "2nd" "3rd" "Crew"
## ..$ Sex : chr [1:2] "Male" "Female"
## ..$ Age : chr [1:2] "Child" "Adult"
## ..$ Survived: chr [1:2] "No" "Yes"
summary(Titanic)
## Number of cases in table: 2201
## Number of factors: 4
## Test for independence of all factors:
## Chisq = 1637.4, df = 25, p-value = 0
## Chi-squared approximation may be incorrect
z
summary(datakesehatan)
## X id umur jenis_kelamin
## Min. : 1.00 Min. : 1.00 Min. :18.00 Length :200
## 1st Qu.: 50.75 1st Qu.: 50.75 1st Qu.:32.00 N.unique : 2
## Median :100.50 Median :100.50 Median :43.00 N.blank : 0
## Mean :100.50 Mean :100.50 Mean :44.31 Min.nchar: 9
## 3rd Qu.:150.25 3rd Qu.:150.25 3rd Qu.:56.00 Max.nchar: 9
## Max. :200.00 Max. :200.00 Max. :70.00
## tinggi_badan berat_badan gula_darah tekanan_sistolik
## Min. :143.1 Min. :39.94 Min. : 49.01 Min. : 85.29
## 1st Qu.:159.4 1st Qu.:57.82 1st Qu.: 86.74 1st Qu.:108.77
## Median :165.1 Median :63.35 Median :100.44 Median :119.92
## Mean :165.8 Mean :64.75 Mean :101.01 Mean :119.53
## 3rd Qu.:171.7 3rd Qu.:72.17 3rd Qu.:111.90 3rd Qu.:129.62
## Max. :186.9 Max. :96.92 Max. :163.68 Max. :170.86
## tekanan_diastolik kolesterol skor_kesehatan
## Min. : 53.05 Min. : 98.56 Min. : 45.45
## 1st Qu.: 74.21 1st Qu.:172.44 1st Qu.: 84.30
## Median : 81.64 Median :190.25 Median : 92.92
## Mean : 80.64 Mean :191.80 Mean : 89.61
## 3rd Qu.: 87.18 3rd Qu.:216.47 3rd Qu.:100.00
## Max. :102.84 Max. :288.72 Max. :100.00
library(dplyr)
##
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
##
## filter, lag
## The following objects are masked from 'package:base':
##
## intersect, setdiff, setequal, union
databaru_selected <- select(databaru, Class, Sex, Survived)
databaru_selected
## Class Sex Survived
## 1 1st Male No
## 2 2nd Male No
## 3 3rd Male No
## 4 Crew Male No
## 5 1st Female No
## 6 2nd Female No
## 7 3rd Female No
## 8 Crew Female No
## 9 1st Male No
## 10 2nd Male No
## 11 3rd Male No
## 12 Crew Male No
## 13 1st Female No
## 14 2nd Female No
## 15 3rd Female No
## 16 Crew Female No
## 17 1st Male Yes
## 18 2nd Male Yes
## 19 3rd Male Yes
## 20 Crew Male Yes
## 21 1st Female Yes
## 22 2nd Female Yes
## 23 3rd Female Yes
## 24 Crew Female Yes
## 25 1st Male Yes
## 26 2nd Male Yes
## 27 3rd Male Yes
## 28 Crew Male Yes
## 29 1st Female Yes
## 30 2nd Female Yes
## 31 3rd Female Yes
## 32 Crew Female Yes
databaru_sorted_asc <- arrange(databaru, Freq)
head(databaru_sorted_asc)
## Class Sex Age Survived Freq
## 1 1st Male Child No 0
## 2 2nd Male Child No 0
## 3 Crew Male Child No 0
## 4 1st Female Child No 0
## 5 2nd Female Child No 0
## 6 Crew Female Child No 0
databaru_Child <- filter(databaru, Age == "Child")
head(databaru_Child)
## Class Sex Age Survived Freq
## 1 1st Male Child No 0
## 2 2nd Male Child No 0
## 3 3rd Male Child No 35
## 4 Crew Male Child No 0
## 5 1st Female Child No 0
## 6 2nd Female Child No 0