[R] Error in plotmath

Dennis Murphy djmuser at gmail.com
Mon Aug 1 00:17:14 CEST 2011


Both of these work on my system:

set.seed(6)
x <- rnorm(30, 100, 20)
xs <- seq(50, 150, length=150)
cdf <- pnorm(xs, 100, 20)

plot(xs, cdf, type='l', ylim=c(0,1),
    xlab=expression(x),
    ylab=expression(paste("Prob[", X <= x, "]")))  # FH
lines(ecdf(x), cex=.5)

plot(xs, cdf, type='l', ylim=c(0,1),
     xlab=expression(x),
     ylab=expression("Prob[X" <= "x]"))   # PE
lines(ecdf(x), cex = 0.5)

> sessionInfo()
R version 2.13.1 Patched (2011-07-21 r56468)
Platform: x86_64-pc-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252

attached base packages:
[1] stats     graphics  grDevices utils     datasets  grid      methods
[8] base

other attached packages:
[1] directlabels_1.3 sos_1.3-1        brew_1.0-6       lattice_0.19-30
[5] ggplot2_0.8.9    proto_0.3-9.2    reshape_0.8.4    plyr_1.5.2

Dennis

On Sun, Jul 31, 2011 at 11:25 AM, Frank Harrell
<f.harrell at vanderbilt.edu> wrote:
> Under
>
> platform       x86_64-pc-linux-gnu
> arch           x86_64
> os             linux-gnu
> system         x86_64, linux-gnu
> status
> major          2
> minor          13.1
> year           2011
> month          07
> day            08
> svn rev        56322
> language       R
> version.string R version 2.13.1 (2011-07-08)
>
> I get a double quote mark in place of <= in the y-axis label when I run the
> following.
>
> set.seed(6)
> x <- rnorm(30, 100, 20)
> xs <- seq(50, 150, length=150)
> cdf <- pnorm(xs, 100, 20)
> plot(xs, cdf, type='l', ylim=c(0,1),
>     xlab=expression(x),
>     ylab=expression(paste("Prob[", X <= x, "]")))
> lines(ecdf(x), cex=.5)
>
> The problem also occurs if I use instead ylab=expression(prob(X <= x)))
>
> All is well if I remove "=" but I need <=.
>
> Frank
>
> -----
> Frank Harrell
> Department of Biostatistics, Vanderbilt University
> --
> View this message in context: http://r.789695.n4.nabble.com/Error-in-plotmath-tp3708153p3708153.html
> Sent from the R help mailing list archive at Nabble.com.
>
> ______________________________________________
> 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.
>



More information about the R-help mailing list