[R] ggplot 2: Histogram with bell curve?
William Dunlap
wdunlap at tibco.com
Tue Jun 7 22:41:52 CEST 2011
> -----Original Message-----
> From: r-help-bounces at r-project.org
> [mailto:r-help-bounces at r-project.org] On Behalf Of dicko ahmadou
> Sent: Tuesday, June 07, 2011 11:41 AM
> To: r-help at r-project.org
> Subject: Re: [R] ggplot 2: Histogram with bell curve?
>
> Hi
>
> Don't use t as var names, because t is also a function (transpose).
> This code should work...
> set.seed(1)
> T <- rnorm(500)
I think that it is more dangerous to use 'T' than 't' since
'T' is a built-in data name (with value TRUE) and I've
seen it used more than 't' (probably because S and S+
regard it as a reserved word). I don't think that reusing
built-in names as local names is as dangerous as some would make
out but reusing built-in data names is probably more dangerous
than using built-in function names for local data names
(because function name lookup is done differently than general
name lookup - the former will only look for functions).
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> qplot(T, geom = "blank") +
> geom_histogram(aes(y = ..density..), colour = "black", fill =
> "blue") +
> stat_density(geom = "line", colour = "red")
>
>
>
> --
> View this message in context:
> http://r.789695.n4.nabble.com/ggplot-2-Histogram-with-bell-cur
ve-tp3580359p3580457.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