I have a simple chart:
barchart(Counts ~ Purchase | Products , data = my.data, groups = Model)
where Purchase in data has values {0,1,2,3...10}. In a chart xlab begins with 1 not 0. How to change it?
Best,
Robert
lattice and probem
4 messages · Robert, Peter Ehlers
robert-mcfadden at o2.pl wrote:
I have a simple chart:
barchart(Counts ~ Purchase | Products , data = my.data, groups = Model)
where Purchase in data has values {0,1,2,3...10}. In a chart xlab begins with 1 not 0. How to change it?
I guess that barchart() will coerce Purchase to be a factor with levels '1' to '10'. So make it a factor with your choice of levels: PurchaseF <- factor(Purchase, levels = 0:10) (or use the scales= argument in barchart()) -Peter Ehlers
Best, Robert
______________________________________________ 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.
Peter Ehlers University of Calgary 403.202.3921
Slight correction below. (Mother always said I needed to learn to count.)
Peter Ehlers wrote:
robert-mcfadden at o2.pl wrote:
I have a simple chart:
barchart(Counts ~ Purchase | Products , data = my.data, groups =
Model)
where Purchase in data has values {0,1,2,3...10}. In a chart xlab
begins with 1 not 0. How to change it?
I guess that barchart() will coerce Purchase to be a factor with levels '1' to '10'. So make it a factor with your choice of
^^^^^^^^^^^^ That should be '1' to '11', of course. -Peter
levels: PurchaseF <- factor(Purchase, levels = 0:10) (or use the scales= argument in barchart()) -Peter Ehlers
Best, Robert
______________________________________________ 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.
Peter Ehlers University of Calgary 403.202.3921
Excellent. Thank you very much. Best, Robert Dnia 18 stycznia 2010 18:20 Peter Ehlers <ehlers at ucalgary.ca> napisa?(a):
robert-mcfadden at o2.pl wrote:
I have a simple chart:
barchart(Counts ~ Purchase | Products , data = my.data, groups = Model)
where Purchase in data has values {0,1,2,3...10}. In a chart xlab begins with 1 not 0. How to change it?
I guess that barchart() will coerce Purchase to be a factor with levels '1' to '10'. So make it a factor with your choice of levels: PurchaseF <- factor(Purchase, levels = 0:10) (or use the scales= argument in barchart()) -Peter Ehlers
Best, Robert
______________________________________________ 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.
-- Peter Ehlers University of Calgary 403.202.3921