Skip to content
Prev 86132 / 398503 Next

"main" parameter in plot.default vs plot.formula

Folks:

R 2.2.0 on Windows.

I find the following somewhat puzzling:
## following works fine:
## following produces an error:
Error in paste(n[1] == 1, " and ", n[2] == 2) : object "n" not found

*******************************

Note 1: I assume that this is due to the following documented behavior of
plot.formula():

"Both the terms in the formula and the ... arguments are evaluated in data
enclosed in parent.frame() if data is a list or a data frame."

Nevertheless, the behavior seems inconsistent to me. Am I missing something
(including the "I assume ..." comment)?

Note 2: If one uses substitute() instead, it works fine:

plot(y~x ,main= substitute(bquote(n[1] == a),list(a=a)))


Any illumination, public or private, would be appreciated.

Cheers,
Bert

 
-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box