Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

how do I make R markdown and what to put in it to display these thing for my code below: # Step 1 : Read

how do I make R markdown and what to put in it to display these thing for my code below:
# Step 1: Read and Load Data
> housing_data <- read.csv("Housing.csv", stringsAsFactors = TRUE)
>
> # Print first 10 observations to verify
> head(housing_data, 10)
price area bedrooms bathrooms stories mainroad guestroom basement hotwaterheating
1133000007420423 yes no no no
2122500008960444 yes no no no
3122500009960322 yes no yes no
4122150007500422 yes no yes no
5114100007420412 yes yes yes no
6108500007500331 yes no yes no
7101500008580434 yes no no no
81015000016200532 yes no no no
998700008100412 yes yes yes no
1098000005750324 yes yes no no
airconditioning parking prefarea furnishingstatus
1 yes 2 yes furnished
2 yes 3 no furnished
3 no 2 yes semi-furnished
4 yes 3 yes furnished
5 yes 2 no furnished
6 yes 2 yes semi-furnished
7 yes 2 yes semi-furnished
8 no 0 no unfurnished
9 yes 2 yes furnished
10 yes 1 yes unfurnished
>
> # Step 2: Subset Columns
> housing_data <- housing_data[, c("price", "area", "bedrooms", "stories", "basement", "furnishingstatus")]
>
> # Step 3: Determine Variable Types
> str(housing_data)
'data.frame': 545 obs. of 6 variables:
$ price : int 133000001225000012250000122150001141000010850000101500001015000098700009800000...
$ area : int 74208960996075007420750085801620081005750...
$ bedrooms : int 4434434543...
$ stories : int 3422214224...
$ basement : Factor w/2 levels "no","yes": 1122221121...
$ furnishingstatus: Factor w/3 levels "furnished","semi-furnished",..: 1121122313...
>
> # Step 4: Summary Statistics
> summary(housing_data)
price area bedrooms stories basement
Min. : 1750000 Min. : 1650 Min. :1.000 Min. :1.000 no :354
1st Qu.: 34300001st Qu.: 36001st Qu.:2.0001st Qu.:1.000 yes:191
Median : 4340000 Median : 4600 Median :3.000 Median :2.000
Mean : 4766729 Mean : 5151 Mean :2.965 Mean :1.806
3rd Qu.: 57400003rd Qu.: 63603rd Qu.:3.0003rd Qu.:2.000
Max. :13300000 Max. :16200 Max. :6.000 Max. :4.000
furnishingstatus
furnished :140
semi-furnished:227
unfurnished :178
>
> # Step 5: Create Bar Charts for Factors
> # Bar chart for basement
> barplot(table(housing_data$basement), main = "Basement", xlab = "Basement", ylab = "Frequency")
>
> # Bar chart for furnishingstatus
> barplot(table(housing_data$furnishingstatus), main = "Furnishing Status", xlab = "Furnishing Status", ylab = "Frequency")
>
> # Step 6: Create Histograms
> # Histogram for price
> hist(housing_data$price, main = "Histogram of Price", xlab = "Price")
>
> # Histogram for area
> hist(housing_data$area, main = "Histogram of Area", xlab = "Area")
>
> # Step 7: Create Scatter Plot
> plot(housing_data$area, housing_data$price, main = "Scatter Plot of Price vs. Area", xlab = "Area", ylab = "Price")
>
> # Step 8: Subset Data
> housing_basement <- housing_data[housing_data$basement == "yes", ]
>
> # Print first few lines
> head(housing_basement)
price area bedrooms stories basement furnishingstatus
312250000996032 yes semi-furnished
412215000750042 yes furnished
511410000742042 yes furnished
610850000750031 yes semi-furnished
99870000810042 yes furnished
1198000001320032 yes furnished
>
> # Step 9: Create Pie Chart
> pie(table(housing_basement$furnishingstatus), main = "Furnishing Status Distribution")
>
> # Step 1: Read and Load the Data
> housing_data <- read.csv<

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Manga Guide To Databases

Authors: Mana Takahashi, Shoko Azuma, Co Ltd Trend

1st Edition

1593271905, 978-1593271909

Students also viewed these Databases questions

Question

What is the education level of your key public?

Answered: 1 week ago

Question

What are the cultural/ethnic/religious traits of your key public?

Answered: 1 week ago