Hello, If it helps...:
Lines <- "pet gender dog male dog female dog male cat female cat female cat male " d.f <- read.table(textConnection(Lines), header=T, as.is = TRUE) d.tab<-table(d.f$pet, d.f$gender) d.f.tab<-as.data.frame(table(d.f$pet, d.f$gender)) names(d.f.tab)<-c('pet','gender', 'Freq') library(lattice) histogram( ~ Freq | pet *gender, data=d.f.tab, groups=gender, stack=T, horizontal=T ) Regards, Carlos Ortega www.qualityexcellence.es 2012/1/27 Mario Giesel <rr.gie...@yahoo.de> > Hello, R friends, > > I'm trying to crack this nut: > > > Example Data. > > pet gender > dog male > dog female > dog male > cat female > cat female > cat male > > Plot Task. > > Horizontal 100% bars where > y axis shows gender factor (male vs. female) > and x axis shows percentage of kind of pets (dog vs. cat) > so that % dogs + % cats are stacked in 1 bar and sum up to 100% (for each > gender group 1 bar). > > How can this be done with ggplot2? > > Thanks for any comments! > > Mario > > [[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. > > [[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.