Skip to content

Beside Barplot

3 messages · David Arnold, David L Carlson

#
All,

Is there a way to get a barplot with beside for the following without
reshaping mydata? 


opinion <- c("Almost no chance", "Probably Not","50-50 Chance","A good
chance","Almost certain")
female <- c(96,426,696,663,486)
male <- c(98,286,720,758,597)
mydata<-data.frame(opinion,female,male)

Thanks

David



--
View this message in context: http://r.789695.n4.nabble.com/Beside-Barplot-tp4640807.html
Sent from the R help mailing list archive at Nabble.com.
#
Sure but which way?
structure(list(opinion = structure(c(4L, 5L, 1L, 2L, 3L), .Label = c("50-50
Chance", 
"A good chance", "Almost certain", "Almost no chance", "Probably Not"
), class = "factor"), female = c(96, 426, 696, 663, 486), male = c(98, 
286, 720, 758, 597)), .Names = c("opinion", "female", "male"), row.names =
c(NA, 
-5L), class = "data.frame")
legend.text=opinion, args.legend=list(x="top", ncol=3)))
beside=TRUE, cex.names=.8, legend.text=TRUE))

----------------------------------------------
David L Carlson
Associate Professor of Anthropology
Texas A&M University
College Station, TX 77843-4352
#
Actually the second example should just be
beside=TRUE, cex.names=.8, legend.text=TRUE))

rbind() instead of t(cbind())
-------
David