Open ghost opened 7 years ago
I think this might be a duplicate of https://github.com/sjPlot/devel/issues/97.
However, I'm not sure how your example would look like? Several tables, subsetted by select(q1:q10)
?
Currently, for console output, you can use sjmisc::flat_table()
.
Thanks, read up on #97, sjt.mtab sounds interesting. Thank you for your great work!
I guess what he means is to analyse multiple variables and to split for multiple variables:
i tried this with sjt.xtab(c(x_1, v_2, v_10, v_20), c(v_3, v_4).
This would be really awesome, now i filter with dplyr first, but with data with more categories this is quite hard :(
If you want to create contingency tables from different groups, you could use dplyr::group_by()
and then sjtab(fun = "xtab")
. See also ?sjPlot::sjtab
.
Is this issue solved?
It was more of a wishlist than an issue. There are no further development in sjtab tiwards this right? What I'm looking for is sort of a SPSS custom tables package/function..
Same for me, i would really like to implement some kind of crosstable function in a shiny web app (which anyway seems impossible, since SJplot renders in HTML :(.
Perhaps I'm misunderstanding something. Do you like one crosstable with multiple variables (3, 4 or 5 or more), or do mean "grouping", as I suggested here?
What is the exact difference? ;-).
I show you a picture of a project where i use SPSS for.
Yes, what MarkusLang showed is what I wish for. something like:
df %>% xtab(select(., var1:var5), select(., gender, agevcat, martialstatus), weights = weight, ... options)
This,
efc %>% group_by(e16sex, c172code) %>% select(e42dep, n4pstu, e16sex, c172code) %>% sjtab(fun = "xtab", use.viewer = FALSE)
gives me 6 tables, whereas I would rather put gender and level of education as BY variables
Still a bit confused... Could you post a screenshot of the desired graphical output?
Like this:
This with the efc data
Yes, but this only works with one variable, not for multiple variables, right?
If im wrong, can you please show me the output?
No, I can add any number of variables to table rows:
If there was an R-package for these kinds of tables, and if they could also be exported to a spreadsheet.. so nice
This is exactly what i need!! Can you show me an example Syntax?
I can, but I don't want to clutter this thread with that, where can I contact you?
I'm also looking for a package that can produce the output above!!
langmarkus@hotmail.com
These are "just" combined tables... Shouldn't be too difficult to implement.
I thought you were looking for something like this:
library(sjmisc)
data(efc)
flat_table(efc, c161sex, c172code, n4pstu)
# or
flat_table(efc, c161sex, c172code, n4pstu, e42dep)
If you'd ever find time to implement something like this to sjPlot, I'd be more than willing to help out, like testing or such. Great work Daniel!
Is it possible to crosstab more than one variable (rows, perhaps by dplyr:select) by several variables (columns), both nested and flat (side by side) so to speak. something like: sjt.xtab(select(q1:q10),select(gender,agecategory))