Our Hmisc package summary.formula function and its latex methods can make some fairly advanced tables. But the tables have to be regular. For example, all rows of the tables are based on the same data frame. I'm thinking that what is needed is a ggplot2-like set of functions for building a table row-by-row or row-by-block of rows. Different row blocks could have different denominators, e.g., the first part of the table might be on everyone and a latter block of rows be for females, with different summary statistics computed. Has anyone already written functions creating LaTeX markup with such functionality? Thanks Frank -- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University
Duncan Murdoch
2013-Jul-31 20:29 UTC
[R] Does a general latex table-making function exist?
On 13-07-31 4:03 PM, Frank Harrell wrote:> Our Hmisc package summary.formula function and its latex methods can > make some fairly advanced tables. But the tables have to be regular. > For example, all rows of the tables are based on the same data frame. > I'm thinking that what is needed is a ggplot2-like set of functions for > building a table row-by-row or row-by-block of rows. Different row > blocks could have different denominators, e.g., the first part of the > table might be on everyone and a latter block of rows be for females, > with different summary statistics computed. > > Has anyone already written functions creating LaTeX markup with such > functionality?My tables package does some of what you are asking for; I'm not sure if it does everything. Duncan Murdoch
Duncan, I had read your excellent tables package vignette at http://cran.r-project.org/web/packages/tables/vignettes/tables.pdf when it first came out. It is extremely impressive. I'm glad to be reminded to give it another look. Is there a way to make the special symbols n and 1 refer to the number of non-missing observations rather than the length of a vector? Do you feel like taking on this challenge? An example of an irregular table I'm thinking of is the following Females Males Q1 Med Q3 (n) Q1 Med Q3 (n) Age 25 49 63 (1016) 26 50 64 (1767) Canadians Weight (kg) 57 63 74 ( 243) 67 73 90 ( 401) Canadians could mean country=='Canada'. Thanks! Frank -- Frank E Harrell Jr Professor and Chairman School of Medicine Department of Biostatistics Vanderbilt University