From White.Denis@epamail.epa.gov  Thu Nov 15 20:10:23 2001
From: White.Denis@epamail.epa.gov (White.Denis@epamail.epa.gov)
Date: Thu, 15 Nov 2001 21:10:23 +0100 (MET)
Subject: [Rd] pdf() behavior (PR#1174)
Message-ID: <200111152010.VAA22209@pubhealth.ku.dk>

The attached script produces "Error in plot.xy ... negative length
vectors are not allowed" when using pdf() but not when using postscript
().

platform sparc-sun-solaris2.8
arch     sparc
os       solaris2.8
system   sparc, solaris2.8
status
major    1
minor    3.1
year     2001
month    08
day      31
language R

------------------------------------
# script
PDF <- TRUE

f.v1 <- function (x, a, b) b * (x^a)
f.v2 <- function (x, a, b, d) b * (x^a) * exp(d*x)

dat <- scan ("test.dat")

if (PDF) pdf ("test.pdf", width=8.5, height=11) else
  postscript ("test.eps", horizontal=FALSE, onefile=FALSE)

par (mfrow=c(2,1), mar=rep(6,4))

n <- length(dat)
nseq <- seq (n)

fit <- lm (log (dat[nseq]) ~ log (nseq))
b <- exp (fit$coefficients[1])
a <- fit$coefficients[2]
plot (dat[nseq], pch=20)
points (sapply (nseq, f.v1, a, b), col="red", pch=20)

fit <- lm (log (dat[nseq]) ~ log (nseq) + nseq)
b <- exp (fit$coefficients[1])
a <- fit$coefficients[2]
d <- fit$coefficients[3]
plot (dat[nseq], pch=20)
points (sapply (nseq, f.v2, a, b, d), col="red", pch=20)

graphics.off ()

-----------------------------------
# data set
9.585
12.935
14.775
15.625
16.56
17.44
18.165
18.655
19.04
19.49
19.9
20.285
20.61
20.815
21.065
21.3
21.46
21.645
21.82
22.085
22.315
22.45
22.61
22.67
22.79
22.9
23.01
23.1
23.165
23.295
23.4
23.51
23.585
23.64
23.685
23.75
23.805
23.84
23.9
23.955
24.025
24.09
24.14
24.18
24.23
24.275
24.31
24.33
24.345
24.37



-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


[Rd] pdf() behavior (PR#1174)
White.Denis@epamail.epa.gov