[R] Calling plot with a formula, from within a function, using ..., and xlim

From: Charilaos Skiadas <cskiadas_at_gmail.com>
Date: Sun, 09 Mar 2008 11:55:28 -0400

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

R-help_at_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. Received on Sun 09 Mar 2008 - 15:59:55 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 09 Mar 2008 - 18:30:20 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive