R Programming: Elegant Cross Tables in R | gtsummary | publication ready cross tables

Поділитися
Вставка
  • Опубліковано 2 лют 2025

КОМЕНТАРІ • 5

  • @DataAnalytic
    @DataAnalytic  2 місяці тому +1

    A quick clip to see the power of tbl_summary in action ua-cam.com/users/clipUgkxdzJBFDR4FKAmq10tkbkBaBoAPnOdd4OH?si=KcUXQqTbwrx-qzhP

  • @dannie4356
    @dannie4356 Рік тому +1

    for the most parts which worked, thank you! but the labelled function... tried checking everything already but i had to change the csv in order to change the variable labels... Also the outcome plot which i exported have a side bar in it? that is so weird!

    • @DataAnalytic
      @DataAnalytic  Рік тому

      Hello
      Just retested the code and it worked fine.
      I suspect that you might have missed the dot in front of the labels, it should be .labels
      labelled::set_variable_labels(.labels = c("Cut of diamond" , "Diamond colour"))
      Cant't think of any other issue.
      Try cutting and pasting the code in a new script and it should work
      library(labelled)
      library(ggplot2)
      library(dplyr)
      library(gtsummary)
      df %
      dplyr::select(cut, color)%>%
      labelled::set_variable_labels(.labels = c("Cut of diamond" , "Diamond colour")) %>%
      tbl_cross(row = cut
      , col = color
      , percent = "row"
      , missing ="no"
      , missing_text = "Missing Values"
      )%>%
      add_p(source_note = TRUE)%>%
      bold_labels()%>%
      bold_levels()
      About the side bar which you mentioned.
      Was it with the first table or the second ( which used the flextable conversion)

    • @marufadnanchowdhury1470
      @marufadnanchowdhury1470 8 місяців тому

      @@DataAnalytic thanks for the code that helped

  • @MizanurShuvraRidwan
    @MizanurShuvraRidwan 7 місяців тому +1

    i tried running the gtsummary package and it shows errors because my variables are factors. So, I guess y9ou need to mention what type of variables work for the gtsummary cross tabs