Quantcast

Generating unque patient IDs

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Generating unque patient IDs

Ayyappa Chaturvedula
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.

Regards,
Ayyappa

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Odp: Generating unque patient IDs

PIKAL Petr
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]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Odp: Generating unque patient IDs

jholtman
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 <[hidden email]> 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]]
>>
>> ______________________________________________
>> [hidden email] 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.
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Generating unque patient IDs

David Winsemius
In reply to this post by Ayyappa Chaturvedula

On Jan 11, 2012, at 11:12 AM, Ayyappa Chaturvedula wrote:

> 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.

Are you sure?
> 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.

They should not be input or managed as numbers but rather as character  
variables. If you want them output without quotes, then fine, R can do  
that when specified.


--
David Winsemius, MD
West Hartford, CT

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Odp: Generating unque patient IDs

David Winsemius
In reply to this post by jholtman
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  
> <[hidden email]> 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]]
>>>
>>> ______________________________________________
>>> [hidden email] 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.
>>
>> ______________________________________________
>> [hidden email] 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.
>
> ______________________________________________
> [hidden email] 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

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Generating unque patient IDs

Chris Campbell
In reply to this post by Ayyappa Chaturvedula
Dear Ayyappa

Unique identifiers can be created from numbers using factor. These are coded as integers in R which you could use to relabel your dataset.

> x <- rep(1000000006:1000000008, each = 2)
> x
[1] 1000000006 1000000006 1000000007 1000000007 1000000008 1000000008
> y <- factor(x)
> levels(y)
[1] "1000000006" "1000000007" "1000000008"
> z <- as.numeric(y)
> z
[1] 1 1 2 2 3 3

Regards,

Chris Campbell
MANGO SOLUTIONS
Data Analysis that Delivers
+44 1249 767700

-----Original Message-----
From: [hidden email] [mailto:[hidden email]] On Behalf Of Ayyappa Chaturvedula
Sent: 11 January 2012 16:12
To: [hidden email]
Subject: [R] Generating unque patient IDs

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.

Regards,
Ayyappa

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
LEGAL NOTICE
This message is intended for the use o...{{dropped:10}}

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Odp: Generating unque patient IDs

jholtman
In reply to this post by David Winsemius
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
<[hidden email]> 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 <[hidden email]>
>> 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]]
>>>>
>>>>
>>>> ______________________________________________
>>>> [hidden email] 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.
>>>
>>>
>>> ______________________________________________
>>> [hidden email] 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.
>>
>>
>> ______________________________________________
>> [hidden email] 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.

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Odp: Generating unque patient IDs

Ayyappa Chaturvedula
In reply to this post by David Winsemius
Dear all,
I am sorry if I misstated the problem. The roundig issue is with  
NONMEM software not with R. But the suggestions are helpful.

Regards,Ayyappa Chaturvedula

On Jan 11, 2012, at 12:14 PM, David Winsemius <[hidden email]>  
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  
>> <[hidden email]> 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]]
>>>>
>>>> ______________________________________________
>>>> [hidden email] 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.
>>>
>>> ______________________________________________
>>> [hidden email] 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.
>>
>> ______________________________________________
>> [hidden email] 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
>

______________________________________________
[hidden email] 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.
Loading...