[R] Odp: Generating unque patient IDs

jim holtman jholtman at gmail.com
Wed Jan 11 18:40:19 CET 2012


One of the reasons that I specified the 'seq' command as it was was to
make sure it used numerics:

> x <- seq(123456789012.0, length = 10, by = 1.0)
> x
 [1] 123456789012 123456789013 123456789014 123456789015 123456789016
123456789017 123456789018
 [8] 123456789019 123456789020 123456789021
> str(x)
 num [1:10] 123456789012 123456789013 123456789014 123456789015 123456789016 ...
>

On Wed, Jan 11, 2012 at 12:14 PM, David Winsemius
<dwinsemius at comcast.net> wrote:
> Unfortunately the "rounding effect" (which I assumed was related to the
> automatic conversion from integer to numeric) is only going to show up above
> 2147483647L, so I question whether you really demonstrated a solution to
> what I understood was the fundamental problem.
>
> --
> David.
>
> On Jan 11, 2012, at 11:50 AM, jim holtman wrote:
>
>> Does this do it for you:
>>
>>> sprintf("%010.0f", seq(1000000000.0, length = 250, by = 1.0))
>>
>>  [1] "1000000000" "1000000001" "1000000002" "1000000003" "1000000004"
>> "1000000005" "1000000006"
>>  [8] "1000000007" "1000000008" "1000000009" "1000000010" "1000000011"
>> "1000000012" "1000000013"
>> [15] "1000000014" "1000000015" "1000000016" "1000000017" "1000000018"
>> "1000000019" "1000000020"
>> [22] "1000000021" "1000000022" "1000000023" "1000000024" "1000000025"
>> "1000000026" "1000000027"
>> [29] "1000000028" "1000000029" "1000000030" "1000000031" "1000000032"
>> "1000000033" "1000000034"
>> [36] "1000000035" "1000000036" "1000000037" "1000000038" "1000000039"
>> "1000000040" "1000000041"
>> [43] "1000000042" "1000000043" "1000000044" "1000000045" "1000000046"
>> "1000000047" "1000000048"
>> [50] "1000000049" "1000000050" "1000000051" "1000000052" "1000000053"
>> "1000000054" "1000000055"
>> [57] "1000000056" "1000000057" "1000000058" "1000000059" "1000000060"
>> "1000000061" "1000000062"
>> [64] "1000000063" "1000000064" "1000000065" "1000000066" "1000000067"
>> "1000000068" "1000000069"
>> [71] "1000000070" "1000000071" "1000000072" "1000000073" "1000000074"
>> "1000000075" "1000000076"
>> [78] "1000000077" "1000000078" "1000000079" "1000000080" "1000000081"
>> "1000000082" "1000000083"
>> [85] "1000000084" "1000000085" "1000000086" "1000000087" "1000000088"
>> "1000000089" "1000000090"
>> [92] "1000000091" "1000000092" "1000000093" "1000000094" "1000000095"
>> "1000000096" "1000000097"
>>
>> On Wed, Jan 11, 2012 at 11:32 AM, Petr PIKAL <petr.pikal at precheza.cz>
>> wrote:
>>>
>>> Hi
>>>>
>>>>
>>>> Dear group,
>>>>
>>>> I am trying to prepare a NONMEM friendly dataset for population PK
>>>> analysis. My patient IDs are 10 digit long and NONMEM is losing precison
>>>> and rouding the last couple of digits.  I need to generate unique
>>>
>>> Patient
>>>>
>>>> IDs fromt he current 10-digit IDs.  Ihave total 250 subjects so I
>>>> appreciate if anybody can suggest me a way to code this in R.
>>>
>>>
>>> I would start with
>>>
>>> ?abbreviate
>>> and check uniqueness with
>>> ?unique or ?duplicated
>>>
>>> Regards
>>> Petr
>>>
>>>
>>>>
>>>> Regards,
>>>> Ayyappa
>>>>
>>>>   [[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.
>>>
>>>
>>> ______________________________________________
>>> 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.
>>
>>
>>
>>
>> --
>> Jim Holtman
>> Data Munger Guru
>>
>> What is the problem that you are trying to solve?
>> Tell me what you want to do, not how you want to do it.
>>
>>
>> ______________________________________________
>> 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.
>
>
> David Winsemius, MD
> West Hartford, CT
>



-- 
Jim Holtman
Data Munger Guru

What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.



More information about the R-help mailing list