I'm trying to teach myself R by analysing a dataset that I have. It is called audit_data
and looks something like this (there are actually many more rows and columns);
id date time_1 time_2 time_3 description comment
1 10-Oct-2017 120 135 75 xxxxxxx xxxxxx
2 05-Jun-2017 140 120 90 xxxxxxx xxxxxx
3 31-Aug-2017 133 215 104 xxxxxxx xxxxxx
4 22-Sep-2017 95 110 127 xxxxxxx xxxxxx
I want to create a grouped histogram with ggplot2 showing just the data from columns time_1 and time_3 paired together side-by-side.
I think that in order to do this I need to create a new data set (say audit_data_new
) that looks something like this, but I am struggling to get even this far.
time value
time_1 120
time_1 140
time_1 133
time_1 95
time_3 75
time_3 90
time_3 104
time_3 127
After doing this I plan to use a command like
ggplot(audit_data_new, aes(value, fill=time)) + geom_histogram(position='dodge')
Any advice on how to massage my data into the correct format first?