Re: [R] Converting ID Numbers to Unique ID Number

2011-09-20 Thread jim holtman
something like this should work: > oldIDs <- c(1234, 1235, 1236) > newIDs <- c(5000, 1234, 7000, 1236) > # really new ones -- don't match the old ones > (reallyNew <- setdiff(newIDs, oldIDs)) [1] 5000 7000 > # assign these back to the oldIDs for the next month > (oldIDs <- c(oldIDs, reallyNew)) [1

Re: [R] Converting ID Numbers to Unique ID Number

2011-09-20 Thread Sarah Goslee
A reproducible example would be useful, as yours isn't entirely clear. But maybe something like this? id.info <- data.frame(foreign=sort(unique(foreign.id)), local=1:length(unique(foreign.id))) and then use merge() to combine that with your actual data. Sarah On Tue, Sep 20, 2011 at 11:50 AM,

[R] Converting ID Numbers to Unique ID Number

2011-09-20 Thread Totally Inept
First off, let me apologize for the elementary question. I'm obviously a novice. Here's a stripped version of my problem. March foreign id = 1234, my id = 1 foreign id = 1235, my id = 2 foreign id = 1236, my id = 3 So we are adding new people for April, and things don't necessarily come in order