In: Math
The data set below contains 100 records of heights and weights for some current and recent Major League Baseball (MLB) players.
Note: BMI 18.5 - 24.9 normal group, 25 - 29.9 overweight group and > 30 obese group.
Compute the body mass index (BMI) (703 times weight in
pounds, divided by the square of the height in inches) of each
major league baseball player
height Weight(pounds) Age
70 195 25
74 180 23
74 215 35
72 210 31
72 210 35
73 188 36
69 176 29
69 209 31
71 200 35
76 231 30
71 180 27
73 188 24
73 180 27
74 185 23
74 160 26
69 180 28
70 185 34
72 197 30
73 189 28
75 185 22
78 219 23
79 230 26
76 205 36
74 230 31
76 195 32
72 180 31
71 192 29
75 225 29
77 203 32
74 195 36
73 182 26
74 188 27
78 200 24
73 180 27
75 200 25
73 200 28
75 245 30
75 240 31
74 215 31
69 185 32
71 175 28
74 199 28
73 200 29
73 215 24
76 200 22
74 205 25
74 206 27
70 186 33
72 188 31
77 220 33
74 210 33
70 195 31
76 244 37
75 195 26
73 200 23
75 200 25
76 212 24
76 224 35
78 210 27
74 205 31
74 220 28
76 195 30
77 200 25
81 260 24
78 228 30
75 270 26
77 200 23
75 210 26
76 190 25
74 220 32
72 180 24
72 205 25
75 210 24
73 220 24
73 211 32
73 200 30
70 180 24
70 190 32
70 170 23
76 230 27
68 155 26
71 185 26
72 185 28
75 200 25
75 225 33
75 225 35
75 220 31
68 160 29
74 205 29
78 235 28
71 250 34
73 210 31
76 190 38
74 160 24
74 200 26
79 205 24
75 222 24
73 195 28
76 205 33
74 220 36
Hi. We'll do all the numerical computations in R. Please ask any doubts in the comments below.
I have saved the data in txt file and renamed the Weights (Pounds) as Weights only. I'll pass that file as input in the code.
data<-
read.table(file.choose(), header = T)
attach(data)
BMI <- 703*Weight/height^2
new <- data.frame(data, BMI)
The new data frame contains the data of BMI of each player.
The final data is
"height" "Weight" "Age" "BMI"
70 195 25 27.98
74 180 23 23.11
74 215 35 27.6
72 210 31 28.48
72 210 35 28.48
73 188 36 24.8
69 176 29 25.99
69 209 31 30.86
71 200 35 27.89
76 231 30 28.12
71 180 27 25.1
73 188 24 24.8
73 180 27 23.75
74 185 23 23.75
74 160 26 20.54
69 180 28 26.58
70 185 34 26.54
72 197 30 26.72
73 189 28 24.93
75 185 22 23.12
78 219 23 25.31
79 230 26 25.91
76 205 36 24.95
74 230 31 29.53
76 195 32 23.73
72 180 31 24.41
71 192 29 26.78
75 225 29 28.12
77 203 32 24.07
74 195 36 25.03
73 182 26 24.01
74 188 27 24.14
78 200 24 23.11
73 180 27 23.75
75 200 25 25
73 200 28 26.38
75 245 30 30.62
75 240 31 29.99
74 215 31 27.6
69 185 32 27.32
71 175 28 24.4
74 199 28 25.55
73 200 29 26.38
73 215 24 28.36
76 200 22 24.34
74 205 25 26.32
74 206 27 26.45
70 186 33 26.69
72 188 31 25.49
77 220 33 26.09
74 210 33 26.96
70 195 31 27.98
76 244 37 29.7
75 195 26 24.37
73 200 23 26.38
75 200 25 25
76 212 24 25.8
76 224 35 27.26
78 210 27 24.27
74 205 31 26.32
74 220 28 28.24
76 195 30 23.73
77 200 25 23.71
81 260 24 27.86
78 228 30 26.35
75 270 26 33.74
77 200 23 23.71
75 210 26 26.25
76 190 25 23.12
74 220 32 28.24
72 180 24 24.41
72 205 25 27.8
75 210 24 26.25
73 220 24 29.02
73 211 32 27.84
73 200 30 26.38
70 180 24 25.82
70 190 32 27.26
70 170 23 24.39
76 230 27 27.99
68 155 26 23.57
71 185 26 25.8
72 185 28 25.09
75 200 25 25
75 225 33 28.12
75 225 35 28.12
75 220 31 27.5
68 160 29 24.33
74 205 29 26.32
78 235 28 27.15
71 250 34 34.86
73 210 31 27.7
76 190 38 23.12
74 160 24 20.54
74 200 26 25.68
79 205 24 23.09
75 222 24 27.75
73 195 28 25.72
76 205 33 24.95
74 220 36 28.24