See the FAQ: How to do a minimal reproducible example reprex
for beginners. Having a reprex
in a single chunk avoids potential tl;dr.
barplot(tmain)
won't work either.
See the examples in help("barplot")
tmain <- table(c(rep("A", 10), rep("B", 6), "C", "C", "D"))
ttrunc <- tmain[1:2]
ttrunc["Other"] <- sum(tmain[3:4])
barplot(t(ttrunc[1:30]))