I'm having trouble creating a complex barricade with aggregate data. When I use pivot tables from other people's reports, I usually use Excel, but I would like to start making all my charts in R, possibly with a grid or ggplot. In Excel, which executes a complex barcode of the following aggregated data, it takes a few clicks (Insert, Column Charts, Stacked Column), and you will get something like this.
.
Also, wanting this diagram in R, I also want to use the ggplot face, i.e. put the two folded velvet side by side in ggplot to compare the two groups (A and B). I played with other charts and this seems like the best choice. This is data. In an Excel chart, only Group A is displayed (numbers are percentages).
D<-as.data.frame(structure(list(Group = c("A", "A", "A", "A", "A", "A", "B", "B", "B", "B", "B", "B" ), Education = c("NVQ Level 4 and above", "NVQ Level3", "NVQ Level 2", "Below NVQ Level 2", "Other qualification", "No qualification", "NVQ Level 4 and above", "NVQ Level3", "NVQ Level 2", "Below NVQ Level 2", "Other qualification", "No qualification"), Full.Time = c(47, 27, 23, 17, 18, 9, 36, 26, 22, 22, 27, 12), PT.16.hours = c(20, 24, 22, 18, 18, 12, 22, 21, 21, 22, 14, 10), PT.16.hours.1 = c(12, 11, 10, 11, 13, 5, 24, 25, 25, 20, 16, 12)), .Names = c("Group", "Education", "Full.Time", "PT>16.hours", "PT<16.hours")))
Before proceeding to the cut to show the difference in the two groups, in fact, I have problems creating a separate histogram (for example, above) with ggplot2. I assume that I should not have 3 variables (FullTime, PT, PT> 16 hours), and single rows for each row, so instead
A NVQ Level 4 and above 47 20 12 A NVQ Level3 27 24 11
I had to
Group Education Work Percentage A NVQ Level 4 and above Full Time 47 A NVQ Level 4 and above PT>16 hours 20
If this is the only way to get ggplot to make a chart, how would you switch from one format to another with a few lines of code? I often find this data type, so it would be nice to have a standardized procedure. I also played with the ggplot "identity" option, but did not have much success.
Any help would be greatly appreciated.
thanks