final_q1.docx - Final Exam Steven str(final'data.frame $ id...

This preview shows page 1 - 3 out of 8 pages.

Final Exam Steven 12/5/2020 str (final) ## 'data.frame': 300 obs. of 6 variables: ## $ id : chr "S001" "S002" "S003" "S004" ... ## $ Species : chr "setosa" "setosa" "setosa" "setosa" ... ## $ Sepal.Length: num 4.75 5.07 5.24 5.48 4.9 ... ## $ Sepal.Width : num 3.3 3.68 3.44 3.96 2.81 ... ## $ Petal.Length: num 1.44 1.21 1.59 1.53 1.49 ... ## $ Petal.Width : num 0.235 0.111 0.405 0.272 0.345 ... summary (final) ## id Species Sepal.Length Sepal.Width ## Length:300 Length:300 Min. :4.417 Min. : 1.796 ## Class :character Class :character 1st Qu.:5.209 1st Qu.:2.720 ## Mode :character Mode :character Median :5.844 Median : 2.992 ## Mean :5.857 Mean : 3.064 ## 3rd Qu.:6.448 3rd Qu.:3.375 ## Max. :8.478 Max. : 4.810 ## Petal.Length Petal.Width ## Min. :1.135 Min. :-0.03371 ## 1st Qu.:1.566 1st Qu.: 0.30278 ## Median :4.228 Median : 1.28776 ## Mean :3.738 Mean : 1.19830 ## 3rd Qu.:5.205 3rd Qu.: 1.87452 ## Max. :6.955 Max. : 2.62487 Missing Values: No Accuracy: the Minimum Petal Width is minus -0.03371 which is not true. It should be positive. So, I eliminate all negative values. It turns out there is only one value which is not accurate. I also eliminated the ID column because it is redundant.
final_subset = subset (final, final $ Petal.Width > 0 ) final_subset $ id = NULL summary (final_subset) ## Species Sepal.Length Sepal.Width Petal.Length ## Length:299 Min. :4.417 Min. :1.796 Min. :1.135 ## Class :character 1st Qu.:5.212 1st Qu.:2.719 1st Qu.:1.571 ## Mode :character Median :5.844 Median :2.992 Median :4.229 ## Mean :5.860 Mean :3.062 Mean :3.746 ## 3rd Qu.:6.452 3rd Qu.:3.370 3rd Qu.:5.205 ## Max. :8.478 Max. :4.810 Max.

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture