On 20/11/2013 9:17 AM, Jean-Louis Abitbol wrote:
Dear R-Helpers,

I am using the (great) tables package in a function this way:

parplot <- function (x){
test <- pkqps[pkqps$estimate == x,]
####
#some plotting
#####
tab <- tabular((Heading("Analyte")*(analyte) * Heading(Site)* (fsite))
          ~ (n=1)+ Justify(c)*Heading(substitute(test$estimate[1]))
                *(result)*(Mean + Median + Min + Max + CV)
                    * Format(digits = 1), data = test)
html(tab, file = paste(qpar$param[1],"stat",".html", sep=""))
}
parplot("Cmax")
parplot("AUClast")
etc...

I am trying to parametrize the heading in tabular with
"Heading(substitute(test$estimate[1]))".
test$estimate[1] is a character variate which is the name I want to
appear in the heading (ie Cmax for example in the first call of the
function.

This does not work and produces just "substitute(test$estimate[1])" in
the heading.

I would use substitute() on the whole formula.  For example,

a <- "New heading"
x <- rnorm(100)

tabular( substitute( Heading( head )*x ~ mean, list(head = a) ) )

Duncan Murdoch

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to