Skip to content

bryce-hales/r_code_final_project

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 

Repository files navigation

Airbnb Pricing Patterns in New York City Using R

Project Overview

The purpose of this project is to use R to gain insights into Airbnb listing prices in New York City. This analysis demonstrates the ability to import, clean, manipulate, visualize, and analyze data using R. It also includes descriptive statistics, a hypothesis test, and a linear regression model to better understand the factors associated with Airbnb pricing.

This project uses the NYC Airbnb Open Data dataset and focuses on how variables such as room type, borough, minimum nights, reviews, and availability relate to listing price.


Project Question

How can I use R to gain insights into Airbnb listing prices in New York City?

More specifically, this project explores:

  • How prices vary by room type
  • How prices vary across boroughs
  • Whether entire home or apartment listings differ significantly in price from private room listings
  • Which listing characteristics help explain price differences

Dataset

Dataset name: NYC Airbnb Open Data
File used in this project: AB_NYC_2019.csv

read_csv("data/AB_NYC_2019.csv")

Tools Used

  • R
  • tidyverse
  • dplyr
  • ggplot2

Data Cleaning

Several cleaning steps were performed before analysis:

  • Selected only the columns needed for this project
  • Removed missing values from key variables
  • Removed listings with a price of 0
  • Removed extreme price outliers above 1000 to make the analysis and visualizations more readable
  • Converted room type and borough variables into factors where appropriate

These cleaning steps were documented with comments directly in the R script.


Data Manipulation

This project uses multiple dplyr operations, including:

  • select()
  • filter()
  • mutate()
  • group_by() and summarise()
  • arrange()

These operations were used to prepare the dataset for analysis and produce grouped summaries.


Descriptive Statistics

The following descriptive statistics were used:

  • Mean price
  • Median price
  • Standard deviation of price

Grouped descriptive statistics were also calculated by room type and borough.


Hypothesis Test

A two-sample t-test was performed to compare prices between two room types:

  • Null Hypothesis (H0): The mean price of entire home or apartment listings is equal to the mean price of private room listings.
  • Alternative Hypothesis (Ha): The mean price of entire home or apartment listings is different from the mean price of private room listings.

This test was chosen because price is a numeric variable and room type creates two groups for comparison.


Linear Regression

A linear regression model was used to examine whether price can be predicted by:

  • Minimum nights
  • Number of reviews
  • Reviews per month
  • Availability over 365 days

The regression helps show which listing characteristics are associated with price changes.


Visualizations

This project includes at least three visualizations:

  1. Boxplot of price by room type
    Shows how price distributions differ across room types.

  2. Bar chart of average price by borough
    Highlights which boroughs have the highest average listing prices.

  3. Scatter plot of price vs. number of reviews with a regression line
    Helps visualize the relationship between reviews and price.

The visualizations are saved in the output folder.


Key Insights

This project is designed to reveal several important insights, including:

  • Entire homes or apartments tend to have higher prices than private rooms
  • Prices vary across boroughs
  • Some listing characteristics may help explain differences in price
  • Statistical testing and regression provide deeper insight beyond simple summaries

Your exact findings should be updated based on the output you get when running the script.


Repository Structure

airbnb-r-final-project/
├── README.md
├── data/
│   └── AB_NYC_2019.csv
├── scripts/
│   └── final_project_analysis.R
└── output/
    ├── plot_price_by_room_type.png
    ├── plot_avg_price_by_borough.png
    └── plot_price_vs_reviews.png

Conclusion

This project demonstrates how R can be used to gain meaningful insights from a publicly available dataset through cleaning, manipulation, visualization, statistical analysis, and regression modeling. The analysis shows how Airbnb prices differ by listing type and location, while also applying techniques that are useful in future academic and professional data work.

About

This is my repository for my final project in the R Code section of my Data Analytics/Technology Program.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages