r - split dataframe twice and merge based on columns -


Is

I have a sampleID, chromosomes, start and stop, and the score indicates. I want to start each score for each sampleID in each sample, with all possible combinations of start.pos and end.pos in all sampleIDs. Therefore p> input, and all sampleIDs add $ mean score for each combination

  Snpland Chrome Startkpos Andkpos Meankl 1.1 00l2l02_a0l 1 0 11194349 1 1,4 00l2l02_a0l 1 11,194,349 11,492,125 0 1.5 00l2l02_a0l 1 11,492,125 71,442,329 1 1,9 00l2l02_a0l 1 71,442,329 249 250 621 1 1 , 13 0012102_A02 1 0 65493011 1 1,92 0012102_A02 1 65493011 66164733 1 1,102 0012102_A02 1 66,164,733 121,347,754 1 1.52 0012102_A02 1 121347754 249250621 0 1,14 0012102_A03 1 56384956 1 1,83 0012102_A03 1 56384956 106266297 1 1,73 0012102_A03 1 106266297 249250621 0 1,15 0012102_A04 1 0 51484139 1 1,27 0012102_A04 1 51484139 249250621 0 2,1 0012102_A01 2 50000001 1 2,2 0012102_A01 2 50000001 250000001 1 2,3 0012102_A02 2 500000 01 0 2.7 0012102_A02 2 50000020 270000001 0 2.18 0012102_A03 2 0 50000004 0 2.1 9 0012102_A03 2 50000004 250000001 0 1.15 0012102_A04 2 0 51484139 0 1.27 0012102_A04 2 51484139 249250621 0  

output: here all the mean score for each Th each sampleID For all the possible start.pos and end.pos combinations have been added for the source code.

  chrome Startkpos Andkpos Meankl 1 0 11194349 4 1 11194349 11492125 3 1 11492125 51484139 4 1 51484139 56384956 3 1 56384956 65493011 3 1 65493011 66164733 1 1 66164733 71442329 3 1 71442329 106266297 2 1 106266297 121347754 1 1 121347754 249250621 1 2 50000001 1 2 50000001 50000004 2 50000004 50000020 2 50000004 51484139 0 2 51484139 249250621 2 2 249250621 250000001 0 
= "after the text" itemprop = "text">

use data.table:

  library (data.table) setDT (mydataframe) [order (start.pos, end .pos), list (summean = zodiac (meancol)), = list (sampleID, chrom)]  

You mean in the form of a column 'means' as a function Do not want the name and do it there Es confusion.


Comments

Popular posts from this blog

java - Can't add JTree to JPanel of a JInternalFrame -

javascript - data.match(var) not working it seems -

javascript - How can I pause a jQuery .each() loop, while waiting for user input? -