Jehan Joshi Jehan Joshi - 6 months ago 48
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), ]
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download