I am using R to analyze a data set that includes questions about income and one of the possible answers was "choose not to answer".
I was able to subset the data so that I could omit the "choose not to answer" by setting it equal to NA.
How can I remove the NAs so that it does not show up in my plots? Below is a copy of my data...
Below is a copy of my code. I have omitted "NAs", which I would like to remove "N/A", "Don't know" and "Refused". When I look at my new table (xA) I see them removed. When I look at the plot I get from the code below, the labels are still there but just with a value of 0. Note I had to use different variables for the purpose of this example.
`# set up data so no NAs`
`xA <- na.omit(x)`
`xtab17 <- table(xA$email,xA$education)`
`xtab18 <- as.data.frame.table(xtab17); xtab18`
`barplot(xtab17,`
`ylim = c(0,600),`
`legend = rownames(xtab17),`
`main = "Still shows NAs"`
`)`