[R] FW: R graphics
Mcdonald, Grant
grant.mcdonald08 at imperial.ac.uk
Thu Aug 13 16:08:03 CEST 2009
________________________________________
From: Mcdonald, Grant
Sent: 13 August 2009 13:08
To: r-help at R-project.org
Subject: R graphics
Dear sir,
I am trying to create a barplot showing propotions,
So my data is in the format of a vector containing 0s and 1s (i.e.successful or not) with a corresponding vector with two catogorical levels.
success age
1 old
0 young
0 young
1 old
I want to show a bar plot with a ylim=c(0,1) and an x-axis showing the two ages and the proportion of success only as filled bars.
after making success a factor and plotting against age using: plot(success~age)
the graphic shows age on the x and proportion on the yaxis as i want. However for each age it shows the total proportion split into both success and failures. I would however just like to show the prop successes without the failures stajed on top.
data frame is below:
successful maleage
1 O
1 Y
1 Y
1 Y
1 O
1 O
1 Y
1 O
1 Y
1 O
1 O
1 Y
1 O
1 Y
1 Y
1 Y
1 O
1 O
1 Y
1 Y
1 O
1 Y
1 O
1 Y
1 Y
1 Y
1 O
1 Y
1 Y
1 O
1 Y
1 O
1 O
1 Y
1 O
1 Y
1 O
1 Y
1 Y
1 O
1 Y
1 Y
1 O
1 Y
1 Y
1 Y
1 O
1 O
1 Y
1 O
1 Y
1 Y
1 Y
1 Y
1 Y
1 Y
1 Y
1 Y
1 Y
1 O
1 Y
1 O
1 Y
1 Y
1 O
1 O
1 Y
1 Y
1 O
1 Y
1 O
1 Y
1 Y
1 Y
1 O
1 Y
1 O
1 Y
1 Y
1 Y
1 O
1 Y
1 O
1 Y
1 Y
1 O
1 Y
1 Y
1 O
1 O
1 Y
1 Y
1 Y
1 O
0 Y
NA O
0 O
NA Y
1 Y
1 O
NA O
NA Y
0 O
NA Y
0 O
NA Y
1 Y
1 O
0 O
0 Y
NA O
0 Y
NA O
0 Y
0 Y
NA O
NA O
NA O
NA Y
NA Y
0 O
NA O
NA Y
NA O
1 O
0 O
0 Y
NA O
NA Y
1 O
0 O
0 O
0 O
NA Y
0 O
0 Y
NA Y
0 O
NA O
0 Y
NA O
1 O
0 Y
NA O
NA O
NA O
0 O
0 O
0 O
0 Y
0 O
0 O
0 O
0 Y
NA O
0 Y
0 O
NA Y
NA O
0 O
NA Y
NA O
0 O
NA O
NA O
0 O
NA Y
NA O
NA Y
0 O
NA O
1 Y
NA Y
NA O
1 O
1 Y
0 O
0 Y
0 O
0 Y
0 Y
1 Y
More information about the R-help
mailing list