I am using this code to get my basic barplot
tbl=read.table("mydata.txt")
barplot(t(as.matrix(tbl)), col=rainbow(3),
xlab="Individual #", ylab="Ancestry", border=NA)
mydata.txt consist of 3 columns of numerical values (with no header). Now i want to add another column to mydata.txt, that indicate groups (e,g., group1, group2, group3) and I want the graph shows these grouping by color. what should I do?