Dear all, I have two factors 'country' and 'status' which I would like to plot via barchart (lattice). 'status' consist of three different levels and should be the grouping variable, i.e. there should be drawn three different panels and within each panel a barchart of 'country'. barchart(daten$COUNTRY|daten$STATUS), barchart(table(daten$COUNTRY)|table(daten$STATUS)), etc. are obviously wrong. I have absolutely no idea how to do this. You can download the datafile from <http://www.uni-koeln.de/~ahf34/meta.txt> TIA, Bernd -- Bernd Weiss, M.A. Universitaet zu Koeln / University of Cologne Forschungsinstitut fuer Soziologie / Research Institute for Sociology Greinstr. 2 / 50 939 Cologne / Germany Phone: +49 221 / 470-4234 E-Mail: <bernd.weiss at uni-koeln.de>
On Sunday 02 November 2003 04:17, Bernd Weiss wrote:> Dear all, > > I have two factors 'country' and 'status' which I would like to plot via > barchart (lattice). 'status' consist of three different levels and should > be the grouping variable,the correct terminology would be 'conditioning' variable. Grouping variables distinguish data within a panel.> i.e. there should be drawn three different panels > and within each panel a barchart of 'country'.I'm not sure what that means. If you mean barchart of the frequency of occurrence of each country within each 'status', then you could try foo <- read.table("meta.txt") barchart(daten.COUNTRY ~ Freq| daten.STATUS, data = as.data.frame(table(foo)), origin = 0) HTH, Deepayan> barchart(daten$COUNTRY|daten$STATUS), > barchart(table(daten$COUNTRY)|table(daten$STATUS)), > etc. are obviously wrong. > > I have absolutely no idea how to do this. > > You can download the datafile from > <http://www.uni-koeln.de/~ahf34/meta.txt> > > TIA, > > Bernd
Am 2 Nov 2003 um 10:34 hat Deepayan Sarkar geschrieben:> > On Sunday 02 November 2003 04:17, Bernd Weiss wrote: > > Dear all, > > > > I have two factors 'country' and 'status' which I would like to plot via > > barchart (lattice). 'status' consist of three different levels and should > > be the grouping variable, > > the correct terminology would be 'conditioning' variable. Grouping variables > distinguish data within a panel. > > > i.e. there should be drawn three different panels > > and within each panel a barchart of 'country'. > > I'm not sure what that means. If you mean barchart of the frequency of > occurrence of each country within each 'status', then you could try > > foo <- read.table("meta.txt") > barchart(daten.COUNTRY ~ Freq| daten.STATUS, > data = as.data.frame(table(foo)), > origin = 0) >That's it! Thank you very much for your help! Bernd
Bernd, for counts use histogram instead of barchart, and leave the left side of the formula empty. library(lattice) meta<-read.table("meta.txt",header=T) histogram(~daten.COUNTRY|daten.STATUS,data=meta) Check "scales" in xyplot (it's also valid for histogram) so you get the names of the countries as vertical x-labels instead of the numbers. --------- You wrote ---- I have two factors 'country' and 'status' which I would like to plot via barchart (lattice). 'status' consist of three different levels and should be the grouping variable, i.e. there should be drawn three different panels and within each panel a barchart of 'country'. barchart(daten$COUNTRY|daten$STATUS), barchart(table(daten$COUNTRY)|table(daten$STATUS)),