Hi,everybody

I have a dataframe like this

FID IID STATUS
1    4621    live
1    4628    dead
2    4631    live
2    4632    live
2    4633    live
2    4634    live
6    4675    live
6    4679    dead
10    4716    dead
10    4719    live
10    4721    dead
11    4726    live
11    4728    nosperm
11    4730    nosperm
12    4732    live
17    4783    live
17    4783    live
17    4784    live

I just want a barblot to count "live" or "dead" in every "FID", and fill
the bar with different colour.

I try these codes:

p<-ggplot(data,aes(x=FID));
p+geom_bar(aes(x=factor(FID),y=..count..,fill=STATUS))

But how could I exclude "nosperm" or other levels just in the use of
ggplot2 without generating another dataframe

Thanks a lot

Yao He
—————————————————————————
Master candidate in 2rd year
Department of Animal genetics & breeding
Room 436,College of Animial Science&Technology,
China Agriculture University,Beijing,100193
E-mail: yao.h.1...@gmail.com <ming...@vt.edu>
——————————————————————————

        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to