Hi all, I'm trying to do an example in Deepayan Sarkar's Lattice book. It involves making a barchart based on the Titanic dataset. I can get the barchart to plot fine; however, when I try to edit panel.grid, I get an error: > titan<-barchart(Class ~ Freq | Age + Sex, data = as.data.frame(Titanic), groups=Survived, stack=TRUE, layout=c(4,1), auto.key=list(title="Survived", columns=2), scales=list(x="free")) > titan <--- this plot is fine > update(titan, panel = function(...) { panel.barchart(...)}) <--- same thing; also fine > update(titan, panel = function(...) { panel.grid(h = 0,v = -1) panel.barchart(...)}) Error: syntax error Any advice? I'm using R 2.8.1 on OS X Leopard if it helps. Thanks, Chris Jones c_jones at mit.edu
Christopher Jones <c_jones <at> MIT.EDU> writes:> I'm trying to do an example in Deepayan Sarkar's Lattice book. It > involves making a barchart based on the Titanic dataset. I can get > the barchart to plot fine; however, when I try to edit panel.grid, I > get an error: > > > titan<-barchart(Class ~ Freq | Age + Sex, data = > as.data.frame(Titanic), groups=Survived, stack=TRUE, layout=c(4,1), > auto.key=list(title="Survived", columns=2), scales=list(x="free")) > > titan <--- this plot is fine > > update(titan, panel = function(...) { panel.barchart(...)}) <--- > same thing; also fine > > update(titan, panel = function(...) { panel.grid(h = 0,v = -1) > panel.barchart(...)}) > Error: syntax error >update(titan, panel = function(...) { panel.grid(h = 0,v = -1) panel.barchart(...) } ) works for me (even if I always would feel unsecure about using ... only). Dieter
On Feb 7, 2009, at 8:05 PM, Christopher Jones wrote:> Hi all, > > I'm trying to do an example in Deepayan Sarkar's Lattice book. It > involves making a barchart based on the Titanic dataset. I can get > the barchart to plot fine; however, when I try to edit panel.grid, I > get an error: > > > titan<-barchart(Class ~ Freq | Age + Sex, data = > as.data.frame(Titanic), groups=Survived, stack=TRUE, layout=c(4,1), > auto.key=list(title="Survived", columns=2), scales=list(x="free")) > > titan <--- this plot is fine > > update(titan, panel = function(...) { panel.barchart(...)}) <--- > same thing; also fine > > update(titan, panel = function(...) { panel.grid(h = 0,v = -1) > panel.barchart(...)})Scanning that line makes me wonder if you are forgetting to separate the individual panel calls with the appropriate separator (";").> > Error: syntax error > > Any advice? I'm using R 2.8.1 on OS X Leopard if it helps.My advice would be to spend a bit more time articulating your goals. -- David Winsemius> > > Thanks, > Chris Jones > c_jones at mit.edu > > ______________________________________________ > 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.