Message-ID: <D17A6241-5992-4428-B967-5EF02EF7F77D@gmail.com>
Date: 2008-03-09T15:55:28Z
From: Charilaos Skiadas
Subject: Calling plot with a formula, from within a function, using ..., and xlim
I ran into a weird, to me at least, problem, and hoping someone can
shed some light into it. In a nutshell, there seems to be some
problem when one calls plot with a formula, from within another
function, using ... to pass arguments, and one of those arguments
being xlim (and only xlim shows this problem). Here is an example:
> plotw <- function(obj,...) {
+ plot(k~j, data=obj,...)
+ }
> plotw2 <- function(obj,...) {
+ plot(obj$j,obj$k, ...)
+ }
> df <- data.frame(j=1:3,k=1:3)
> plotw(df, las=1, xaxs="i")
> plotw(df, xlim=c(0,4))
Error in eval(expr, envir, enclos) :
..1 used in an incorrect context, no ... to look in
> plotw2(df, las=1, xaxs="i")
> plotw2(df, xlim=c(0,4))
I was guessing this might be related to some sort of argument
matching, but I don't see why xaxs doesn't cause a problem in that
case. So I am somewhat puzzled.
Thanks in advance.
Haris Skiadas
Department of Mathematics and Computer Science
Hanover College