Visualizing Categorical Data Mosaic Plots. For extended mosaic plots, use mosaic (x, condvar=. Association Plots. To produce an extended association plot use assoc (x, rowvars. Going Further. Both functions are complex and offer multiple input and output options.
I am new to R and have been trying for a few days to plot histogram / bar chart to view the trend. I have this categorical variable : countryx and coded it into 1,2,3. I have tried these 2 scripts below and got error messages as follows :
Appreciate for all advice. Thank you very much for your help!
user149635user149635
2 Answers
![Categorical Categorical](/uploads/1/2/4/7/124718615/884210237.png)
Multiple problems with your code.
ggplot
takes a dataframe, not a vector, but you're supplying a vector. Try this![Data Data](/uploads/1/2/4/7/124718615/645728013.jpg)
3,25011 gold badge1111 silver badges1818 bronze badges
As @yeedle mentioned you need a data.frame (maybe use
ed_sansed_sansas.data.frame
)How about:2,60422 gold badges99 silver badges2121 bronze badges