Type Calories Sodium Beef 186 495 Beef 181 477 Beef 176 425 Beef 149 322 Beef 18
ID: 3353079 • Letter: T
Question
Type Calories Sodium Beef 186 495 Beef 181 477 Beef 176 425 Beef 149 322 Beef 184 482 Beef 190 587 Beef 158 370 Beef 139 322 Beef 175 479 Beef 148 375 Beef 152 330 Beef 111 300 Beef 141 386 Beef 153 401 Beef 190 645 Beef 157 440 Beef 131 317 Beef 149 319 Beef 135 298 Beef 132 253 Meat 173 458 Meat 191 506 Meat 182 473 Meat 190 545 Meat 172 496 Meat 147 360 Meat 146 387 Meat 139 386 Meat 175 507 Meat 136 393 Meat 179 405 Meat 153 372 Meat 107 144 Meat 195 511 Meat 135 405 Meat 140 428 Meat 138 339 Poultry 129 430 Poultry 132 375 Poultry 102 396 Poultry 106 383 Poultry 94 387 Poultry 102 542 Poultry 87 359 Poultry 99 357 Poultry 107 528 Poultry 113 513 Poultry 135 426 Poultry 142 513 Poultry 86 358 Poultry 143 581 Poultry 152 588 Poultry 146 522 Poultry 144 545 Q. 4 The datafile hotdogs.csv in the Data folder on Avenue gives the measured number of calories and amount of sodium (i mg) for hotdogs from 54 major brands. The data were measured in a laboratory for a Consumer Reports article on the nutritional value of a hotdog. Three types of hotdog were examined, all-beef, poultry or meat (mainly pork and beef but with up to 15% poultry). Use numerical summaries and boxplots to compare these three types of hotdog in terms of calories and sodium content. Write a brief report explaining the results of your analysis. You should also include the R code that you use in your solution.Explanation / Answer
mydata=read.table("C:\Users\hp\Documents\data.txt",header=TRUE)
> summary(mydata)
Type Calories Sodium
Beef :20 Min. : 86.0 Min. :144.0
Meat :17 1st Qu.:132.0 1st Qu.:362.5
Poultry:17 Median :145.0 Median :405.0
Mean :145.4 Mean :424.8
3rd Qu.:172.8 3rd Qu.:503.5
Max. :195.0 Max. :645.0
> summary(mydata,where "Type=Beef")
Error: unexpected string constant in "summary(mydata,where "Type=Beef""
> data1=head(mydata,n=20)
> summary(data1)
Type Calories Sodium
Beef :20 Min. :111.0 Min. :253.0
Meat : 0 1st Qu.:140.5 1st Qu.:321.2
Poultry: 0 Median :152.5 Median :380.5
Mean :156.8 Mean :401.1
3rd Qu.:177.2 3rd Qu.:477.5
Max. :190.0 Max. :645.0
> data2=mydata[21:37,1:3]
> summary(data2)
Type Calories Sodium
Beef : 0 Min. :107.0 Min. :144.0
Meat :17 1st Qu.:139.0 1st Qu.:386.0
Poultry: 0 Median :153.0 Median :405.0
Mean :158.7 Mean :418.5
3rd Qu.:179.0 3rd Qu.:496.0
Max. :195.0 Max. :545.0
> boxplot(data1$Calories)
> boxplot(data1$Sodium)
boxplot(data2$Calories)
> boxplot(data2$Sodium)
> data3=mydata[38:54]
Error in `[.data.frame`(mydata, 38:54) : undefined columns selected
> data3=mydata[38:54,1:3]
> summary(data3)
Type Calories Sodium
Beef : 0 Min. : 86.0 Min. :357
Meat : 0 1st Qu.:102.0 1st Qu.:383
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.