library(tidyverse)

df <- read_csv("FrenchOpen-men-2013.csv")

df %>% distinct(Player1)
df %>% distinct(Player2)

df %>% 
  filter(Player1=="Roger Federer" | Player2=="Roger Federer") %>% 
  select(contains("Play"))

df %>% filter(Round==6) %>% select(contains("Play"))

df %>% mutate(nb_points=TPW.1+TPW.2) %>% summarise(nb_points_moy=mean(nb_points))

df %>% mutate(nb_ace=ACE.1+ACE.2) %>% group_by(Round) %>% 
  summarise(min=min(nb_ace),max=max(nb_ace),moy=mean(nb_ace))

df %>% mutate(dbf=DBF.1+DBF.2) %>% 
  summarize(tot.df=sum(dbf,na.rm=TRUE))

df %>% mutate(dbf=DBF.1+DBF.2) %>% ggplot() + aes(x=dbf) + geom_histogram(bins=10) + theme_bw()
df %>% mutate(dbf=DBF.1+DBF.2) %>% group_by(Round) %>% summarize(dbf=mean(dbf,na.rm=TRUE)) %>% ggplot() + aes(x=Round,y=dbf) + geom_bar(stat="identity",fill="red") + theme_classic() df %>% select(Result,FSP.1,FSP.2) %>% gather(key="Player",value="FSP",-Result) %>% mutate(Result=as.character((Result==1 & Player=="FSP.1") | (Result==0 & Player=="FSP.2"))) %>% mutate(Result=fct_recode(Result,vic="TRUE",def="FALSE")) %>% ggplot() + aes(x=Result,y=FSP)+geom_boxplot()+theme_classic()

Modifié le: vendredi 16 février 2024, 14:29