I am working on a car dataset in R. In that, I have one column named as fuel, which is of class factor. So, total number of cars are distributed in 5 types. I want to remove 3 types from that column. An example is as follows:
fuel:  
 CNG     :  40                                                                                      
 Diesel  :2133   
 Electric:   1   
 LPG     :  23                          
 Petrol  :2120
How to remove factor levels CNG, Electric & LPG with one command?
I have tried as below, it works, but I think there is a better way to do, like with a 1 line command.
1.
car <- car[!car$fuel == "CNG", ]
car <- car[!car$fuel == "Electric", ]
car <- car[!car$fuel == "LPG", ]
I tried following way also, but this did not work, Why did the below command not work?
2.
car <- car[!car$fuel == "CNG"||"Electric"||"LPG", ]