Jehan Joshi Jehan Joshi - 24 days ago 20
R Question

Deleting Rows by condition

Below is the image that describes my data frame, I wish to conditionally delete all city names which have "Range" written in them as indicated in the snippet. I tried various approaches but haven't been successful so far.
enter image description here

Answer Source

Use grep with invert option to select all lines without Range.

yourDataFrame <- yourDataFrame[grep("Range", yourDataFrame$City, invert = TRUE), ]