Off topic:loop several conditions R
1
0
Entering edit mode
5.3 years ago
julrodr80 • 0

I need to do a loop with several conditions (create three diferent objects several times) and with a loop nested. I write this:

`metaxcan <- c("foo1.csv", "foo2.csv")`
`predix_asso <- c("soo1.csv", "soo2.csv")`

`for (i in metaxcan){`
`for (j in predix_asso){`
  `PGC<-read.csv(i, header=T, sep=",")`
  `asociacion<-read.table(j, header=T, sep="") `

`PGC_predix <- merge(PGC,asociacion,by="gene")`
   `ngenes<-nrow(PGC_predix_1)  ` 



 `print(ngenes)` 

  `}` 
 `}`

But instead of print just 2 numbers (the merge between foo1 and soo1; and the merge of foo2 and soo2), it prints 4 numbers (all interactions)

How can I do? thanks

R loop • 769 views
ADD COMMENT
This thread is not open. No new answers may be added
Traffic: 1988 users visited in the last hour
Help About
FAQ
Access RSS
API
Stats

Use of this site constitutes acceptance of our User Agreement and Privacy Policy.

Powered by the version 2.3.6