[R] R: polygon error?

Guazzetti Stefano Stefano.Guazzetti at ausl.re.it
Sat May 26 13:04:52 CEST 2007


It seems to me that you are using polygon in a wrong way.
What you probably need could be something like:
 
polygon(c(rev(t$z), t$z),
         c(rep(0, nrow(t)), t$ht), col=2, border=NA)

Stefano
-----Messaggio originale-----
Da: r-help-bounces at stat.math.ethz.ch
[mailto:r-help-bounces at stat.math.ethz.ch]Per conto di LL
Inviato: sabato 26 maggio 2007 12.34
A: r-help at stat.math.ethz.ch
Oggetto: [R] polygon error?


Hi.. I'm not sure why polygon returns an area above the standard normal curve.

z <- pretty(c(-3,3), 100)
ht <- dnorm(z)
data <- data.frame(z=z, ht=ht)
zc <- 1.645
plot(data, type="l")
lines(data)
t <- subset(data, z>zc)
polygon(t, col="red")

Thanks,
Lance


	[[alternative HTML version deleted]]

______________________________________________
R-help at stat.math.ethz.ch 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