Hello,
Im trying to create a bar chart. I have a file with two different columns. I
have created bar charts before where I am only reading from one column but
now i wish to read from two columns. Here is the code i use when creating
bar charts when reading from one column:
satisfaction
<-read.table("C://project/graphs/satisfaction/reason.csv",
sep=",", header=TRUE)
barplot(table(satisfaction$reason),
cex.names=1.0,
col="blue",
ylab="Number of people surveyed",
border="blue", density=c(10,20,30,40,50),
main="Results")
Does this code above need to change much to create 2 bars in my graph?
Here is my file I am working with. Im basically looking to present in a
graph the number of females that are managers or Clerical staff.
gender	relationship
Female	Manager
Female	Clerical
Female	Clerical
Female	Manager
Female	Manager
Female	Clerical
Female	Manager
Female	Manager
Female	Clerical
Female	Clerical
Female	Clerical
Female	Manager
Female	Manager
Female	Clerical
Thank you in advance.
Best Regards,
John Hogan.
-- 
View this message in context:
http://www.nabble.com/Bar-Charts-tp16807973p16807973.html
Sent from the R help mailing list archive at Nabble.com.
Hi,
I created some bar charts. My first one is concerned with males, and my
second concerned with females.
Is there a way I can put the charts into one chart? There is 2 different
columns in each file. Here is my new file containing males and females:
gender,familar
Female,Yes
Female,Yes
Female,Yes
Female,Yes
Female,Yes
Female,No
Female,Yes
Female,Yes
Female,Yes
Female,Yes
Female,Yes
Female,Yes
Female,No
Female,Yes
Female,No
Female,Yes
Female,Yes
Female,Yes
Female,Yes
Female,Yes
Male,Yes
Male,Yes
Male,Yes
Male,No
Male,No
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,Yes
Male,No
Male,Yes
Male,Yes
Here is the code I use for creating a female chart:
library(plotrix)
library(prettyR)
female_familar <-read.table("C://females.csv", sep=",",
header=TRUE)
barp(rbind(rep(length(female_familar$gender),2),freq(female_familar$familar)[[1]]),
ylab="20 Females participated in the survey",
col=4:5,names.arg=c("Females        No(3)","Females      
Yes(17)"))
legend("topright",c("Females","Familarity"),fill=4:5)
Does the above need to change much to include males and females in the one
bar chart?
Hope to hear from someone soon.
Regards,
Jack.
-- 
View this message in context:
http://www.nabble.com/Bar-Charts-tp17124678p17124678.html
Sent from the R help mailing list archive at Nabble.com.
hoogeebear wrote:> Hi, > > I created some bar charts. My first one is concerned with males, and my > second concerned with females. > Is there a way I can put the charts into one chart? There is 2 different > columns in each file. Here is my new file containing males and females: > > gender,familar > Female,Yes > Female,Yes > Female,Yes > Female,Yes > Female,Yes > Female,No > Female,Yes > Female,Yes > Female,Yes > Female,Yes > Female,Yes > Female,Yes > Female,No > Female,Yes > Female,No > Female,Yes > Female,Yes > Female,Yes > Female,Yes > Female,Yes > Male,Yes > Male,Yes > Male,Yes > Male,No > Male,No > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,Yes > Male,No > Male,Yes > Male,Yes > > Here is the code I use for creating a female chart: > library(plotrix) > library(prettyR) > female_familar <-read.table("C://females.csv", sep=",", header=TRUE) > barp(rbind(rep(length(female_familar$gender),2),freq(female_familar$familar)[[1]]), > ylab="20 Females participated in the survey", > col=4:5,names.arg=c("Females No(3)","Females Yes(17)")) > legend("topright",c("Females","Familarity"),fill=4:5) > > Does the above need to change much to include males and females in the one > bar chart? >Hi Jack, If your data frame is named "hg": barp(table(hg),names.arg=levels(hg$familar), col=c(2,4),legend.lab=levels(hg$gender)) Jim