What is rbind in R?

This recipe explains what is rbind in R

Recipe Objective

Binding or combining rows or columns of two different dataframes is an important task to perform in data manipulation. we use rbind() and cbind() function to carry out this task on rows and columns respectively.

This recipe demonstrates the use of rbind() function.

rbind() function combines the rows of two dataframes of equal length.

Explore the Real-World Applications of Recommender Systems

Step 1: Creating two Dataframes

We use data.frame() function to create DataFrames

Name = c("Ram", "Fredo", "Geeta", "Jessica") rank = c(3,4,1,2) marks = c(50, 45, 95, 80) ​ dataframe1 = data.frame(Name,rank,marks) dataframe1

A data.frame: 4 x 3
Ram	3	50
Fredo	4	45
Geeta	1	95
Jessica	2	80

Name = c("Suresh", "Ramesh") rank = c(6,5) marks = c(40,43) dataframe2 = data.frame(Name,rank,marks) dataframe2

A data.frame: 2 x 3
Suresh	6	40
Ramesh	5	43

Step 2: Using rbind() to combine dataframes 1 and 2

Syntax: rbind(dataframe1,dataframe2)

# combining the rows of the two dataframes dataframe3 = rbind(dataframe1,dataframe2) dataframe3

A data.frame: 6 x 3
Ram	3	50
Fredo	4	45
Geeta	1	95
Jessica	2	80
Suresh	6	40
Ramesh	5	43

What Users are saying..

profile image

Ray han

Tech Leader | Stanford / Yale University
linkedin profile url

I think that they are fantastic. I attended Yale and Stanford and have worked at Honeywell,Oracle, and Arthur Andersen(Accenture) in the US. I have taken Big Data and Hadoop,NoSQL, Spark, Hadoop... Read More

Relevant Projects

Build an optimal End-to-End MLOps Pipeline and Deploy on GCP
Learn how to build and deploy an end-to-end optimal MLOps Pipeline for Loan Eligibility Prediction Model in Python on GCP

NLP Project to Build a Resume Parser in Python using Spacy
Use the popular Spacy NLP python library for OCR and text classification to build a Resume Parser in Python.

Predictive Analytics Project for Working Capital Optimization
In this Predictive Analytics Project, you will build a model to accurately forecast the timing of customer and supplier payments for optimizing working capital.

Build a Multi Class Image Classification Model Python using CNN
This project explains How to build a Sequential Model that can perform Multi Class Image Classification in Python using CNN

AWS MLOps Project to Deploy a Classification Model [Banking]
In this AWS MLOps project, you will learn how to deploy a classification model using Flask on AWS.

Credit Card Fraud Detection as a Classification Problem
In this data science project, we will predict the credit card fraud in the transactional dataset using some of the predictive models.

NLP Project for Multi Class Text Classification using BERT Model
In this NLP Project, you will learn how to build a multi-class text classification model using using the pre-trained BERT model.

End-to-End Speech Emotion Recognition Project using ANN
Speech Emotion Recognition using RAVDESS Audio Dataset - Build an Artificial Neural Network Model to Classify Audio Data into various Emotions like Sad, Happy, Angry, and Neutral

Deep Learning Project for Text Detection in Images using Python
CV2 Text Detection Code for Images using Python -Build a CRNN deep learning model to predict the single-line text in a given image.

BigMart Sales Prediction ML Project in Python
The goal of the BigMart Sales Prediction ML project is to build and evaluate different predictive models and determine the sales of each product at a store.