mercredi 6 octobre 2021

Deleting rows by using a for loop + if statements

I've the following dataframe:

caratteri <- c("a", "b", "c", "d")
numeri <- c(1, 1, 2, 2)
dataFrameMio <- data.frame(caratteri, numeri)

How can I delete the rows in which the value of the numeri column is 2 by using a for loop and if statements?

I need to do this because, in the case of a big dataframe, I cannot specify manually which rows to delete. I'm a newbie in R, maybe it's possible to do that also without a loop.

Aucun commentaire:

Enregistrer un commentaire