# flextableAndPowerpoint

    library(presenter)
    library(dplyr)

## Create a flextable from a small data frame

    set.seed(1)

    iris %>%
      relocate("Species") %>%
      sample_n(10) %>%
      arrange(Species) -> iris_slice

    header_words <- c("Sepal", "Petal")
    last_id_col <- "Species"

    make_flextable(iris_slice, header_words = header_words, last_id_col = last_id_col) -> myflex

    myflex

## Create a pivot table with flextable

    tibble::tibble(my_letters = sample(letters[1:4], 100, T),
           my_numbers = sample(1:4, 100, T)) -> cross_table

    cross_table %>%
      make_pivot_table(my_letters, my_numbers, theme = "tron") -> tron_cross_table

    ## Warning: There was 1 warning in `dplyr::mutate()`.
    ## ℹ In argument: `dplyr::across(.fns = ~stringr::str_c("(", ., ")"))`.
    ## Caused by warning:
    ## ! Using `across()` without supplying `.cols` was deprecated in dplyr 1.1.0.
    ## ℹ Please supply `.cols` instead.

    tron_cross_table

    iris %>%
      dplyr::mutate(Species1 = stringr::str_c(Species, " very good")) %>%
      make_pivot_table(Species1, Species, show_percentages = "none", tbl_nm = "gold table", theme = "zebra_gold") -> tbl

    tbl

## export tables to powerpoint

    myflex %>%
      make_powerpoint() # a new ppt is created, named after the table

    tron_cross_table %>%
      make_powerpoint("myflex.pptx") # append this slide to the previous ppt

Multiple powerpoint slides