Skip to content
Prev 314778 / 398506 Next

renumber a list of numbers

Hi,

It isn't entirely clear what you want, because it seems too simple.
And most of your sample data are irrelevant, aren't they?

Why not just use:

testdata$Event_name2 <- testdata$Event_name - 7

Or you could try:

testdata$Event_name3 <- as.numeric(as.factor(testdata$Event_name))

which will make the values into consecutive integers.
   Event_name Event_name2 Event_name3
9           8           1           1
10          9           2           2
11         10           3           3
12         11           4           4
13         12           5           5
14         13           6           6
15         14           7           7
16         15           8           8
17         16           9           9
18         17          10          10
19         18          11          11
20         19          12          12
21         20          13          13
22         21          14          14
23         22          15          15
24         23          16          16
25         24          17          17
26         25          18          18
27         26          19          19
28         27          20          20
29         28          21          21
30         29          22          22
31         30          23          23
32         31          24          24
33         33          26          25
34         34          27          26
41          8           1           1
42          9           2           2
43         10           3           3
44         11           4           4
45         12           5           5
46         13           6           6
47         14           7           7
48         15           8           8
49         16           9           9
50         17          10          10
51         18          11          11
52         19          12          12
53         20          13          13
54         21          14          14
55         22          15          15
56         23          16          16
57         24          17          17
58         25          18          18
59         26          19          19
60         27          20          20
61         28          21          21
62         29          22          22
63         30          23          23
On Mon, Jan 7, 2013 at 11:41 AM, Charles Determan Jr <deter088 at umn.edu> wrote:
--
Sarah Goslee
http://www.functionaldiversity.org