-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Twoway summary tables #115
Comments
My suggestion for this would actually be to use a different package ;) In particular, you could try a different package I wrote called ttt. The two packages are independent, but compliment each other and work together to some extent, as in this example: library(ttt)
library(table1)
options(ttt.theme="booktabs")
# simulate some data for this example
set.seed(123)
n <- 123
dat <- data.frame(
gender = sample(factor(c("Female", "Male")), n, replace=T),
region = sample(factor(LETTERS[1:5]), n, replace=T),
score = runif(n)
)
label(dat$region) <- "Region"
rndr <- function(x) {
table1::render.default(x, render.continuous=c("N", "Mean", "SD"))[-1]
}
ttt(score ~ region | gender, data=dat, render=rndr, lab="Gender") The result looks like this: Not sure if that is exactly what you are looking, but the package is pretty flexible. (EDIT: changed theme to |
Thank you for your quick response. This is incredibly useful for my current needs. I'll be sure to read the documentation of the I really appreciate your support! |
@ronaldsanchez87: This is easy to do with library(ttt)
options(ttt.theme="booktabs")
set.seed(123)
dat <- expand.grid(
family_id_mrn_count = 1:3,
caregiver_child_group = factor(1:2, labels=c("Caregiver", "Child")),
y = factor(1:3, labels=c("OB Post-Natal", "OB Pre-Natal", "Pediatrics"))
)
dat <- dat[sample(1:nrow(dat), 100, replace=T),]
ttt(rep(1, nrow(dat)) ~ family_id_mrn_count + caregiver_child_group | y, data=dat) |
This is very helpful, thank you. I realize there are two additional things I need to be able to do. First, add additional variables under the family_id_mrn_count that will also be sub-grouped by caregiver_child_group. Secondly, apply anova and chi-square tests for each combination. |
Hi there,
I'm looking for a way to create a two-way table that uses a summary measure to fill the cells. For example, I have 3 variables: gender (factor), region (factor), and score (continuous). I aim to generate a two-way table featuring the factor variables, region and gender, as rows and columns, respectively. But this table should display summary statistics of score, such as mean and standard deviation, as the content of each cell.
Any thoughts on how this could be done?
The text was updated successfully, but these errors were encountered: