R - number of unique values in a column of data frame : <p>for a dataframe <code>df</code>, I need to find the unique values for <code>some_col</code>. Tried the following </p>

<p><code>length(unique(df["some_col"]))</code></p>

<p>but this is not giving the expected results. However <code>length(unique(some_vector))</code> works on a vector and gives the expected results. </p>

<p>Some preceding steps while the df is created</p>

<pre><code>df &lt;- read.csv(file, header=T)
typeof(df) #=&gt; "list"
typeof(unique(df["some_col"])) #=&gt; "list"
length(unique(df["some_col"])) #=&gt; 1 
</code></pre>
