Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I am not sure if I understood you correctly. You need to learn how to create a <a href="https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example">minimal reproducible example</a> and in particular how to use <code>dput</code>. </p> <p>I called the data.frames <code>markerinfo</code>, <code>genotype</code>, <code>phenotype</code> and used only a small part of your data for testing. For my solution to work, each genotype and phenotype in markerinfo has to be present in the corresponding data.frames. (Thus, I had to change phenotypes in markerinfo, to make it work with the reduced datasets I used for testing.)</p> <pre><code>result &lt;- lapply(seq_along(markerinfo$marker),function(i) { x &lt;- as.character(markerinfo$marker[i]) res &lt;- cbind(genotype[,x],phenotype[,as.character(markerinfo[i,"pheno"])]) colnames(res) &lt;- c(paste('geno',x,sep="_"),paste('pheno',as.character(markerinfo[i,"pheno"]),sep="_")) res } ) result &lt;- do.call('cbind',result) #combine lists head(result) geno_c3m22 pheno_CACNA1E geno_c3m22 pheno_CACNA1F geno_c3m16 pheno_CACNA1G geno_c3m20 pheno_RAPGEF2 [1,] 2 0.053503367 2 -0.05512395 2 -0.16406024 2 -0.247595001 [2,] 2 -0.296400594 2 -0.14167491 2 -0.28751925 2 0.076554542 [3,] 2 0.001312523 2 -0.33078461 2 -0.84388147 2 -0.327202333 [4,] 1 -0.138671725 1 0.15734291 1 -0.04136305 1 -0.007847655 [5,] 1 -0.453451438 1 -0.23904476 2 -0.34506117 1 -0.288891373 [6,] 1 -0.186128793 1 0.12046537 2 -1.45824366 1 -0.819438873 #this is a matrix, use as.data.frame to turn it into a data.frame </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload