4
How to plot a bar graph on the R in which the eixo x
I have a categorical variable (with 4 categories: frequent, sometimes rare, never) and in eixo y
the average of a numeric variable (Y=0:13)? How do I insert the label above the bars?
Below is an example of the cross table of the categorical variable with the numerical variable. In the columns "frequent", "sometimes", "rare" and "never" are the number of individuals who answered one of these four options and the Y score (0:13).
Y Frequente As vezes Raro Nunca
0 86 70 111 69
1 227 181 246 149
2 341 254 417 197
3 418 298 501 275
4 396 316 541 257
5 458 310 564 307
6 387 273 562 246
7 352 212 518 228
8 247 167 401 207
9 173 118 278 131
10 88 54 140 61
11 35 19 74 27
12 9 7 31 8
13 2 0 3 0
The information you should have in the bar graph is: what is the mean of Y for the individuals who answered: frequent, rare, sometimes and never.
I appreciate the help!
I could not run - Error: Invalid column Specification - Could you detail what you assigned to "intensity" and "Qtd", please?
– Naomi
intensity and quantity are just names for the columns that are created... post the result of dput(data) so that we can look exactly as your base is. My kick that there is no column called Y...
– Daniel Falbel
I got it!! Thanks!
– Naomi