I'm sure this is stupidly simple but it's been some time since I've used R, and I have never made a barchart with ggplot.
I have the following averages from a larger dataset:
> mean_gc
PVC1 PVC2 PVC3 PVC4 PVC5 PVC6 PVC7 PVC8 PVC9 PVC10 PVC11
0.4019026 0.4479259 0.4494118 0.4729437 0.4800556 0.4492290 0.4905295 0.4457566 0.4271259 0.4850341 0.4369965
PVC12 PVC13 PVC14 PVC15 PVC16
0.4064052 0.3743776 0.3603853 0.3965469 0.3654610
My end goal is to plot a bar chart (since each "PVC#" is discrete), and fit a step-function across it in R to try and find subtle 'breakpoints' - but that's a problem for later...
The only way I've been able to achieve a barplot from this is using barplot
which creates the graph below.
Which is fine, but it's ugly compared to ggplot.
I've tried setting the above data as a dataframe both with the PVC labels in the dataframe, and as rownames - but I just can't get the syntax right and I'm at my wits end!
What am I missing?
EDIT FOR CLARITY ON DATAFRAMES
The above was just the printed output in R (not the best way to show it - my apologies). I have the data in the following (column based format):
mean_gc
PVC1 0.4019026
PVC2 0.4479259
PVC3 0.4494118
PVC4 0.4729437
PVC5 0.4800556
PVC6 0.4492290
PVC7 0.4905295
PVC8 0.4457566
PVC9 0.4271259
PVC10 0.4850341
PVC11 0.4369965
PVC12 0.4064052
PVC13 0.3743776
PVC14 0.3603853
PVC15 0.3965469
PVC16 0.3654610
Where PVC# are the row.names
. I also have the same dataset where the row.names
are present as the first column, in case that is required (but I suspect not).