Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Edit:</strong> Response to OP's comment. </p> <p>This directly creates a line chart of OP's data. Below this is the original answer using <code>ggplot</code>, which produces a far superior output.</p> <p>Given the frequency table you provided,</p> <pre><code>df &lt;- data.frame(t(freqTable)) # transpose (more suitable for plotting) df &lt;- cbind(Response=rownames(df),df) # add row names as first column plot(as.numeric(df$Response),df$f,type="b",col="red", xaxt="n", ylab="Count",xlab="Response") lines(as.numeric(df$Response),df$m,type="b",col="blue") axis(1,at=c(1,2,3,4,5,6),labels=c("Str.Agr.","Sl.Agr","Neither","Sl.Disagr","Str.Disagr","NA")) </code></pre> <p>Produces this, which seems like what you were looking for. <img src="https://i.stack.imgur.com/rbZ5h.png" alt=""></p> <p><strong>Original Answer:</strong></p> <p>Not quite what you asked for, but converting your frequency table to a data frame, <code>df</code></p> <pre><code>df &lt;- data.frame(freqTable) df &lt;- cbind(Gender=rownames(df),df) # append rownames (Gender) df &lt;- df[-3,] # drop unknown gender df # Gender X1 X2 X3 X4 X5 X8 # m m 5 16 3 16 5 0 # f f 12 25 3 10 3 1 df &lt;- df[-3,] # remove unknown gender column library(ggplot2) library(reshape2) gg=melt(df) labels &lt;- c("Agree\nFully","Somewhat\nAgree","Neither Agree\nnor Disagree","Somewhat\nDisagree","Disagree\nFully", "No Answer") ggp &lt;- ggplot(gg,aes(x=variable,y=value)) ggp &lt;- ggp + geom_bar(aes(fill=Gender), position="dodge", stat="identity") ggp &lt;- ggp + scale_x_discrete(labels=labels) ggp &lt;- ggp + theme(axis.text.x = element_text(angle=90, vjust=0.5)) ggp &lt;- ggp + labs(x="", y="Frequency") ggp </code></pre> <p>Produces this: <img src="https://i.stack.imgur.com/70kNs.png" alt=""></p> <p>Or, this, which is much better:</p> <pre><code>ggp + facet_grid(Gender~.) </code></pre> <p><img src="https://i.stack.imgur.com/mrKuf.png" alt=""></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload