I am a newbie with R (we are using it at university for marketing research).
So, here's the thing:
I want to create a stacked barplot using ggplot2 that show 3 rectangles, with three different colours, for every var on the x line! On the Y line instead I would like to put percentages, but it's ok even with the frequencies.
I've been googling three day before posting, I swear. I'm not a programmer, so sometimes even If i may have found what I needed I think I haven't recognized it :/
This are my tries:
require(ggplot2)
head(dati)
ggplot(dati, aes(B4_1,B4_2,B4_3)) + geom_bar(position="dodge", stat="identity")
(but of course the results isn't right, because it puts the B4_1
var on the X
and the B4_2
var on the Y
)
so I tried:
ggplot(dati, aes(B4_1)) + geom_bar(position="dodge",binwidth=x)
because i tought it would at least give me the roots! But it says that x wasn't found.
I tried messing around with this code but it keeps giving me different errors, like that x wasn't found, that bin was wrong. I honestly tried and I can post my chronology on the internet of the last two days if anyone thinks I'm just asking you to do my work for me!
Thank you for the support, any help will be VERY appreciated! happy new year!