[R] Help with making Loop

Michael Dewey lists at dewey.myzen.co.uk
Sat May 2 14:31:58 CEST 2015


Dear Fazal
I think part of your problem can be addressed with merge
go
?merge
at the R prompt

On 01/05/2015 21:05, Hadi Fazal wrote:
> Hi everyone,
> I am a real beginner to R and have probably a very naive issue. I've a small data frame with three columns: Unique Sample ID, Gene 1 and Gene 2 (the columns on Gene1 and Gene2 are empty). I have two separate tables for the genes which contain the Unique Subject ID in one column and information on whether the gene is mutated or not in that particular subject (M, N/M) in another column called (Condition). I want to make a loop which can read the Unique Subject ID from my data frame, then look up for the same ID in the two tables and depending on whether the gene is mutated (M)/not mutated (N/M), inserts Yes like emoticon / No (N) in the appropriate gene column (Gene1/Gene2) for each Subject ID.
> If anyone can help, I would really appreciate
> Thanks in advance
>
> Fazal,
>
>
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

-- 
Michael
http://www.dewey.myzen.co.uk/home.html



More information about the R-help mailing list