May 2019
Beginner to intermediate
266 pages
5h 57m
English
This function helps to keep the observations based on specific criteria. It will filter the dataset records that match the particular condition.
The syntax for implementing the filter() function is as follows:
filter(data, condition)
Here, the parameters refer to the following:
If we want to filter the records of our dataset whose year of establishment or launch is greater than 2000, it can be achieved with the following syntax:
> mpgFilter <- mpg %>% filter(year>2000) > View(mpgFilter)
The output of our new dataset is as follows:

Read now
Unlock full access