[R] How to remove levels?
S Ellison
S.Ellison at lgc.co.uk
Thu Mar 18 10:58:59 CET 2010
new_ns$chr <- factor(new_ns$chr, levels=paste(1:22))
>>> Soyeon Kim <yunni0731 at gmail.com> 18/03/2010 00:57 >>>
Dear All,
My data looks like this
> new_ns
chr nc_two nc_not_two
1 1 488 58
2 2 325 114
3 3 233 79
4 4 200 153
5 5 239 53
6 6 196 313
7 7 229 45
8 8 231 137
9 9 164 111
10 10 156 45
11 11 181 92
12 12 179 52
13 13 72 30
14 14 73 62
15 15 185 25
16 16 93 42
17 17 84 50
18 18 33 17
19 19 31 40
20 20 49 8
21 21 12 16
22 22 26 37
> new_ns$chr
[1] 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
Levels: 1 10 11 12 13 14 15 16 17 18 19 2 20 21 22 3 4 5 6 7 8 9
but when I run this : plot(new_ns$chr,new_ns$nc_two)
the order of new_ns$chr is 1 10 11 12 13 14 15 16 17 18 19 2 20 21 22
3 4 5 6 7 8 9
how can fix this order to 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
16 17 18 19 20 21 22 in the plot ?
I attached the plot.
Thank you ahead.
*******************************************************************
This email and any attachments are confidential. Any use...{{dropped:8}}
More information about the R-help
mailing list