I have the following dataset:
Marker Method NAtype Ratio
1 CSF1PO GEL -9 3.623417e-01
2 CSF1PO GEL -1 4.713273e-02
3 CSF1PO GEL NA 0.000000e+00
4 CSF1PO MegaBACE -9 1.417205e-02
5 CSF1PO MegaBACE -1 8.312974e-03
6 CSF1PO MegaBACE NA 5.405026e-06
7 CSF1PO ABI -9 4.714592e-02
8 CSF1PO ABI -1 1.989925e-03
9 CSF1PO ABI NA 4.174494e-05
10 D10S1248 GEL -9 9.999201e-01
11 D10S1248 GEL -1 7.098303e-05
12 D10S1248 GEL NA 0.000000e+00
13 D10S1248 MegaBACE -9 6.562637e-01
14 D10S1248 MegaBACE -1 2.518769e-03
15 D10S1248 MegaBACE NA 1.081005e-05
16 D10S1248 ABI -9 7.138484e-03
17 D10S1248 ABI -1 1.029723e-03
18 D10S1248 ABI NA 1.391498e-05
I want to make a stacked bar graph with these data. I'm not fluent in ggplot2 and I don't know how to create 3 bars for each category.
For example, the 1st column has my categories, these are the names that go in the x axis of my graph. For each category ("CSF1PO" and "D10S1248"), I want 3 bars ("GEL", "MegaBACE", "ABI" in the 2nd column). Each bar should be divided in 3 subsets ("-9", "-1", "NA" in the 3rd column). And the 4th column (Ratio) has my values.
I want something like
ggplot(data, aes(x=Marker, y=Ratio, fill=NAtype)) + geom_bar(stat="identity") + facet_grid(~Method)
but with the bars for each category side-by-side, not in separated grids. Can anyone help please? Thanks!