0

Let's take the iris data frame.

Hypothetically, I know the guy that measured the Petal.Length, Petal.Width and Sepal.Width for the species setosa and know he made some terrible mistakes. Therefore I would like to make all these values NA. The Sepal.Length and all other data from the other species is measured by other people and can be trusted.

Is there an easy way to do this with dplyr or otherwise? For the real data frame there are many more columns that need to be changed to NA.

zx8754
  • 52,746
  • 12
  • 114
  • 209

1 Answers1

0

Using iris data:

iris[ iris$Species == "setosa",
      c("Petal.Length", "Petal.Width", "Sepal.Width")] <- NA
Community
  • 1
  • 1
zx8754
  • 52,746
  • 12
  • 114
  • 209