Hello everyone,
I am trying to create a summary table (using the package kableextra) that would indicate the mean, median, and standard deviation of two different variables called "wage" and "log_wage" from a data frame. The best I have been able to get was a table with 6 columns and 1 row using the code below.
data("CPS1988")
df <- CPS1988 %>%
mutate(log_wage = log(wage))
Summary <- df %>%
summarize(Mean_wage = mean(wage),
Median_wage = median(wage),
Standard_deviation_wage = sd(wage),
Mean_log_wage = mean(log_wage),
Median_log_wage = median(log_wage),
Standard_deviation_log_wage = sd(log_wage))
Summary %>%
kbl() %>%
kable_classic_2()
However, this is not really the display I'm looking for. I would like 3 columns (1 for each of mean, median and standard deviation) and 2 rows (1 for wage and 1 for log_wage). Can anyone help me with this?
Thank you!
P.S. the data frame comes from the package AER.