data(mtcars)
head(mtcars)
##                    mpg cyl disp  hp drat    wt  qsec vs am gear carb
## Mazda RX4         21.0   6  160 110 3.90 2.620 16.46  0  1    4    4
## Mazda RX4 Wag     21.0   6  160 110 3.90 2.875 17.02  0  1    4    4
## Datsun 710        22.8   4  108  93 3.85 2.320 18.61  1  1    4    1
## Hornet 4 Drive    21.4   6  258 110 3.08 3.215 19.44  1  0    3    1
## Hornet Sportabout 18.7   8  360 175 3.15 3.440 17.02  0  0    3    2
## Valiant           18.1   6  225 105 2.76 3.460 20.22  1  0    3    1

R Markdown

This document shows “mtcars” shows information comparison on 6 different cars!!!!

Including Histograms/Plots

Histogram/plots

mpg <- mtcars$mpg
hist(mpg)

we can see that the cars shown the highest frequency for MPG is between the range 15 and 20 miles/gallon annd that the lowest is between 25-30.

mean(mtcars$mpg)#calculate the mean of MPG
## [1] 20.09062
median(mtcars$mpg)#calculate the median of MPG
## [1] 19.2

COMPARING mean= 20.09 and median=19.2 both being very close represents a good representation of this data set being very close in numbers, having a stronger correlation and the data is more symmetrical.

Looking at the scatter plot between MPG and HP we can see that on average the lower the miles/per gallon the higher the Gross horsepower and when the MPG is higher we can see a decrease in HP.

boxplot(mtcars$cyl, mtcars$mpg)

This representation between MPG and CYL show that the cars with fewer cylinders have better fuel efficiency in comparison of cars with more cylinders

data("iris")
head(iris)
##   Sepal.Length Sepal.Width Petal.Length Petal.Width Species
## 1          5.1         3.5          1.4         0.2  setosa
## 2          4.9         3.0          1.4         0.2  setosa
## 3          4.7         3.2          1.3         0.2  setosa
## 4          4.6         3.1          1.5         0.2  setosa
## 5          5.0         3.6          1.4         0.2  setosa
## 6          5.4         3.9          1.7         0.4  setosa
sapply(iris, class)
## Sepal.Length  Sepal.Width Petal.Length  Petal.Width      Species 
##    "numeric"    "numeric"    "numeric"    "numeric"     "factor"
plot(iris$Petal.Length, iris$Petal.Width)

This plot shows the relationship between petal length and petal width and what we can see is that there is a large group represented by a low width around 0.5 and for the low lenth between 1 and 2 and as we increase in width so does length.

plot(iris$Sepal.Length, iris$Species)

This is a simple representation between the species column and Sepal length showing both increase by each term in length and in species