Paul,
Stata's _tabout_ add-on module should be able to do this. I've not used it
for this exact purpose but the documentation includes examples of these
kinds of summaries.
For R, I think you will need to do a fair amount of programming to get this
working well. The simplest approach is probably writing a function that
processes a given variable to a row vector of cells, then just rbind() the
results together into a matrix or data frame; the. You can output using
knitr::kable() or similar. Unfortunately, the best table production
packages, for example stargazer, are very modelling focused.
Best,
Thomas
On Mar 1, 2017 7:13 AM, "Paul Gronke" <[log in to unmask]> wrote:
Quick question for the list: Lisa Bryant (CU Fresno) and I are preparing
some “top lines” and “tabs” for a client with whom we conducted a survey.
If you have seen these before, they are usually organized so that
categorial survey responses are reported on the rows, and the columns
report the overall responses, then responses “tabbed” or “crossed” by
various demographic and political categories. Roll your eyes if you will
that this is just a big set of exploratory cross tabs, but a lot of folks
expect to see them to help digest the survey results.
A typical “tab” looks like this:
VARIABLE Total GOP IND DEM
MEN WOMEN …
Category 1 N % N % N % N % N
% N %
Category 2 N % …
…
We’ve found a package in Stata, tabmult, that allows us to create
“multiple tables” (hence “tabmult”) where the tables are accumulated as
columns. It outputs XML format (bad) and only allows us to report
percentages -or- case count, not both (although the documentation claims
otherwise).
We haven’t found a way to get this done via other Stata procedures
(eststore and esttab are pretty flexible but one thing they don’t do is
produce multiple contingency tables along a horizontal, “long” dimension).
I’m wrestling with the puzzle in R, using the tables package, which outputs
LaTeX and HTML (good) but is also relatively inflexible (and I’m fairly new
to R). Seems like R should do this fairly easily but accumulating the
results and kicking them out in a landscape print format is proving
challenging.
We can produce this pretty easily using Tableau, but then we don’t have
reproducible and flexible code.
Does anyone know of a way to do this, or has anyone seen a script for R or
Stata that does this? I’m surprised; I talked to some local survey firms
and they generally pay someone a fairly hefty fee to do this each survey,
rather than paying just once for a flexible script.
Thanks!
---
Paul Gronke
Professor, Reed College
Director, Early Voting Information Center
http://earlyvoting.net
General Inquiries: Laura Swann [log in to unmask]
Media Inquiries: Kevin Myers [log in to unmask]
**************************************************************
Political Methodology E-Mail List
Editors: Jonathan Homola <[log in to unmask]>
Michelle Torres <[log in to unmask]>
**************************************************************
Send messages to [log in to unmask]
To join the list, cancel your subscription, or modify
your subscription settings visit:
https://www.cambridge.org/core/membership/spm/mailing-list
**************************************************************
**************************************************************
Political Methodology E-Mail List
Editors: Jonathan Homola <[log in to unmask]>
Michelle Torres <[log in to unmask]>
**************************************************************
Send messages to [log in to unmask]
To join the list, cancel your subscription, or modify
your subscription settings visit:
https://www.cambridge.org/core/membership/spm/mailing-list
**************************************************************
|