[R] hist2d() function in R?
Peter Dalgaard BSA
p.dalgaard at biostat.ku.dk
Sun Mar 26 22:25:53 CEST 2000
Aleksey Naumov <naumov at acsu.buffalo.edu> writes:
> Dear R users,
>
> I am just starting with R (v. 1.0.0) and I use Vehables & Ripley's
> MASS book for examples.
> In the intro session, there is an example of a 2D histogram on an 8x8
> grid:
>
> x <- rnorm(1000)
> y <- rnorm(1000)
> contour(hist2d(x,y,,,8,8))
>
> R complains:
>
> Error in contour(hist2d(x, y, , , 8, 8)) :
> couldn't find function "hist2d"
>
> I looked for hist2d() in the manual (including the latest development
> version), but didn't
> find it. Is there such a function or a suitable substitute?
I don't have V&R with me, but does this look somewhat right?
contour(table(cut(x,pretty(x,8)),cut(y,pretty(y,8))))
[of course the table() construction won't actually plot a 2d histogram...]
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard at biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list