How to apply a filter on dataframe in R?

How to apply a filter on dataframe in R?

How to apply a filter on dataframe in R?

This recipe helps you apply a filter on dataframe in R

Recipe Objective

How to apply a filter on dataframe in R ? A filter () function is used to filter out specified elements from a dataframe that return TRUE value for the given condition (s). filter () helps to reduce a huge dataset into small chunks of datasets. **Syntax — filter (data,condition)** This recipe illustrates an example of filters in R..

Step 1 - Import necessary library

install.packages("dplyr") # Install package library(dplyr) # load the package

Step 2 - Create a dataframe

df <- data.frame(student_name = c('U','V','X','Y','Z'), grade = c('AA','CC','DD','AB','BB'), math_marks = c(40,80,38,97,65), eng_marks = c(95,78,36,41,25), sci_marks = c(56,25,36,87,15)) print(df)
 Dataframe is ": 
  student_name grade math_marks eng_marks sci_marks
1            U    AA         40        95        56
2            V    CC         80        78        25
3            X    DD         38        36        36
4            Y    AB         97        41        87
5            Z    BB         65        25        15

Step 3 - Apply filter()

Filter rows on basis of column grade ='AB'

print(filter(df,grade =='AB'))
 Output is ": 
  student_name grade math_marks eng_marks sci_marks
1            Y    AB         97        41        87

Relevant Projects

Data Science Project in Python on BigMart Sales Prediction
The goal of this data science project is to build a predictive model and find out the sales of each product at a given Big Mart store.

Avocado Machine Learning Project Python for Price Prediction
In this ML Project, you will use the Avocado dataset to build a machine learning model to predict the average price of avocado which is continuous in nature based on region and varieties of avocado.

Build a Collaborative Filtering Recommender System in Python
Use the Amazon Reviews/Ratings dataset of 2 Million records to build a recommender system using memory-based collaborative filtering in Python.

Loan Eligibility Prediction using Gradient Boosting Classifier
This data science in python project predicts if a loan should be given to an applicant or not. We predict if the customer is eligible for loan based on several factors like credit score and past history.

Predict Churn for a Telecom company using Logistic Regression
Machine Learning Project in R- Predict the customer churn of telecom sector and find out the key drivers that lead to churn. Learn how the logistic regression model using R can be used to identify the customer churn in telecom dataset.

Classification of T shirt images to see if they have text on them
Want to search images of clothes which have text on them? Then this project talks through how we can classify an image whether it has text on it or not. For this we use state of the model called as inception and try and deepdive into how it works on our dataset

Convolutional RCCn's for extracting the text out of images
CRNNs combine both convolutional and recurrent architectures and is widely used in text detection and optical character recognition (OCR). In this project, we are going to use a CRNN architecture to detect text in sample images. The data we are going to use is TRSynth100k from Kaggle. Given an image containing some text, the goal here is to correctly identify the text using the CRNN architecture. We are going to train the model end-to-end from scratch.

Data Science Project-TalkingData AdTracking Fraud Detection
Machine Learning Project in R-Detect fraudulent click traffic for mobile app ads using R data science programming language.

Build an Image Classifier for Plant Species Identification
In this machine learning project, we will use binary leaf images and extracted features, including shape, margin, and texture to accurately identify plant species using different benchmark classification techniques.

Ecommerce product reviews - Pairwise ranking and sentiment analysis
This project analyzes a dataset containing ecommerce product reviews. The goal is to use machine learning models to perform sentiment analysis on product reviews and rank them based on relevance. Reviews play a key role in product recommendation systems.