# Solved (Free): The amount of protein (in grams) for a variety of fast-food sandwiches is reported here 2

#### ByDr. Raju Chaudhari

May 31, 2021

The amount of protein (in grams) for a variety of fast-food sandwiches is reported here.

23  30  20  27  44  26  35  20  20  29
25  15  18  27  19  22  12  26  34  15
27  35  26  43  35  14  24  12  23  31
40  35  38  57  22  42  24  21  27  33

a. Find the amount of protein in the 4th percentile.
b. What is the percentile of a sandwich with 38 grams of protein?
c. Construct a stem plot.
d. How many fast-food sandwiches contain less than 26 grams of protein?
e. Find the proportion of sandwiches with less than 18 grams of proteins.
f. Find the proportion of sandwiches with 27 OR 35 grams of protein.

#### Solution

protein<-c(23,   30, 20, 27, 44, 26, 35, 20, 20,
29, 25, 15, 18, 27, 19, 22, 12, 26, 34, 15, 27,
35, 26, 43, 35, 14, 24, 12, 23, 31, 40, 35, 38,
57, 22, 42, 24, 21, 27, 33)

a. To find the 4th percentile we use quantile() function

quantile(protein,c(0.04))
   4%
13.12 

The amount of protein in the 4th percentile 13.12.

b. percentile of a sandwich with 38 grams of protein

most38<-protein[protein<=38]
most38
 [1] 23 30 20 27 26 35 20 20 29 25 15 18 27 19 22 12 26 34 15 27 35 26 35 14 24
[26] 12 23 31 35 38 22 24 21 27 33
prop38<-length(most38)/length(protein)
prop38
[1] 0.875

Percentile of a sandwich with 38 grams of protein is 0.875.

c. Stem plot of amount of protein

stem(protein)

The decimal point is 1 digit(s) to the right of the |

1 | 224
1 | 5589
2 | 0001223344
2 | 566677779
3 | 0134
3 | 55558
4 | 0234
4 |
5 |
5 | 7

d. Fast-food sandwiches that contain less than 26 grams of protein

prop26<-protein[protein<26]
length(prop26)
[1] 18

Fast-food sandwiches that contain less than 26 grams of protein are 18

e. The proportion of sandwiches with less than 18 grams of proteins.

prot18<-protein[protein < 18]
prot18
[1] 15 12 15 14 12
prop18<-length(prot18)/length(protein)
prop18
[1] 0.125

The proportion of sandwiches with less than 18 grams of proteins is 0.125.

f. Find the proportion of sandwiches with 27 OR 35 grams of protein.

prot27or35<-protein[protein == 27 | protein ==35 ]
prot27or35
[1] 27 35 27 27 35 35 35 27
prop27or35<-length(prot27or35)/length(protein)
prop27or35
[1] 0.2

The proportion of sandwiches with 27 OR 35 grams of protein = 0.2.