Skip to content

Project Cars Df analysis

library(readr)
cars_df<- read_csv("cars.csv")
names(cars_df)[1] <- "car_name"
car_pricing <- subset(cars_df, select = c(car_name,Price))
										 
				                         
pricing_category <- function(x){
	if(x < 20000){
		return("Budget Car")
	}else if(x > 20000 & x < 35000){
		return("Suitable Car")
	}else{
		return("Expensive car")
	}
}
car_pricing$category <- sapply(car_pricing$Price,pricing_category)
table(car_pricing$category)