What is cbind in R?

What is cbind in R?

What is cbind in R?

This recipe explains what is cbind in R

Recipe Objective

What is cbind in R? Cbind () — column bind function is used for merging two data frames together given that the number of rows in both the data frames are equal. cbind can append vectors, matrices or any data frame by columns. This recipe demonstrates an example using cbind.

Step 1- Define two dataframes

df1 <- data.frame(name = c('A','B','C','D','E','F'), age = c(22,25,28,19,15,23)) print(df1)
"df1 is":
  name age
1    A  22
2    B  25
3    C  28
4    D  19
5    E  15
6    F  23
df2 <- data.frame(gender = c('Male','Male','Female','Male','Female','Female')) print(df2)
"df2 is": 
1   Male
2   Male
3 Female
4   Male
5 Female
6 Female

Step 2 - Apply cbind()

final_data <- cbind(df1,df2) print(final_data)
"Output of code is": 
  name age gender
1    A  22   Male
2    B  25   Male
3    C  28 Female
4    D  19   Male
5    E  15 Female
6    F  23 Female

Relevant Projects

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.

Forecasting Business KPI's with Tensorflow and Python
In this machine learning project, you will use the video clip of an IPL match played between CSK and RCB to forecast key performance indicators like the number of appearances of a brand logo, the frames, and the shortest and longest area percentage in the video.

Ola Bike Rides Request Demand Forecast
Given big data at taxi service (ride-hailing) i.e. OLA, you will learn multi-step time series forecasting and clustering with Mini-Batch K-means Algorithm on geospatial data to predict future ride requests for a particular region at a given time.

Multi-Class Text Classification with Deep Learning using BERT
In this project, we will cover in detail the architecture of a transformer used in natural language processing use cases. We will go through the key nlp areas in the pre-transformer stage like bow, word2vec...and then the origin and gradual refinement of transformers. Finally, we will study one of the most popular state of the art transformer models, called BERT and use it for text classification on a large dataset.

Image Segmentation using Mask R-CNN with Tensorflow
In this Deep Learning Project on Image Segmentation Python, you will learn how to implement the Mask R-CNN model for early fire detection.

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.

Identifying Product Bundles from Sales Data Using R Language
In this data science project in R, we are going to talk about subjective segmentation which is a clustering technique to find out product bundles in sales data.

NLP and Deep Learning For Fake News Classification in Python
In this project you will use Python to implement various machine learning methods( RNN, LSTM, GRU) for fake news classification.

PySpark Tutorial - Learn to use Apache Spark with Python
PySpark Project-Get a handle on using Python with Spark through this hands-on data processing spark python tutorial.

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.