Learning R: How to replace single and multiple values in R