Actually this works beautifully as it stands:
breaks <- c(-Inf, -1, 1, Inf)
zz <- lapply(breaks, function(x) if(x==-Inf) quote(-infinity) else
if (x==Inf) quote(infinity) else format(x))
lbl <- mapply(function(x,y)
bquote("(" * .(x) * "," * .(y) * "]"),
to:[EMAIL PROTECTED] On
Behalf Of John Maindonald
Sent: Sunday, December 30, 2007 3:45 PM
To: [EMAIL PROTECTED]
Subject: [R] Symbolic substitution in parallel; use infinity symbol?
I'd like to be able to modify axlab in (C) below so that 'Inf'
is replaced by the infinity sy
John Maindonald wrote:
> I'd like to be able to modify axlab in (C) below so that 'Inf'
> is replaced by the infinity symbol.
>
> y <- rnorm(40)
> breaks <- c(-Inf, -1, 1, Inf)
> x <- cut(y, breaks=breaks)
> plot(unclass(x), y, xaxt="n", xlab="")
>
> ## A: The following gives the axis labels "(-Inf
I'd like to be able to modify axlab in (C) below so that 'Inf'
is replaced by the infinity symbol.
y <- rnorm(40)
breaks <- c(-Inf, -1, 1, Inf)
x <- cut(y, breaks=breaks)
plot(unclass(x), y, xaxt="n", xlab="")
## A: The following gives the axis labels "(-Inf, 1]", etc.
axis(1, at=1:3, labels=exp
4 matches
Mail list logo