title: What are levels in R?
body: <p>I understand this is a very basic question but I don't understand what levels mean in R.</p>
  
  <p>For reference, I have done a simple script to read CSV table, filter on one of the fields, pass this on to a new variable and clear the memory allocated for the first variable. If I call unique() on the field on which I filtered, I see that the results were indeed filtered but there is one additional line showing 'Levels' corresponding to data that is in the original dataset.</p>
  
  <p>Example:</p>
  
  <pre><code>df = read.csv(path, sep=",", header=TRUE)
  df_intrate = df[df$AssetClass == "ASSET CLASS A", ]
  
  rm(df)
  gc()
  
  unique(df_intrate$AssetClass)
  </code></pre>
  
  <p>Results:</p>
  
  <pre><code>[1] ASSET CLASS A
  Levels: ASSET CLASS E ASSET CLASS D ASSET CLASS C ASSET CLASS B ASSET CLASS A
  </code></pre>
  
  <p>Is the structural information from <code>df</code> somehow preserved in df_intrate despite R studio showing that df_intrate is indeed the expected number of rows for <code>ASSET CLASS A</code> ?</p>