How to delete rows

Hi everybody!

In my dataset I want to delete every row where max < 9. This is my actual code:

#my dataset
my_data <- data.frame(A=c(4,1,9,1,3), B=c(3,2,8,4,2), C=c(1,2,7,2,4), D=c(4,2,9,1,1))
my_data = t(my_data)
my_data <- as.data.frame(my_data)

#delete every row where V3 is < 9
final <- my_data[which(1:nrow(my_data) %% my_data$V3 < 9) , ]

I already know that the maximum values are all in that column. Currently, the rows with maxima equal to 7 and 8 are not eliminated.

So, how can I delete the rows?

Does this works ? :

final<- my_data[my_data$V3>8,]

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.