This is a test version of Biostars. For the public version, visit https://www.biostars.org.
calculating the area under the curve with for loops

I am supposed to create a for loop with R to calculate the area under the curve. I have no clue how to do it. I have a bunch of SNPs and I want to calculate the LD decay for every single SNP within each contig. The loop should take the V7 (which is the 7th column =r2 values) from the first row adds it up to V7 from the second row divides it by 2, take V5 from the first row (which is the position of focal SNP) subtracts it from V5 from the second row (position of neigbour SNP ), and multiply these two values. This process should be repeated for the 2nd and 3rd row, then between 3rd and fourth row. Does anyone has any clue how can I create such a loop? I would really appreciate it.

tscaffold94_798049_802097 999 NA tscaffold94_798049_802097  999 NA  1.0000
r loop curve

Are these assignment questions?

0 answers

No answers yet.

Log in to answer this question.