Last active
October 14, 2015 05:56
-
-
Save t-student/c75390211f4129ca703d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Create a 2x2 table of means: | |
calcstuff <- function(x){ | |
a <- mean(x) | |
b <- length(x) | |
paste(round(a,4), " (n=", b,")", sep = "") | |
} | |
with(df1, tapply(sbp, list(gender,age.level), calcstuff)) | |
# age<40 age>=40 | |
# Female "131.1082 (n=6)" "142.3465 (n=5)" | |
# Male "134.8499 (n=4)" "143.815 (n=9)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment