I've got a Spatialpointsdataframe. I would like to replace values in a column with NA if in the same row from another column the value is not 1. For example: I've got a coulmn roadtype and a column joincount. If in a row the joincount is not 1, i want to replace the roadtype with NA. Any idea how to do that? Thanks for your help
Asked
Active
Viewed 103 times
-5
-
So easy, I tried this: shape$name_wegty[which(is.na(shape$Count !=1))] = NA. It did not work though. Any idea why? Thanks a lot – daverous Nov 23 '14 at 12:51
-
Make a [minimal reproducible example](http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) and show the expected result. – talat Nov 23 '14 at 13:05
-
What is it that you think the `is.na` in `is.na(shape$Count !=1)` is doing? – Elin Nov 23 '14 at 13:37