Hi All, I'm pretty new to r and don't know a lot about statistics so please bear with me. I made some pie charts and a table for the same data but when I compare them I don't get the same results (the percentages are significantly different). The pie chart makes it look as though there is way more shatter than the table shows for each component. Any insight you can offer would be greatly appreciated!

Completeness | Upper (1) | Lower (2) |
---|---|---|

Shatter / Debris (1) | 32.11% (n=1377) | 27.48% (n=122) |

Medial – Distal Fragment (2) | 37.06% (n=1589) | 32.66% (n=145) |

Split (3) | 0.19% (n=8) | 0.23% (n=1) |

Proximal Fragment (4) | 6.16% (n=264) | 3.66% (n=16) |

Complete Flake (5) | 24.49% (n=1050) | 36.04% (n=160) |

Sums | 4288 | 444 |

I get the counts (n=) using the following code and then I divided each completeness state by the total number of specimens in the component (sums at bottom of table) and multiplied those numbers by 100 to get the percent.

```
library(MASS)
table1 = table(dat$deb_complet_match_BM, dat$Component)
table1
```

I used the following code to make the pie charts and the percentages for each slice doesn’t match what I get when I calculate the percent in the table.

```
all_deb_upper = subset(dat, dat$Component==1)
deb_upper = dat$deb_complet_match_BM
comp1 = (length(which(all_deb_upper==1)))
comp2 = (length(which(all_deb_upper==2)))
comp3 = (length(which(all_deb_upper==3)))
comp4 = (length(which(all_deb_upper==4)))
comp5 = (length(which(all_deb_upper==5)))
slice = c(comp1, comp2, comp3, comp4, comp5)
lbls = c("Shatter", "Medial-Distal Fragment", "Split", "Proxmial Fragment", "Complete")
pct <- round(slice/sum(slice)*100,2)
lbls <- paste(lbls, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
pie(slice, labels = lbls, main="LbDt-1 Debitage Completeness for Upper Componenent", col=rainbow(length(lbl)))
par(mfrow=c(2,1))# no of rows, second number = number of columns
all_deb_lower = subset(dat, dat$Component==2)
deb_lower = dat$deb_complet_match_BM
comp1 = (length(which(all_deb_lower==1)))
comp2 = (length(which(all_deb_lower==2)))
comp3 = (length(which(all_deb_lower==3)))
comp4 = (length(which(all_deb_lower==4)))
comp5 = (length(which(all_deb_lower==5)))
slice = c(comp1, comp2, comp3, comp4, comp5)
lbls = c("Shatter", "Medial-Distal Fragment", "Split", "Proxmial Fragment", "Complete")
pct <- round(slice/sum(slice)*100,2)
lbls <- paste(lbls, pct) # add percents to labels
lbls <- paste(lbls,"%",sep="") # ad % to labels
pie(slice, labels = lbls, main="LbDt-1 Debitage Completeness for Lower Componenent", col=rainbow(length(lbl)))
```