Write an R program to filter rows in a data frame based on a specific condition.
MediumProblem Statement
Write an R program to filter rows in a data frame based on a specific condition.
Sample Input
Data Frame: Name Age 1 John 25 2 Alice 30 3 Bob 22 Condition: Age > 25
Sample Output
Name Age 2 Alice 30
Limits
Time: 2s · Memory: 256 MB
Code Editor
00:00
# Predefined structure
data <- data.frame(Name = c("John", "Alice", "Bob"), Age = c(25, 30, 22))
filtered_data <- data[data$Age > 25, ]
print(filtered_data)
Input
Data Frame: Name Age 1 John 25 2 Alice 30 3 Bob 22 Condition: Age > 25
Expected Output
Name Age 2 Alice 30