r delete rowif number higher than
R: Deleting Rows Based on Condition
# Create example data frame
data <- data.frame(x = c(1, 2, 3, 4, 5),
y = c(6, 7, 8, 9, 10))
# Remove rows where value in column 'x' is greater than 3
data <- data[data$x <= 3, ]
- Create an example data frame called 'data' with columns 'x' and 'y'.
- Use the subsetting operation to remove rows where the value in column 'x' is greater than 3.
- Assign the filtered result back to the 'data' variable to update the data frame.