title: How do I create barplots with categories instead of numbers?
body: <p>I'm just getting started in R and I'm trying to wrap my head around barplot for a university assignment. Specifically, I am using the General Social Survey 2018 dataset (for codebook: <a href="https://www.thearda.com/Archive/Files/Codebooks/GSS2018_CB.asp" rel="nofollow noreferrer">https://www.thearda.com/Archive/Files/Codebooks/GSS2018_CB.asp</a>) and I am trying to figure out if religion has any effect on the way people seek out help for mental health. I want to use <code>reliten</code> (self-assessment of religiousness - from strong to no religion) as the IV and <code>tlkclrgy</code>, (asks if a person with mental health issues should reach out to a religious leader - yes or no) as the DV. For a better visualization of the data, I want to create a side-by-side barplot with <code>reliten</code> on the x-axis and see how many people answered yes and no on <code>tlkclrgy</code>. My problem is that on the barplot I get numbers instead of categories (from strong to no religion). This is what I tried, but I keep getting NA on the x-axis:</p>
  <pre><code>GSS$reliten &lt;- factor(as.character(GSS$reliten), 
                        levels = c(&quot;No religion&quot;, &quot;Somewhat 
                                   strong&quot;, &quot;Not very strong&quot;, 
                                   &quot;Strong&quot;))
  GSS &lt;- GSS18[!GSS18$tlkclrgy %in% c(0, 8, 9),] 
  GSS$reliten &lt;- as_factor(GSS$reliten)
  GSS$tlkclrgy &lt;- as_factor(GSS$tlkclrgy)
  ggplot(data=GSS,mapping=aes(x=reliten,fill=tlkclrgy))+
    geom_bar(position=&quot;dodge&quot;)
  </code></pre>
  <p>Does anybody have any tips?</p>