I would like some help on creating formatted tables in R - whether it's just using the normal IDE or R Markdown. There are two main things that I'd like to do:
- Present the descriptive statistics (Mean, Median, Min, Max) by group based on different columns
- Present the descriptive statistic based on the total sample (ungrouped data)
Sample data:
df <- data.frame(Gender = c("F", "M", "F", "M", "M", "M", "M", "F", "M", "M"),
Young = c("Y", "N", "Y", "N", "Y", "N", "Y", "N", "Y", "N"),
Age = c("14", "25", "13", "24", "14", "25", "13", "24", "10", "26"),
Location = c("Suburb", "Rural", "Suburb", "Rural","Suburb", "Rural","Suburb", "Rural","Suburb", "Rural"))
Expected results
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…