Résumé de section

    • library(data.table)
      library(dplyr)
      library(readr)
      library(forcats)

      rg2013.dt <- fread("FrenchOpen-men-2013.csv")
      rg2013.dt

      rg2013.df <- read.table("FrenchOpen-men-2013.csv",sep=",",header=TRUE)
      rg2013.tb <- tibble(rg2013.dt)

      rg2013.tb <- read_csv("FrenchOpen-men-2013.csv")

      rg2013.tb |>
        filter(Round==6) |>
        select(Player1,Player2)

      rg2013.tb |>
        filter(Player1=='Roger Federer' | Player2=='Roger Federer')

      rg2013.tb |>
        distinct(Player2)

      rg2013.tb |>
        mutate(nb_points=TPW.1+TPW.2) |>
        summarise(nb_points_moy=mean(nb_points))

      rg2013.tb |>
        mutate(nb_points=TPW.1+TPW.2) |>
        select(Player1,Player2,nb_points)

      rg2013.tb |> mutate(nb_ace=ACE.1+ACE.2) |>
        group_by(Round) |>
        summarise(min=min(nb_ace),max=max(nb_ace),moy=mean(nb_ace))

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

      rg2013.tb |> mutate(dbf=DBF.1+DBF.2) |>
        ggplot() +
        aes(x=dbf) +
        geom_histogram(bins=10) +
        theme_classic()

      rg2013.tb |>
        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()

      rg2013.tb |>
        select(Result, FSP.1, FSP.2) |>
        pivot_longer(cols = c(FSP.1, FSP.2), names_to = "Player", values_to = "FSP") |>
        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()