Reputation: 47
Continuing from the title, can I change the values of education from '1,2,3,4' to 'primary school, high school, university etc.' ?
We can change in the output, but I wished to know if it's possible in the code. I have tried reading the documentation of gtsummary but did not find the answer.
Upvotes: 0
Views: 664
Reputation: 2797
As the comment suggests, it's about the levels of a factor variable.
data(mtcars)
as_tibble(mtcars)
mtcars$cyl <- as.factor(mtcars$cyl)
levels(mtcars$cyl) <- c("low", "middle", "high")
library(gtsummary)
tbl_summary(mtcars)
Upvotes: 0