Re: [R] barplot with factors problem
On 03/08/2010 04:48 AM, casperyc wrote: http://n4.nabble.com/file/n1583733/100307070476876317b486a941.jpg I want to get a histogram by factors. Hi casperyc, Have a look at the third example for the barp function in the plotrix package. Jim __ 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.
[R] barplot with factors problem
http://www.harding.edu/fmccown/R/#autosdatafile http://www.harding.edu/fmccown/R/#autosdatafile I am tring to get a barchat by factors, following the example in that link above. === x=c(145,40,40,120,180, 140,155,90,160,95, 195,150,205,110,160, 45,40,195,65,145, 195,230,115,235,225, 120,55,50,80,45 ) y2=c( rep(as.character(1),5), rep(as.character(2),5), rep(as.character(3),5), rep(as.character(4),5), rep(as.character(5),5), rep(as.character(6),5) ) barplot(as.matrix(x,y2),beside=TRUE,col=rainbow(5)) === Why it does not seperate (by 'some' space) by the factors? like not recognising the factors (1,2,3,4,5,6)? Thanks. casper -- View this message in context: http://n4.nabble.com/barplot-with-factors-problem-tp1583671p1583671.html Sent from the R help mailing list archive at Nabble.com. __ 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.
Re: [R] barplot with factors problem
On 07.03.2010 17:42, casperyc wrote: http://www.harding.edu/fmccown/R/#autosdatafile http://www.harding.edu/fmccown/R/#autosdatafile I am tring to get a barchat by factors, following the example in that link above. === x=c(145,40,40,120,180, 140,155,90,160,95, 195,150,205,110,160, 45,40,195,65,145, 195,230,115,235,225, 120,55,50,80,45 ) y2=c( rep(as.character(1),5), rep(as.character(2),5), rep(as.character(3),5), rep(as.character(4),5), rep(as.character(5),5), rep(as.character(6),5) ) barplot(as.matrix(x,y2),beside=TRUE,col=rainbow(5)) You know that a matrix has exactly one mode? I guess you want something like barplot(matrix(x, ncol=6), beside=TRUE, col=rainbow(5)) but since you do not tell what you want to get ... Uwe Ligges === Why it does not seperate (by 'some' space) by the factors? like not recognising the factors (1,2,3,4,5,6)? Thanks. casper __ 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.
Re: [R] barplot with factors problem
http://n4.nabble.com/file/n1583733/100307070476876317b486a941.jpg I want to get a histogram by factors. Thanks. -- View this message in context: http://n4.nabble.com/barplot-with-factors-problem-tp1583671p1583733.html Sent from the R help mailing list archive at Nabble.com. __ 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.