Skip to content

barplot

3 messages · Thiho Jules, arun, Jim Lemon

#
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 <thjnant at gmail.com>
To: r-help at 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 at 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.
#
On 10/24/2012 03:21 AM, Thiho Jules wrote:
Hi Thiho,
You can do this with the "barp" function in the plotrix package. See the 
"x" argument for placing the bars at arbitrary positions.

Jim