title: Are integer vectors numeric vectors in R?
body: <p>I have an integer vector that I expected I could treat as a numeric vector:</p>
  
  <pre><code>&gt; class(pf$age)
  [1] "integer"
  &gt; is.numeric(pf$age)
  [1] TRUE
  </code></pre>
  
  <p>However, when I try to use it to calculate a correlation, I get an error:</p>
  
  <pre><code>&gt; cor.test(x = "age", y = "friend_count", data = pf)
  Error in cor.test.default(x = "age", y = "friend_count", data = pf) : 
    'x' must be a numeric vector
  </code></pre>
  
  <p>None of my best guesses at alternate syntax work either: <a href="http://pastie.org/9595290" rel="nofollow">http://pastie.org/9595290</a></p>
  
  <p>What's going on?</p>
  
  <p>Edit:</p>
  
  <p>The following syntax works:</p>
  
  <pre><code>&gt; x = pf$age
  &gt; y = pf$friend_count
  &gt; cor.test(x, y, data = pf, method="pearson", alternative="greater")
  </code></pre>
  
  <p>However, I don't understand why I can't specify x and y in the function (as you can with other R functions like <code>ggplot</code>).  What is the difference between <code>ggplot</code> and <code>cor.test</code>?</p>