Message-ID: <CAM_vju=0G7J2KRGfn_=Utw55B=F+S5vQyeX2vD5+0ep+BHZFBg@mail.gmail.com>
Date: 2011-10-28T14:56:45Z
From: Sarah Goslee
Subject: quick matching question
In-Reply-To: <CAKx9SQnor7g+hR0Ak8bS+K9YY_1eiv3eCnDjKvmOmsbDe00i+Q@mail.gmail.com>
Looks like a job for merge().
On Fri, Oct 28, 2011 at 10:49 AM, Ben Ganzfried <ben.ganzfried at gmail.com> wrote:
> Hey,
>
> I'm trying to match patient identifiers from two separate input files, and
> then add information from one of the input files to the corresponding output
> file. ?I'd greatly appreciate any help!
>
> More specifically,
> Input_File_1 has a column header "bcr_patient_barcode"
> Input_File_2 has a column header "Barcode" and a column header "Batch"
>
> I want my script to match the appropriate patient identifiers since
> "bcr_patient_barcode" and "Barcode" are not in the same order. ?Then I want
> to add the information from "Batch" to the corresponding patient.
>
> My (incorrect) code is below:
>
> #batch
> tmp <- Input_File_2$Barcode
> tmp1 <- Input_File_1$bcr_patient_barcode
>
> for i in tmp
> ?for item in tmp1
> if (tmp == tmp1) {
> ?curated$batch <- Input_File_2$Batch
> }
>
--
Sarah Goslee
http://www.functionaldiversity.org