Getting the column names of a Data Frame with sapply
<p>I want to get the columns names of a Data Frame with the following code: </p>

<pre><code>DF &lt;- data.frame(X=c(1,2), Y=c(3,4))
as.character(sapply(DF, names))
</code></pre>

<p>I've got the following: </p>

<pre><code>"NULL" "NULL"
</code></pre>

<p>but I need the following result: </p>

<pre><code>"X" "Y" 
</code></pre>

<p>How can I do this, thanks in advance. </p>