[R] Barplot with "multiple categories"
Noel Magnin
noel.magnin at free.fr
Tue Jul 10 13:22:22 CEST 2007
Dear all
Thanks in advance for replies
I am trying to make a barplot out of this data which I read from a file
tb <- read.table("tmp.dat"
, na.string=c("-"))
tmp.dat: ############
(the file is much longer and includes NAs as "-")
# A1 A2 A3 B1 B2 B3 C1 C2 C3 D1 D2 D3
2 P 12 2 P 11 2 F 1 2 P 7
2 S 6 2 S 6 2 P 11 2 x 6
2 x 34 2 x 21 2 S 2 3 I 7
3 I 25 3 I 21 2 T 1 3 S 2
3 N 2 3 S 1 2 x 15 3 x 4
3 x 25 3 x 16 3 I 15 4 S 8
4 C 1 4 S 26 3 x 15 4 Y 1
4 S 32 4 x 12 4 S 15 4 x 4
4 x 19 5 P 26 4 x 15 5 P 8
5 L 1 5 R 2 5 P 15 5 S 1
5 P 31 5 x 10 5 x 15 5 x 4
5 R 1 6 I 27 6 I 13 6 I 9
5 x 19 6 N 1 6 M 1 6 x 4
6 I 32 6 x 10 6 N 1 7 E 9
6 N 1 7 E 29 6 x 15 7 x 4
6 x 19 7 x 9 7 D 1 8 T 9
7 D 1 8 R 1 7 E 14 8 x 4
7 E 32 8 T 29 7 x 15 9 V 10
7 x 19 8 x 8 8 T 15 9 x 3
8 T 34 9 V 30 8 x 15 10 P 11
8 x 18 9 x 8 9 V 17 10 x 2
9 I 1 10 H 1 9 x 13 11 V 11
9 V 35 10 P 29 10 A 2 11 x 2
9 x 16 10 x 8 10 P 15 12 K 13
10 P 36 11 V 30 10 S 1 13 L 13
10 x 16 11 x 8 10 x 12 14 K 13
11 V 36 12 K 30 11 V 20 15 P 12
11 x 16 12 R 1 11 x 10 15 [PA] 1
12 K 41 12 x 7 12 K 23 16 G 13
12 x 11 13 L 33 12 R 1 17 M 13
13 I 2 13 x 5 12 x 6 18 D 13
13 L 42 14 K 32 13 L 27 19 G 13
13 x 8 14 N 1 13 x 3 20 P 13
14 K 46 14 x 5 14 K 27 21 K 12
######### end Data
Data explanation :
"position" : A1, B1, C1, D1 for different samples [these are
amino-acids positions in biological sequences]
"value found" : A2, B2, ...
"number of occurences" : C1, C2 ....
the barplot type I would like to obtain :
|
|
y||
|| |
|| |
|||| ... ie : number of occurences (A3, B3, ...)
|_______________________________________
PSx PSx FPSTx Px | INx ISx Ix ISx ... ie : values in A2, B2 ....(not
always the same "length")
2 | 3 ... ie : position in A1, B1, ...
I have tried to read as matrix, simple vectors, but I cannot manage to
reach this type of barplot.
Any hint towards this goal would be much appreciated
All the best
Noel
More information about the R-help
mailing list