title: How to lookup by row and column > column names?
body: <p>I am thinking how to lookup <em>time</em> data by University name (first row: <code>A</code>,...,<code>F</code>), Field name (first column: <code>Acute</code>,...,<code>En</code>) and/or graduation time (<code>time</code>) in the following file <code>DS.csv</code>. 
  I am thinking <code>dplyr</code> approach but could not expand numerical ID lookup (thread answer <a href="https://stackoverflow.com/questions/40348459/how-to-overload-function-parameters-in-r/40349149#40349149">How to overload function parameters in R?</a>) to the lookup by three variables. 
  Challenges</p>
  
  <ol>
  <li>How to lookup by the first row? Maybe, something similar to <code>$1 == "A"</code>. </li>
  <li>How to Expand university lookup to two columns? Pseudocode <code>$1 == "A"</code> is about the second and third column, ..., <code>$1 == "F"</code> about two last columns. </li>
  <li><p>Do lookup by 3 lookup criterias: first row (no header), first column with header <code>Field</code> and for the header <code>time</code>. Pseudocode </p>
  
  <pre><code>times &lt;- getTimes($1 == "A", Field == "Ane", by = "desc(time)")
  </code></pre></li>
  </ol>
  
  <p>Data <code>DS.csv</code> has the data. The first column denotes experiment. The data below is in crosstab format such that</p>
  
  <pre><code>,A,,B,,C,,D,,E,,F,
  Field,time,T,time,T,time,T,time,T,time,T,time,T
  Acute,0,0,8.3,1,7.5,1,8.6,2,0,0,8.3,4
  Ane,9,120,7.7,26,7.9,43,7.8,77,7.9,60,8.2,326
  En,15.6,2,12.9,1,0,0,0,0,14.3,1,14.6,4
  Fo,9.2,2,0,0,5.4,1,0,0,0,0,7.9,3
  </code></pre>
  
  <p>and in the straight table format such that</p>
  
  <pre><code>Field,time,T,Experiment       
  Acut,0,0,A
  An,9,120,A
  En,15.6,2,A
  Fo,9.2,2,A
  Acute,8.3,1,B       
  An,7.7,26,B
  En,12.9,1,B
  Fo,0,0,B  
  Acute,7.5,1,C       
  An,7.9,43,C
  En,0,0,C  
  Fo,5.4,1,C
  Acute,8.6,2,D       
  An,7.8,77,D
  En,0,0,D  
  Fo,0,0,D  
  Acute,0,0,E         
  An,7.9,60,E
  En,14.3,1,E
  Fo,0,0,E  
  Acute,8.3,4,F       
  An,8.2,326,F
  En,14.6,4,F
  Fo,7.9,3,F
  </code></pre>
  
  <p>Pseudocode</p>
  
  <pre><code>library('dplyr')
  ow &lt;- options("warn")
  DF &lt;- read.csv("/home/masi/CSV/DS.csv", header = T)
  
  # Lookup by first row, Lookup by Field, lookup by Field's first column?
  times &lt;- getTimes($1 == "A", Field == "Ane", by = "desc(time)")
  </code></pre>
  
  <p>Expected output: <code>9</code><br>
  Expected output generalised: <code>a</code>, <code>b</code>, <code>c</code>, ...</p>
  
  <pre><code>## Data where values marked by small letters a,b,c, ... are wanted 
  #       uni1    uni2 ... 
  #       time T  time T ...
  #Field1 a       c
  #Field2 b       ...
  #...    ...
  </code></pre>
  
  <p>R: 3.3.3 (2017-03-06)<br>
  OS: Debian 8.7<br>
  Hardware: Asus Zenbook UX303UA    </p>