Hi, Bert:
On 2/9/2016 11:46 AM, Bert Gunter wrote:
Oh, yes certainly. But I thought the point was to avoid "cheating"
with with() or assuming that the "x" argument was a formula.
Yes, my "smarter" solution doesn't work -- my error. I still think
there must be a small tweak to fix it, but I ha
Oh, yes certainly. But I thought the point was to avoid "cheating"
with with() or assuming that the "x" argument was a formula.
Yes, my "smarter" solution doesn't work -- my error. I still think
there must be a small tweak to fix it, but I haven't figured it out
yet. AFAICS, my earlier "stupid" s
On 2/9/2016 9:51 AM, Bert Gunter wrote:
Spencer, et. al.:
As I suspected, my previous "solution" was pretty stupid. Here is, I
think, the "right" way to
go about it:
plotxy <- function(x,...){
mcall <- match.call(expand.dots=FALSE)
mcall[[1]]<- plot.default
eval(mcall)
}
Spencer, et. al.:
As I suspected, my previous "solution" was pretty stupid. Here is, I
think, the "right" way to
go about it:
plotxy <- function(x,...){
mcall <- match.call(expand.dots=FALSE)
mcall[[1]]<- plot.default
eval(mcall)
}
Best,
Bert
Bert Gunter
"The trouble with having
Well, this may not be the most elegant, but how about:
plotxy <- function(x,data = NULL,...) {
mcall <- match.call()
if(inherits(x,"formula")) enc <- environment(x)
else enc <- parent.frame()
if(!is.null(data)){
env <- data
mcall <- mcall[-match("data",names(mcall))]
Hi, Jeff et al.:
On 2/8/2016 9:52 PM, Jeff Newmiller wrote:
> plotxy(y1~x1, XY, xlim=c(0, max(XY$x1)))
Yes, Thanks.
Is there a way to do this from within "plotxy", so I can call
"plotxy" as I call "plot"?
Thanks,
Spencer
> --
> Sent from my phone. Please excu
plotxy(y1~x1, XY, xlim=c(0, max(XY$x1)))
--
Sent from my phone. Please excuse my brevity.
On February 8, 2016 7:17:57 PM PST, Spencer Graves
wrote:
>I'm getting an interesting error:
>
>
> > plotxy <- function(x, ...){
>+ plot(x, ...)
>+ }
> > XY <- data.frame(x1=1:3, y1=4:6)
> > plotxy(y1~x1
I'm getting an interesting error:
> plotxy <- function(x, ...){
+ plot(x, ...)
+ }
> XY <- data.frame(x1=1:3, y1=4:6)
> plotxy(y1~x1, XY, xlim=c(0, max(x1)))
Show Traceback
Rerun with Debug
Error in eval(expr, envir, enclos) : object 'x1' not found
The following work:
plotxy(y1~x
On Mar 9, 2008, at 1:29 PM, Prof Brian Ripley wrote:
> You should make a habit of using of R's debugging tools, e.g.
> traceback() which gives
>
>> traceback()
> 6: eval(expr, envir, enclos)
> 5: FUN(X[[1L]], ...)
> 4: lapply(dots, eval, data, parent.frame())
> 3: plot.formula(k ~ j, data = obj,
You should make a habit of using of R's debugging tools, e.g. traceback()
which gives
> traceback()
6: eval(expr, envir, enclos)
5: FUN(X[[1L]], ...)
4: lapply(dots, eval, data, parent.frame())
3: plot.formula(k ~ j, data = obj, ...)
2: plot(k ~ j, data = obj, ...)
1: plotw(df, xlim = c(0, 4))
s
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 show
11 matches
Mail list logo