Dropping a level from a factor within a data frame : <p>I have a data frame 'qlfs' which contains a column 'qlfs$TravelMode'.</p>

<p>The $TravelMode is a factor containing 10 levels:</p>

<pre><code>levels(qlfs$TravelMode)
[1] "Non-working adult"                   
[2] "Car,van,minibus,works van"           
[3] "Motorbike,moped,scooter"             
[4] "Bicycle"                             
[5] "Bus,coach,private bus"               
[6] "Taxi"                                
[7] "Railway train"                       
[8] "Underground train,light railway,tram"
[9] "Walk"                                
[10] "Other method"                    
</code></pre>

<p>The dataset contains 90k + rows.</p>

<p>I would like to remove level 1 (Non-working adult) and any associated rows from the wider dataframe.</p>

<p>I have tried the following:</p>

<pre><code>for (i in 1:NROW(qlfs$TravelMode)) {
   if(qlfs$TravelMode[i]="Non-working adult") {
       qlfs$TravelMode[i] &lt;- "NA"
   }
}
</code></pre>

<p>Where I would then remove the NAs at a later point, but this did not work.</p>

<p>I have also looked at droplevels() function, but could not get this to work.</p>

<p>Can anybody point out where I am going wrong or suggest a better way to achieve this?</p>
