[R] How to dynamically display title for a graph

noclue_ tim.liu at netzero.net
Mon Jan 4 17:30:02 CET 2010


I have written  a function (see below) which encloses a boxplot.  My function
"xbox" takes in a variable name (such as "age"), and do a boxplot. Now I
would like to add a title for the graph dynamically displaying the variable
name as part of title. 

But, in reality, the title displays VALUES of my variable.

Obviously, sprintf does not work. 

Can somebody shed light on how to solve my problem in properly displaying a
title ?

Thanks.

-----------------------------------------------------------------

 xbox<- function(X)
 {
      boxplot(_expenses ~ X, data=my_tab,main=sprintf("title is %s",X))
 }
 
 xbox(age)

-- 
View this message in context: http://n4.nabble.com/How-to-dynamically-display-title-for-a-graph-tp998365p998365.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list