Dplyr:: Filter() in R

Dplyr() is the data manipulation package in R and is described in detail here.
 

Problem:

Use of Dplyr Filter() in R
 

Solution:

 
Filter() allows subset observations based on their values i.e. Filter function will return all the rows that satisfy some conditions.
 

Example:

 
For this example, we can use the data sets related to flights that departed from NYC in 2013.
 
We have installed the dataset in our previous post and you can get the code here.

 

 
Flights

Logical Comparison in R   

<
Less than
>
Greater than
==
Equal to
<=
Less than or equal to
>=
Greater than or equal to
!=
Not equal to
%in%
Group membership
is.na
Is NA
!is.na
Is not NA
&
Boolean AND
|
Boolean OR
xor
Exactly OR
!
Not
any
Any True
all
All True

Filter Example Code:

jfk_sfo_flight

You may also like the below posts:

  1. https://oindrilasen.com/2017/10/dplyr-summarise-in-r/
  2. https://oindrilasen.com/2017/10/dplyr-arrange-in-r/
  3. https://oindrilasen.com/2017/11/unused-arguments-error-in-dplyr-select/

Thank You for reading!

0

Leave a Reply

Your email address will not be published. Required fields are marked *