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
library(MASS)
##
## Attaching package: 'MASS'
## The following object is masked from 'package:dplyr':
##
## select
data("survey")
head(survey)
## Sex Wr.Hnd NW.Hnd W.Hnd Fold Pulse Clap Exer Smoke Height M.I
## 1 Female 18.5 18.0 Right R on L 92 Left Some Never 173.00 Metric
## 2 Male 19.5 20.5 Left R on L 104 Left None Regul 177.80 Imperial
## 3 Male 18.0 13.3 Right L on R 87 Neither None Occas NA <NA>
## 4 Male 18.8 18.9 Right R on L NA Neither None Never 160.00 Metric
## 5 Male 20.0 20.0 Right Neither 35 Right Some Never 165.00 Metric
## 6 Female 18.0 17.7 Right L on R 64 Right Some Never 172.72 Imperial
## Age
## 1 18.250
## 2 17.583
## 3 16.917
## 4 20.333
## 5 23.667
## 6 21.000
tail(survey)
## Sex Wr.Hnd NW.Hnd W.Hnd Fold Pulse Clap Exer Smoke Height M.I
## 232 Male 18.0 16.0 Right R on L NA Right Some Never 180.34 Imperial
## 233 Female 18.0 18.0 Right L on R 85 Right Some Never 165.10 Imperial
## 234 Female 18.5 18.0 Right L on R 88 Right Some Never 160.00 Metric
## 235 Female 17.5 16.5 Right R on L NA Right Some Never 170.00 Metric
## 236 Male 21.0 21.5 Right R on L 90 Right Some Never 183.00 Metric
## 237 Female 17.6 17.3 Right R on L 85 Right Freq Never 168.50 Metric
## Age
## 232 20.750
## 233 17.667
## 234 16.917
## 235 18.583
## 236 17.167
## 237 17.750
names(survey)
## [1] "Sex" "Wr.Hnd" "NW.Hnd" "W.Hnd" "Fold" "Pulse" "Clap" "Exer"
## [9] "Smoke" "Height" "M.I" "Age"
veri1 <-survey %>%
dplyr::select(Sex,Age,Smoke,Height,Exer,Pulse)
veri2 <-veri1 %>%
rename(yaş=Age,
cinsiyet=Sex,
sigara=Smoke,
nabız=Pulse,
egzersiz=Exer,
boy=Height)
veri2 %>%
count(egzersiz)
## egzersiz n
## 1 Freq 115
## 2 None 24
## 3 Some 98
veri2 %>%
count(boy) %>%
mutate(yuzde=
round((n/sum(n))*100,2))
## boy n yuzde
## 1 150.00 1 0.42
## 2 152.00 1 0.42
## 3 152.40 1 0.42
## 4 153.50 1 0.42
## 5 154.94 2 0.84
## 6 155.00 2 0.84
## 7 156.00 1 0.42
## 8 156.20 1 0.42
## 9 157.00 3 1.27
## 10 157.48 3 1.27
## 11 158.00 1 0.42
## 12 159.00 2 0.84
## 13 160.00 5 2.11
## 14 160.02 3 1.27
## 15 162.50 1 0.42
## 16 162.56 4 1.69
## 17 163.00 3 1.27
## 18 164.00 4 1.69
## 19 165.00 14 5.91
## 20 165.10 4 1.69
## 21 166.40 1 0.42
## 22 166.50 1 0.42
## 23 167.00 7 2.95
## 24 167.64 5 2.11
## 25 168.00 8 3.38
## 26 168.50 1 0.42
## 27 168.90 1 0.42
## 28 169.00 2 0.84
## 29 169.20 1 0.42
## 30 170.00 14 5.91
## 31 170.18 4 1.69
## 32 171.00 5 2.11
## 33 171.50 1 0.42
## 34 172.00 7 2.95
## 35 172.72 6 2.53
## 36 173.00 4 1.69
## 37 174.00 1 0.42
## 38 175.00 5 2.11
## 39 175.26 5 2.11
## 40 176.00 2 0.84
## 41 176.50 2 0.84
## 42 177.00 3 1.27
## 43 177.80 2 0.84
## 44 178.00 2 0.84
## 45 178.50 1 0.42
## 46 179.00 3 1.27
## 47 179.10 2 0.84
## 48 180.00 8 3.38
## 49 180.34 9 3.80
## 50 182.00 1 0.42
## 51 182.50 1 0.42
## 52 182.88 4 1.69
## 53 183.00 3 1.27
## 54 184.00 2 0.84
## 55 185.00 6 2.53
## 56 185.42 2 0.84
## 57 187.00 3 1.27
## 58 187.96 3 1.27
## 59 188.00 1 0.42
## 60 189.00 2 0.84
## 61 190.00 3 1.27
## 62 190.50 3 1.27
## 63 191.80 1 0.42
## 64 193.04 1 0.42
## 65 195.00 1 0.42
## 66 196.00 1 0.42
## 67 200.00 1 0.42
## 68 NA 28 11.81
#not:öğrencilerin %3.38'i (n=8) boyu 180'dir.