R Markdown
#Library
library(tidyverse)
## ── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
## ✔ dplyr 1.1.4 ✔ readr 2.1.6
## ✔ forcats 1.0.1 ✔ stringr 1.6.0
## ✔ ggplot2 4.0.2 ✔ tibble 3.3.1
## ✔ lubridate 1.9.4 ✔ tidyr 1.3.2
## ✔ purrr 1.2.1
## ── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
## ✖ dplyr::filter() masks stats::filter()
## ✖ dplyr::lag() masks stats::lag()
## ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(readxl)
#Set Working Directory
setwd("C:/Users/jalex/OneDrive/Desktop/JS R Homework")
#Data
cars_data <- read_csv("2.9.2026 Homework/cars_data.csv")
## New names:
## Rows: 32 Columns: 12
## ── Column specification
## ──────────────────────────────────────────────────────── Delimiter: "," chr
## (1): ...1 dbl (11): mpg, cyl, disp, hp, drat, wt, qsec, vs, am, gear, carb
## ℹ Use `spec()` to retrieve the full column specification for this data. ℹ
## Specify the column types or set `show_col_types = FALSE` to quiet this message.
## • `` -> `...1`
city <- read_csv("2.9.2026 Homework/city.csv")
## Rows: 7 Columns: 6
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (1): city
## dbl (5): X, high_far, low_far, high_cent, low_cent
##
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
district <- read_excel("2.9.2026 Homework/district.xls")
#Columns to calculate Mean
disp <- cars_data$disp
hp <-cars_data$hp
drat <- cars_data$drat
#Calculate Mean
mean_disp <- mean(disp)
mean_hp <- mean(hp)
mean_drat <- mean(drat)
#Summary Statistics
summary_cars<- summary(cars_data)
mean_disp
## [1] 230.7219
mean_hp
## [1] 146.6875
mean_drat
## [1] 3.596563