Hi,
May be this example helps you. dat1<-data.frame(position= 1:5,pop1=c(3,5,15,25,28),pop2=c(5,8,12,22,35),pop3=c(2,10,17,20,31)) dat2<-melt(dat1,id.vars="position") library(lattice) barchart(value~factor(position),data=dat2) A.K. ----- Original Message ----- From: Thiho Jules <thjn...@gmail.com> To: r-help@r-project.org Cc: Sent: Tuesday, October 23, 2012 12:21 PM Subject: [R] barplot Hi, I want to make a barplot with the following datasets: I have a file as following: name chr position A1 A2 pop1 pop1 pop2 pop2 I have calculated a measure using all the values in columns "pops", the values are saved in a vector. Now I want to make a barplot using the values in this vector as the y axis and the values in the column "position" in the x-axis. thank you for your help. [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.