I am trying to make some barplots with my data but I keep hitting some walls. If someone on here could help that’d be great
I wanted to create barplots with side by side comparison of pre vs post responses, i need the x axis to be the response type (agree/disagree, etc.) and the y to be percentage of responses
This feels super basic but its a toughie. Any help with R code to use would be amazing. I’m also providing the dataframe I used. Thanks!
Sample
ID
envir_conscious
PRE_understand
PRE_serious_prob
PRE_confident
PRE_willing
PRE_attain
res_time
“nature_feeling
seen_turtle
active_envir
Too_Expensive
Not_aesthetic
Safety_concern
POST_understand
POST_serious_prob
POST_confident
POST_willing
POST_attain
1
1
Resident
Strongly_agree
Agree
Strongly_agree
Agree
Strongly_agree
Neutral
less_than_5_yrs
Yes
Yes
Yes_less_than_3
Unsure
Strongly_disagree
Strongly_disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Agree
2
2
Resident
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
less_than_5_yrs
Yes
No
First
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
3
3
City_personal
Agree
Agree
Agree
Agree
Agree
Agree
less_than_5_yrs
Yes
Yes
First
Agree
Agree
Agree
Agree
Agree
Agree
Agree
Agree
4
4
Manager_staff
Agree
Agree
Agree
Agree
Neutral
Agree
10_yrs
Yes
Yes
Yes_less_than_3
Neutral
Disagree
Disagree
Agree
Agree
Agree
Agree
Agree
5
5
Resident
Agree
Agree
Agree
Agree
Agree
Agree
less_than_5_yrs
Yes
Yes
Yes_over_1
Neutral
Neutral
Disagree
Agree
Agree
Agree
Neutral
Neutral
6
6
Manager_staff
Strongly_agree
Agree
Agree
Agree
Agree
Agree
5_to_10_yrs
Yes
Yes
Yes_over_1
Unsure
Unsure
Unsure
Agree
Agree
Agree
Agree
Unsure
7
7
Manager_staff
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
less_than_5_yrs
Yes
Yes
Yes_less_than_3
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_agree
Strongly_agree
Strongly_agree
Agree
Strongly_agree
8
8
Manager_staff
Strongly_disagree
Strongly_disagree
Strongly_disagree
Disagree
Strongly_disagree
Disagree
10_yrs
Yes
No
First
Disagree
Disagree
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_disagree
9
9
Resident
Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
10_yrs
Yes_IDK
No
Unsure
Disagree
Strongly_disagree
Strongly_disagree
Strongly_agree
Unsure
Strongly_agree
Strongly_agree
Strongly_agree
10
10
Manager_staff
Agree
Agree
Neutral
Agree
Agree
Agree
less_than_5_yrs
Yes
Yes
First
Disagree
Disagree
Disagree
Agree
Agree
Agree
Agree
Agree
11
11
Manager_staff
Agree
Neutral
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
less_than_5_yrs
Yes
Yes
Yes_over_1
Disagree
Strongly_disagree
Strongly_disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
12
12
Manager_staff
Agree
Agree
Agree
Agree
Agree
Agree
less_than_5_yrs
Yes_IDK
Yes
First
Disagree
Disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
13
13
Manager_staff
Agree
Disagree
Neutral
Neutral
Agree
Neutral
less_than_5_yrs
Yes
Yes
Unsure
Neutral
Strongly_disagree
Disagree
Unsure
Unsure
Unsure
Unsure
Agree
14
14
Manager_staff
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_disagree
10_yrs
Yes
No
First
Disagree
Disagree
Disagree
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_disagree
15
15
Manager_staff
Strongly_agree
Agree
Agree
Agree
Agree
Strongly_agree
less_than_5_yrs
No
Yes
First
Disagree
Strongly_disagree
Neutral
Neutral
Neutral
Neutral
Disagree
Unsure
16
16
Manager_staff
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Agree
less_than_5_yrs
Yes
No
Yes_more_than_3
Disagree
Disagree
Agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
17
17
Manager_staff
Strongly_agree
Agree
Unsure
Agree
Strongly_agree
Strongly_agree
less_than_5_yrs
No
Yes
Yes_over_1
Disagree
Disagree
Disagree
Disagree
Disagree
Disagree
Disagree
Disagree
18
18
City_personal
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
less_than_5_yrs
Yes
Yes
Yes_over_1
Unsure
Neutral
Agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
19
19
Resident
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
5_to_10_yrs
Yes
Yes
Yes_more_than_3
Agree
Disagree
Disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
20
20
Manager_staff
Agree
Neutral
Agree
Disagree
Agree
Agree
less_than_5_yrs
Yes
Yes
Unsure
Neutral
Neutral
Neutral
Neutral
Neutral
Disagree
Agree
Agree
21
21
Resident
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
10_yrs
Yes
Yes
Yes_more_than_3
Disagree
Disagree
Disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
22
22
Manager_staff
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
5_to_10_yrs
Yes
Yes
First
Strongly_disagree
Strongly_disagree
Disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
23
23
Resident
Agree
Agree
Agree
Agree
Agree
Agree
10_yrs
Yes
Yes
Yes_more_than_3
Disagree
Disagree
Strongly_disagree
Agree
Agree
Agree
Agree
Agree
24
24
Resident
Strongly_disagree
Neutral
Neutral
Neutral
Strongly_disagree
Neutral
10_yrs
Yes
Yes
First
Strongly_disagree
Strongly_disagree
Strongly_disagree
Neutral
Neutral
Neutral
Strongly_disagree
Neutral
25
25
City_personal
Agree
Neutral
Strongly_agree
Neutral
Agree
Strongly_agree
less_than_5_yrs
Yes
Yes
Yes_less_than_3
Strongly_disagree
Strongly_disagree
Disagree
Agree
Strongly_agree
Agree
Agree
Strongly_agree
26
26
Manager_staff
Agree
Neutral
Neutral
Unsure
Unsure
Agree
10_yrs
Yes
No
Yes_less_than_3
Neutral
Unsure
Agree
Neutral
Neutral
Neutral
Neutral
Unsure
27
27
Resident
Strongly_agree
Agree
Agree
Agree
Agree
Agree
10_yrs
Yes
Yes
Yes_over_1
Disagree
Strongly_disagree
Strongly_disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
28
28
Resident
Strongly_disagree
Neutral
Neutral
Neutral
Strongly_disagree
Neutral
10_yrs
Yes
Yes
First
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
29
29
Resident
Agree
Neutral
Neutral
Neutral
Agree
Unsure
10_yrs
No
Yes
Yes_over_1
Strongly_disagree
Strongly_disagree
Neutral
Strongly_agree
Strongly_agree
Agree
Agree
Strongly_agree
30
30
Manager_staff
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
less_than_5_yrs
Yes
Yes
Yes_over_1
Disagree
Disagree
Disagree
Strongly_agree
Strongly_agree
Agree
Strongly_agree
Strongly_agree
31
31
City_personal
Strongly_agree
Agree
Strongly_agree
Strongly_agree
Strongly_agree
Agree
10_yrs
Yes_IDK
No
Yes_over_1
Neutral
Unsure
Strongly_agree
Neutral
Neutral
Strongly_agree
Strongly_agree
Strongly_agree
32
32
City_personal
Agree
Agree
Strongly_agree
Neutral
Strongly_agree
Strongly_agree
less_than_5_yrs
Yes
Yes
Yes_over_1
Neutral
Strongly_disagree
Strongly_disagree
Strongly_agree
Strongly_agree
Agree
Agree
Strongly_agree
33
33
City_personal
Agree
Agree
Strongly_agree
Neutral
Agree
Agree
less_than_5_yrs
Yes
No
Yes_over_1
Neutral
Disagree
Neutral
Neutral
Agree
Agree
Agree
Strongly_agree
34
34
City_personal
Agree
Agree
Agree
Neutral
Agree
Agree
less_than_5_yrs
Yes
Yes
First
Disagree
Disagree
Agree
Agree
Strongly_agree
Neutral
Agree
Unsure
35
35
City_personal
Neutral
Neutral
Agree
Agree
Agree
Agree
less_than_5_yrs
No
Yes
First
Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
36
36
City_personal
Strongly_agree
Agree
Agree
Agree
Agree
Strongly_agree
5_to_10_yrs
Yes
No
Yes_over_1
Neutral
Unsure
Strongly_agree
Strongly_agree
Agree
Agree
Agree
Agree
37
37
City_personal
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Agree
less_than_5_yrs
No
Yes
First
Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
38
38
City_personal
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Disagree
less_than_5_yrs
Yes
No
Yes_over_1
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
39
39
City_personal
Agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Unsure
5_to_10_yrs
Yes
Yes
Yes_over_1
Disagree
Disagree
Agree
Agree
Strongly_agree
Strongly_agree
Strongly_agree
Neutral
40
40
City_personal
Agree
Strongly_agree
Strongly_agree
Strongly_agree
Agree
Strongly_agree
less_than_5_yrs
Yes
No
Yes_over_1
Strongly_disagree
Disagree
Strongly_disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
41
41
City_personal
Agree
Agree
Strongly_agree
Agree
Agree
Agree
less_than_5_yrs
Yes
Yes
First
Strongly_disagree
Strongly_disagree
Strongly_disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Agree
42
42
City_personal
Strongly_agree
Agree
Agree
Agree
Agree
Agree
10_yrs
Yes_IDK
Yes
Yes_over_1
Neutral
Neutral
Strongly_disagree
Strongly_agree
Strongly_agree
Strongly_agree
Strongly_agree
Agree
43
43
City_personal
Agree
Neutral
Neutral
Neutral
Agree
Agree
less_than_5_yrs
Yes
Yes
Yes_more_than_3
Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
Neutral
44
44
Resident
Strongly_agree
Agree
Agree
Neutral
Strongly_agree
Strongly_agree
I tried barplot, ggplot, but nothing. I’ve made them into as.factors but still cant get a figure with error bars.
Sophie Brown is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.