Hi, I'm trying to create a bar chart for level of education. Originally, I produced a bar chart using:
> barplot(table(d1$EDUC2), main = "Level of Education", xlab = "Educational Attainment", ylab = "Frequency")
which produced a fine chart, except not all of my labels were included on the x-axis (the labels are "Above a bachelor's degree", "Bachelor's degree", "High school diploma or less", "Postsecondary certificate or diploma", and "Some postsecondary" but the only labels that were on my bar chart were "Above a bachelor's degree" and "Some postsecondary").
So I looked at some resources for help on getting all the labels included. The following modifications were recommended, so I ended up with:
> barplot(table(d1$EDUC2, las = 2, cex.names=0.5), main = "Level of Education", xlab = "Educational Attainment", ylab = "Frequency", names.arg = c("Above a Bachelor's Degree", "Bachelor's Degree", "High School Diploma or Less", "Postsecondary Certificate or Diploma", "Some Postsecondary"))
which resulted in the following error:
Error in table(d1$EDUC2, las = 2, cex.names = 0.5) : all arguments must have the same length.
I also get the error using just las = 2, just cex.names = 0.5, names.arg = c(), and every combination of the functions.
Does anyone know what is going wrong? I just want to see all my labels on the x-axis for my graph