[R] Identifying the particular X or Y in a sorted list

Bert Gunter gunter.berton at gene.com
Thu May 3 20:43:33 CEST 2012


Have you read "An Introduction to R?" If I understand correctly, your
question is very basic and suggests that you have not yet made even a
minimal effort on your own to learn R before asking for help from this
list.

-- Bert

answer: A[C>B]

On Thu, May 3, 2012 at 11:14 AM, Shankar Lanke <shankarlanke at gmail.com> wrote:
> Dear All,
> Thank you very much in advance.
>
> I have a data sets as shown below A (Patient ID ), B and C are the
> Concentration of drug in blood on day 1 and day 4, D is the difference in
> conc. To do this in R I have written a code as follows, identified the
> number of patients who have more concentration on day 4 . Here I want to
> identify specifically the patient ID (is he patient 1 or 2 or 5 and 7),
> whose concentration is more.
> How to write a code to get the list of A (patient ID whose difference is
> more on day 4).
>
>
> A 1 2 3 4 5
> B 7 2 3 6 9
> C 4 6 9 2 5
> (B-C) 3 -4 -6 4 4
>
> DF1<-list(A,B,C)
> DF1
>
> DF2<-(DF1$C-DF1$B)
> length(DF2)
> sum(DF2>0)
>
> #I want to subtract B from C to see and identify how many patients have
> greater concentrations and who are these patients (A).
>
>
> On Thu, May 3, 2012 at 12:15 PM, John Kane <jrkrideau at inbox.com> wrote:
>
>> You do not seem to have suppied either code nor data.  Please supply both.
>>
>> John Kane
>> Kingston ON Canada
>>
>>
>> > -----Original Message-----
>> > From: shankarlanke at gmail.com
>> > Sent: Wed, 2 May 2012 22:06:54 -0400
>> > To: r-help at r-project.org
>> > Subject: [R] Identifying the particular X or Y in a sorted list
>> >
>> > Dear All,
>> >
>> > I have a data sets as shown below A (Patient ID ), B and C are the
>> > Concentration of drug in blood on day 1 and day 4, D is the difference in
>> > conc. To do this in R I have written a code as follows, identified the
>> > number of patients who have more concentration on day 4 . Here I want to
>> > identify specifically the patient ID (is he patient 1 or 2 or 5 and 7),
>> > whose concentration is more.
>> > How to write a code to get the list of A (patient ID whose difference is
>> > more on day 4).
>> >
>> > Data<-(myDf$B-myDf$C)
>> > sum(Data>0)
>> >
>> >   A B CD (B-C)  1 14 10 4  2 12 7 5  3 11 15 -4  4 8 3 5  5 1 8 -7
>> >
>> > I appreciate your help, thank you very much in advance.
>> >
>> > Regards
>> >
>> >       [[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.
>>
>> ____________________________________________________________
>> GET FREE SMILEYS FOR YOUR IM & EMAIL - Learn more at
>> http://www.inbox.com/smileys
>> Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and
>> most webmails
>>
>>
>>
>
>
> --
> Regards,
> Shankar Lanke Ph.D.
> Assistant Professor
> Department of Pharmaceutical Sciences
> College of Pharmacy
> The University of Findlay
> (C) 678-232-3567
> (O) 419-434-5448
> Fax# 419-434-4390
>
>        [[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.
>



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list