[R] Cross Tables with odfTable in odfweave
raptorman18 at gmail.com
Mon Mar 2 20:05:19 CET 2009
Hi, I've been trying to prepare some crosstables for some survey
questions for a client. I have been using the CrossTable function in the
gmodels package. However, this command only seems to be able to create
CrossTables in text documents.
I've been trying to use odfTable in odfweave to create tables that are
standalone objects in the document that I can then convert to other
formats, copy and paste and do whatever with.
The problem is no matter how I try to get the CrossTable into the
odfTable, i either get an error message saying there is no appropriate
method for odfTable or the table is inproperly formatted.
The closest I get is the improperly formatted table from these commands.
x <- capture.output(CrossTable(data.frame[["var1"]],data.frame["var2"]]))
I should probably mention that I like to put the column percentages
generated by the CrossTable function into the table. I find it easier to
explain the tables to people when I have the column percentages in the
table. I also put the p-value from the chisq test in the command, but I
don't mind using the chisq command to insert the p-value after the table
Honestly, I'm not even married to using odfTable. All I'm looking for is
a nicely formatted table, that is a standalone object, that I can copy
and paste and convert at will, and that contains the column percentages
in the table.
Optionally, and lastly I would like to have the p-value of the chisq
test appendended to the end of the table.
How do others output CrossTables tables in R. I would do it by hand, but
keep in mind I actually have many tables (I'm dealing with 4 similar
data sets here), so I would like these tables to be created
automatically and the command should be useable from within a for loop.
Thank You So,
More information about the R-help