I have a dataframe that has multiple variables, and I would like to know how can I plot them like the plotting option in Excel
.
Just a simple data example:
> V1 V2 V3
1 A 0
1 A 0
1 B 1
1 B 0
1 A 1
2 A 0
2 B 0
2 A 0
2 A 0
2 A 0
What I'd like to have, is an x
axis with V1
, a y
axis with all the count of V3
when V2
is A
or B
.
Can somebody please share some thoughts on how to do this? The barplot
function doesn't seem capable because it can only work with 2*2
table?
Thank you.
Edit:
This plot is not generated by the data given though:
Consider the y
axis as the percentage of V3
, the x
axis of V1
and for each level of V2
a bar chart is created.