01 August 2019 3 4K Report

Hi, I have 13 survey items with the response options YES and NO. For example, the respondent may indicates YES or NO when asked if they have a reliable method of transportation.

I would like to include the percentage of respondents who indicated YES across the 13 items using GGPLOT2's bar chart option. My code is pasted below. As of now, I am able to plot a single bar chart that delineates the number of respondents who responded YES across the 13 items (each of the items are represented in the x-axis; count of YES's is reported via the y-axis).

However, I would like the y-axis to reflect percentages if possible. Here is my R syntax (I also attached a text file showing the R syntax...formatting seems off when copying and pasting to this message box):

dat2 %>%

gather(factors, count, -dat.Record.ID) %>%

filter(count==1) %>%

ggplot(aes(factors)) + theme_minimal() + theme(axis.text.x = element_text(angle = 90, hjust=1)) +

scale_x_discrete(breaks=c("dat.LivingC.r","dat.Utility.r","dat.Pollut.r","dat.Lowinc.r",

"dat.Job.r","dat.Costnutfood.r","dat.Availnutfood.r","dat.Healthins.r",

"dat.Domvio.r","dat.Crime.r","dat.Transport.r","dat.Homeless.r","dat.Immigr.r"),

labels=c("Living Conditions", "Inability to Pay Utilities", "Poor Environmental Conditions",

"Low Household Income", "Guardian(s) Job Status", "Cost of Nutritional Food",

"Availability of Nutritional Food","Lack of Access to Health Insurance", "Domestic Violence",

"Crime Rate in Community", "Limited Access to Reliable Transportation", "Homelessness",

"Immigration Status"))+

geom_bar(fill="Black")

Similar questions and discussions