Question: Help . With my RStudio project it is saying it cant take my excel as an csv file because it is a xls or xslx

Help . With my RStudio project it is saying it cant take my excel as an csv file because it is a xls or xslx my code is below.
# Read the data
housing_data <- read.csv("Housing.csv", stringsAsFactors = TRUE)
# Print the first 10 observations
head(housing_data, 10)
# Select specific columns
housing_data <- housing_data[, c("price", "area", "bedrooms", "stories", "basement", "furnishingstatus")]
# Print the first 10 observations to verify
head(housing_data, 10)
# Check variable types
str(housing_data)
# Summary statistics
summary(housing_data)
# Load ggplot2 for plotting
library(ggplot2)
# Create bar charts for factor variables
factor_vars <- sapply(housing_data, is.factor)
for (var in names(factor_vars)[factor_vars]){
ggplot(housing_data, aes_string(x = var))+
geom_bar()+
ggtitle(paste("Bar Chart of", var))+
xlab(var)+
ylab("Count")+
theme_minimal()
}
# Histograms
ggplot(housing_data, aes(x = price))+
geom_histogram(binwidth =50000, fill = "blue", color = "black")+
ggtitle("Histogram of Price")+
xlab("Price")+
ylab("Frequency")+
theme_minimal()
ggplot(housing_data, aes(x = area))+
geom_histogram(binwidth =50, fill = "green", color = "black")+
ggtitle("Histogram of Area")+
xlab("Area")+
ylab("Frequency")+
theme_minimal()___
# Scatter plot
ggplot(housing_data, aes(x = area, y = price))+
geom_point()+
ggtitle("Scatter Plot of Price vs. Area")+
xlab("Area")+
ylab("Price")+
theme_minimal()
# Subset data for homes with basement
housing_basement <- subset(housing_data, basement == "yes")
# Print the first few lines
head(housing_basement)
# Pie chart
ggplot(housing_basement, aes(x ="", fill = furnishingstatus))+
geom_bar(width =1)+
coord_polar(theta ="y")+
ggtitle("Pie Chart of Furnishing Status (Homes with Basement)")+
theme_minimal()

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!