[R] Help with making Loop

John Kane jrkrideau at inbox.com
Sat May 2 04:24:03 CEST 2015

Hi Fazal,

In order to help you we probably need some sample data.  Any code you have been trying is also probably useful

The png is helpful but it is much better to supply the actual data or a good sample of it).  

The best way to supply data to R-help is to use the dput() function.  See ?dput() for some basic information on how to use it.

In very simple terms, if you have a data set called mydata do


copy the output and paste into your e-mail. 
Done.  Fini!
This provides the R-help readers with an exact copy of your data. 

For general information about how to ask questions in R-help see http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

welcome to R-help

John Kane
Kingston ON Canada

> -----Original Message-----
> From: fazal.hadi at curie.fr
> Sent: Fri, 1 May 2015 20:05:22 +0000
> To: r-help at r-project.org
> Subject: [R] Help with making Loop
> 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.

FREE 3D EARTH SCREENSAVER - Watch the Earth right on your desktop!

More information about the R-help mailing list