VOOZH about

URL: https://www.geeksforgeeks.org/r-language/filter-out-the-cases-from-an-object-in-r-programming-filter-function/

⇱ Filter Out the Cases from an Object in R Programming - filter() Function - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

Filter Out the Cases from an Object in R Programming - filter() Function

Last Updated : 15 Jul, 2025
filter() function in R Language is used to choose cases and filtering out the values based on the filtering expression.
Syntax: filter(x, expr) Parameters: x: Object to be filtered expr: expression as a base for filtering
Example 1: Output:
 name age ht school
1 Abhi 7 46 yes
2 Bhavesh 5 NA yes
3 Chaman 9 NA no
4 Dimri 16 69 no
 name age ht school
1 Bhavesh 5 NA yes
2 Chaman 9 NA no
 name age ht school
1 Abhi 7 46 yes
2 Dimri 16 69 no
Example 2: Output:
 name age ht school
1 Abhi 7 46 yes
2 Bhavesh 5 NA no
3 Chaman 9 NA yes
4 Dimri 16 69 no
 name age ht school
1 Abhi 7 46 yes
2 Chaman 9 NA yes
 name age ht school
1 Bhavesh 5 NA no
2 Dimri 16 69 no
Comment
Article Tags:

Explore