This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.
When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
analysis on ipl 2023 auction dataset
#ipl 2023 auction dataset
data=read.csv("C:/Users/java/Downloads/ipl_2023_dataset.csv")
#summary and structure of data
summary(data)
## Player.Name Base.Price Type Cost.in.Rs...CR.
## Length:568 Length:568 Length:568 Min. : 0.0000
## Class :character Class :character Class :character 1st Qu.: 0.0000
## Mode :character Mode :character Mode :character Median : 0.0000
## Mean : 0.6872
## 3rd Qu.: 0.2000
## Max. :18.5000
## NA's :325
## Cost.in....K. X2022.Squad X2023.Squad
## Min. : 0.00 Length:568 Length:568
## 1st Qu.: 0.00 Class :character Class :character
## Median : 0.00 Mode :character Mode :character
## Mean : 82.47
## 3rd Qu.: 24.00
## Max. :2220.00
## NA's :325
str(data)
## 'data.frame': 568 obs. of 7 variables:
## $ Player.Name : chr "Shivam Mavi" "Joshua Little" "Kane Williamson" "K.S. Bharat" ...
## $ Base.Price : chr "4000000" "5000000" "20000000" "2000000" ...
## $ Type : chr "BOWLER" "BOWLER" "BATSMAN" "WICKETKEEPER" ...
## $ Cost.in.Rs...CR.: num 6 4.4 2 1.2 0.5 0.5 0.2 0 0 0 ...
## $ Cost.in....K. : int 720 528 240 144 60 60 24 0 0 0 ...
## $ X2022.Squad : chr "KKR" "" "SRH" "DC" ...
## $ X2023.Squad : chr "GT" "GT" "GT" "GT" ...
#top few players
head(data)
## Player.Name Base.Price Type Cost.in.Rs...CR. Cost.in....K.
## 1 Shivam Mavi 4000000 BOWLER 6.0 720
## 2 Joshua Little 5000000 BOWLER 4.4 528
## 3 Kane Williamson 20000000 BATSMAN 2.0 240
## 4 K.S. Bharat 2000000 WICKETKEEPER 1.2 144
## 5 Mohit Sharma 5000000 BOWLER 0.5 60
## 6 Odean Smith 5000000 ALL-ROUNDER 0.5 60
## X2022.Squad X2023.Squad
## 1 KKR GT
## 2 GT
## 3 SRH GT
## 4 DC GT
## 5 GT
## 6 PBKS GT
#few players from down
tail(data)
## Player.Name Base.Price Type Cost.in.Rs...CR. Cost.in....K.
## 563 Divyansh Joshi 2000000 ALL-ROUNDER NA NA
## 564 Dhruv Patel 2000000 ALL-ROUNDER NA NA
## 565 Jack Prestwidge 2000000 ALL-ROUNDER NA NA
## 566 Aditya Sarvate 2000000 ALL-ROUNDER NA NA
## 567 Sagar Solanki 2000000 ALL-ROUNDER NA NA
## 568 Prenelan Subrayen 2000000 ALL-ROUNDER NA NA
## X2022.Squad X2023.Squad
## 563 Unsold
## 564 Unsold
## 565 Unsold
## 566 Unsold
## 567 Unsold
## 568 Unsold
for the plots,we are using ggplot2 library.ggplot2 is a popular R data visualization package that provides an intuitive and flexible framework for creating a wide range of high-quality, customized graphs and plots for data analysis and presentation.
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.2.3
#barplot
ggplot(data, aes(x = Player.Name, y = Base.Price)) +
geom_bar(stat = "identity", fill = "skyblue") +
labs(title = "player vs base price", x = "players", y = "base price")
from
this plot, we observed that most of the players were either retained by
their respective teams or have a base price of 20 lakh rupees.
#histogram
ggplot(data, aes(x = Cost.in.Rs...CR.)) +
geom_histogram(binwidth = 5, fill = "pink", color = "brown") +
labs(title = "players", x = "price", y = "Frequency")
## Warning: Removed 325 rows containing non-finite values (`stat_bin()`).
we can conclude the same over here also
#scatter plot
ggplot(data, aes(x = Cost.in.Rs...CR., y = Base.Price)) +
geom_point(color = "green") +
labs(title = "Scatter Plot Example", x = "X Variable", y = "Y Variable")
## Warning: Removed 325 rows containing missing values (`geom_point()`).
this plot didn’t include unsold players.
a=table(data$X2023.Squad)
b=names(a)
a#displaying no of players in each squad
##
## CSK DC GT KKR LSG MI PBKS RCB RR SRH Unsold
## 25 25 25 22 25 24 22 25 25 25 325
share = round(a/sum(a)*100)
a = paste(share,"%",sep="")
the table created above shows no. of players in each squad.
# Create a data frame with the data to be plotted
c <- data.frame(category = b, value = a)
# Create the pie chart using ggplot2
library(ggplot2)
ggplot(c, aes(x = "", y = value, fill = category)) +
geom_bar(stat = "identity", width = 1) +
coord_polar(theta = "y") +
geom_text(aes(label = value), position = position_stack(vjust = 0.5)) +
scale_fill_manual(values = rainbow(length(b))) +
labs(title = "Pie Chart Example")
shows the above analysis in the form of share of pie.
#boxplot
ggplot(data, aes(x = Type, y =Base.Price)) +
geom_boxplot(fill = "grey", color = "black") +
labs(title = "Box Plot Example", x = "Category", y = "Value")
no outliers found.