Summary statistics in a paper
I want my table similar to this one from the academic paper, but i have an issue displaying the car marks in rows instead of columns. So far my table shows the car marks on the columns instead of rows so if someone could help me out to transpose it would be perfect!
list("style_number-arg:big.mark" = "") %>%
set_gtsummary_theme()
df_selected <- df %>%
select(mark, price, year, mileage, vol_engine, fuel)
gts_stat1 <- tbl_summary(
data = df_selected,
by = mark,
statistic = list(
all_continuous() ~ "{mean} ({sd})",
all_categorical() ~ "{n} ({p}%)"),
label = list(price ~ "Price", year ~ "Build Year", mileage ~ "Mileage", vol_engine ~ "Volume Engine", fuel ~ "Fuel"),
digits = list(year ~ c(0, 1)),
missing = "no"
) %>%
add_overall() %>%
modify_spanning_header(
all_stat_cols() ~ "**Car Marks**"
) %>%
modify_footnote(all_stat_cols() ~ "Mean and Standard Deviation are presented in parentheses. The variable 'Fuel' is separated into different fuel types, and the proportion per fuel type is shown for each mark") %>%
bold_labels() %>%
italicize_levels() %>%
as_gt() %>%
gt::tab_header(title = gt::md("**Summary Statistics**")) %>%
#gt::gtsave(filename = "summary_statistics.ltx")
print(gts_stat1)
I want my column which are the car marks to be rows instead of columns, this is my code so far: