title: rearranging panels in lattice xyplot
body: <p>Below is the code that I was using when I only conditioned on a single variable. Using index.cond as below worked for switching the order of the panels in the final graph. However, now that I am conditioning on two variables the below code does not work to switch positions of the different panels. How do I modify index.cond to work? Here is my code and below is a picture of the graph and sample data: </p>
  
  <pre><code>libs &lt;- c('lattice', 'latticeExtra', 'gridExtra', 'MASS', 'colorspace', 'plyr', 'Hmisc', 'scales')
  lapply(libs, require, character.only = T)
  
  
  conversion_test &lt;- read.table("Desktop/FAST/convert_test/Results/fasconvert_Results", sep="\t",   header=TRUE)
  
  
  scatter.lattice &lt;- xyplot(Time.to.Completion..s. ~ Number.of.Sequences | Length * Conversion, data  = conversion_test, ylab = "Time to Completion (s)", xlab = "Number of Sequences", index.cond=list(c(2,1,4,3)), pch=16, 
                           panel = function(x, y, ...) {
                           panel.xyplot(x, y, ...)
                           lm1 &lt;- lm(y ~ x)
                           lm1sum &lt;- summary(lm1)
                           r2 &lt;- lm1sum$adj.r.squared
                           panel.abline(a = lm1$coefficients[1], 
                                        b = lm1$coefficients[2])
                           panel.text(labels = 
                                        bquote(italic(R)^2 == 
                                                 .(format(r2, 
                                                          digits = 5))),
                                      x = 500000, y = 10)
                           },
                         xscale.components = xscale.components.subticks,
                         yscale.components = yscale.components.subticks,
                         as.table = TRUE)
  scatter.lattice
  </code></pre>
  
  <p>I would like to switch the order of the columns.
  <img src="https://i.stack.imgur.com/zcqyA.png" alt="Output"></p>
  
  <p>Here is an example dataset:</p>
  
  <pre><code>Numberofseq timetoCompletion Length Conversion
  25000         9.3             100bp    ClustalW
  250000        45              100bp    ClustalW
  25000         9.3             100bp    Fasta
  250000        45              100bp    Fasta
  25000         9.3             1000bp    ClustalW
  250000        45              1000bp    ClustalW
  25000         9.3             1000bp    Fasta
  250000        45              1000bp    Fasta  
  </code></pre>