1 // menghitung total frekuensi > total<-sum(pw) > total [1] 30
// menghitung persentase jenis kelamin > persen_pria<-(pria/total)*100 > persen_pria [1] 66.66667 > persen_wanita<-(wanita/total)*100 > persen_wanita [1] 33.33333
// menghitung total persentase > pp_pw<-c(66.66667,33.33333) > tot_persen<-sum(pp_pw) > tot_persen [1] 100
// mengecek frekuensi > frek_pria<-(persen_pria/tot_persen)*total > frek_pria [1] 20 > frek_wanita<-(persen_wanita/tot_persen)*total > frek_wanita [1]10
// membuat diagram batang > x<-c(20,10) >x [1] 20 10
> diagram_batang<-barplot(x,xlab="jenis kelamin",ylab="frekuensi")
2
// menghitung total frekuensi > a<-7 > b<-8 > o<-10 > ab<-5 > goldar<-c(7,8,10,5) > total<-sum(goldar) > total [1] 30
// menghitung persen goldar > persen_a<-(a/total)*100 > persen_a [1] 23.33333 > persen_b<-(b/total)*100
> persen_b [1] 26.66667 > persen_o<-(o/total)*100 > persen_o [1] 33.33333 > persen_ab<-(ab/total)*100 > persen_ab [1] 16.66667
// menghitung total persen > pa_pb_po_pab<-c(23.33333,26.66667,33.33333,16.66667) > tot_persen<-sum(pa_pb_po_pab) > tot_persen [1] 100
// mengecek frekuensi > frek_a<-(persen_a/tot_persen)*total > frek_a [1] 7 > frek_b<-(persen_b/tot_persen)*total > frek_b [1] 8 > frek_o<-(persen_o/tot_persen)*total > frek_o [1]10 > frek_ab<-(persen_ab/tot_persen)*total > frek_ab [1] 5
// membuat diagram pie > x<-c(7,8,10,5) >x
[1] 7 8 10 5 > colors<-rainbow(length(x)) > x_label<-round(x/sum(x)*100,1) > x_label<-paste(x_label,"%",sep="") > pie(x,main="Golongan Darah",col=colors,label=x_label,cex=0.8)
5 // data > tekanan_darah<-c(118,115,118,126,125,102,132,117,140,115,132,110,105,137,123,135,118,112,124 ,120,105,124,105,114,112,111,110,108,128,122) > tekanan_darah
[1] 118 115 118 126 125 102 132 117 140 115 132 110 105 137 123 135 118 112 124 120 105 124 105 114 112 111 110 108 128 122
> length(tekanan_darah) [1] 30
> summary(tekanan_darah) Min. 1st Qu. Median Mean 3rd Qu. Max. 102.0 111.2 118.0 118.8 124.8 140.0
> x<-max(tekanan_darah) >x [1] 140
> y<-min(tekanan_darah) >y [1] 102
> sort(tekanan_darah) [1] 102 105 105 105 108 110 110 111 112 112 114 115 [13] 115 117 118 118 118 120 122 123 124 124 125 126 [25] 128 132 132 135 137 140
> var(tekanan_darah) [1] 102.9437
> sd(tekanan_darah) [1] 10.14612
> range<-x-y
> range [1] 38