This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
summary(cars)
## speed dist
## Min. : 4.0 Min. : 2.00
## 1st Qu.:12.0 1st Qu.: 26.00
## Median :15.0 Median : 36.00
## Mean :15.4 Mean : 42.98
## 3rd Qu.:19.0 3rd Qu.: 56.00
## Max. :25.0 Max. :120.00
You can also embed plots, for example:
Note that the echo = FALSE parameter was added to the
code chunk to prevent printing of the R code that generated the plot. ##
Exercise 3
library(readxl)
## Warning: package 'readxl' was built under R version 4.4.3
car_sales <- read_excel(
"C:/Users/Admin/Downloads/Assignment Act 65/Assignment Act 65/car_sales.xlsx"
)
car_sales <- data.frame(car_sales[, 1:13])
data <- na.omit(car_sales)
data[, -1] <- scale(data[, -1])
head(data)
## model sales resale type price engine_s horsepow
## 1 Integra -0.5621358 -0.1440282 -0.571602 -0.3158715 -1.1834292 -0.7045706
## 2 TL -0.2628377 0.1588420 -0.571602 0.1717713 0.1433723 0.7461447
## 4 RL -0.6731286 1.0075678 -0.571602 1.1329225 0.4276869 0.4901361
## 5 A4 -0.5157989 0.3639148 -0.571602 -0.1398961 -1.1834292 -0.5338982
## 6 A6 -0.5373420 0.4759294 -0.571602 0.5640058 -0.2357138 0.3194637
## 7 A8 -0.7691598 1.8067488 -0.571602 2.5463801 1.0910877 2.1968600
## wheelbas width length curb_wgt fuel_cap mpg
## 1 -0.76099980 -1.10186337 -1.1059950 -1.1471500 -1.21562468 0.8814503
## 2 0.09608047 -0.25204126 0.3741573 0.3231015 -0.16149767 0.2002767
## 4 0.90347493 0.05956018 0.6413068 0.8807254 0.04932774 -0.4808969
## 5 -0.58709946 -0.84691674 -0.7016607 -0.5459879 -0.37232307 0.6543924
## 6 0.17060919 1.39094816 0.3091750 0.3967816 0.18109362 -0.4808969
## 7 0.70473168 0.79607268 0.7568308 0.9678018 1.55145874 -0.7079548