[R] Parametrizing heading in tables package

Jean-Louis Abitbol abitbol at sent.com
Wed Nov 20 15:17:03 CET 2013


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 Have also tried quote() without success.

Any advice on how to do this will be much appreciated,

Best wishes, JL



More information about the R-help mailing list