title: Converting R command line arguments into integer vectors
body: <p>I want to read command line arguments in <code>R</code> through <code>Rscript</code> and use the values stored in them for some integer operations. By default, the command line arguments are imported as characters:</p>
  
  <pre><code>#!/usr/bin/env Rscript
  arg &lt;- commandArgs(trailingOnly = TRUE)
  x = as.vector(arg[1])
  class(x)
  x
  y = as.vector(arg[2])
  class(y)
  y
  cor.test(x,y)
  </code></pre>
  
  <p>This is the output of this script:</p>
  
  <pre><code>$ Rscript Correlation.R 3,3,2 4,8,6
  [1] "character"
  [1] "3,3,2"
  [1] "character"
  [1] "4,8,6"
  Error in cor.test.default(x, y) : 'x' must be a numeric vector
  Calls: cor.test -&gt; cor.test.default
  Execution halted
  </code></pre>
  
  <p>How can I convert x and y to numeric vectors?</p>