[R] how to show percentage of individuals for two groups on histogram?
Ana Marija
@okov|c@@n@m@r|j@ @end|ng |rom gm@||@com
Fri May 22 00:52:40 CEST 2020
the result would basically look something like this on in attach or
the overlay of those two plots
On Thu, May 21, 2020 at 5:23 PM Ana Marija <sokovic.anamarija using gmail.com> wrote:
>
> Hello,
>
> I have a data frame like this:
> > head(a)
> FID IID FLASER PLASER DIABDUR HBA1C ESRD pheno
> 1 fam1000-03 G1000 1 1 38 10.2 1 control
> 2 fam1001-03 G1001 1 1 15 7.3 1 control
> 3 fam1003-03 G1003 1 2 17 7.0 1 case
> 4 fam1005-03 G1005 1 1 36 7.7 1 control
> 5 fam1009-03 G1009 1 1 23 7.6 1 control
> 6 fam1052-03 G1052 1 1 32 7.3 1 control
>
> > dim(a)
> [1] 1698 8
>
> I am doing histogram plot via:
> ggplot(a, aes(x=HBA1C, fill=pheno)) + geom_histogram(binwidth=.5,
> position="dodge")
>
> there is 848 who have "case" in pheno column and 892 who have
> "control" in pheno column.
>
> I would like to have on y-axis shown percentage of individuals which
> have either "case" or "control" in pheno instead of count.
>
> Please advise,
> Ana
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Screen Shot 2020-05-21 at 5.49.37 PM.png
Type: image/png
Size: 52888 bytes
Desc: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20200521/740baf08/attachment.png>
More information about the R-help
mailing list