What is a tribble in R

This recipe explains what is a tribble in R

Recipe Objective

What is a tribble in R.

tibble () prints the data of the dataset in the similar way a dataframe () does. tibble () is a new form/ version of the usual dataframe (), which is part of the tidyverse library. A tribble () is used for creating a row-wise, readable tibble in R. This is useful for creating small tables of data. **Syntax: tribble (~column1, ~column2)** where, Row column — represents the data in row by row layout This recipe demonstrates an example on tribble in R.

Master the Art of Data Cleaning in Machine Learning

Step 1 - Install the necessary library

library(tidyverse)

Step 2 - Use the tribble()

Create row by row tibble

tribble( ~columnX, ~columnY, "v", 5, "w", 10, "x", 15, "y", 20, "z", 25, )

"Output of the code is:
A tibble: 5 × 2
columnX	columnY
	
v	5
w	10
x	15
y	20
z	25

Create a list in tibble by passing non scalar values

tribble( ~X, ~Y, "v", 1:5, "w", 6:10, "x", 11:15, "y", 16:20, "z", 21:25, )

"Output of the code is:
A tibble: 5 × 2
X	Y
	
v	1, 2, 3, 4, 5
w	6, 7, 8, 9, 10
x	11, 12, 13, 14, 15
y	16, 17, 18, 19, 20
z	21, 22, 23, 24, 25

{"mode":"full","isActive":false}

What Users are saying..

profile image

Anand Kumpatla

Sr Data Scientist @ Doubleslash Software Solutions Pvt Ltd
linkedin profile url

ProjectPro is a unique platform and helps many people in the industry to solve real-life problems with a step-by-step walkthrough of projects. A platform with some fantastic resources to gain... Read More

Relevant Projects

Ensemble Machine Learning Project - All State Insurance Claims Severity Prediction
In this ensemble machine learning project, we will predict what kind of claims an insurance company will get. This is implemented in python using ensemble machine learning algorithms.

NLP Project on LDA Topic Modelling Python using RACE Dataset
Use the RACE dataset to extract a dominant topic from each document and perform LDA topic modeling in python.

Locality Sensitive Hashing Python Code for Look-Alike Modelling
In this deep learning project, you will find similar images (lookalikes) using deep learning and locality sensitive hashing to find customers who are most likely to click on an ad.

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.

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.

Build Real Estate Price Prediction Model with NLP and FastAPI
In this Real Estate Price Prediction Project, you will learn to build a real estate price prediction machine learning model and deploy it on Heroku using FastAPI Framework.

GCP MLOps Project to Deploy ARIMA Model using uWSGI Flask
Build an end-to-end MLOps Pipeline to deploy a Time Series ARIMA Model on GCP using uWSGI and Flask

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

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.

Abstractive Text Summarization using Transformers-BART Model
Deep Learning Project to implement an Abstractive Text Summarizer using Google's Transformers-BART Model to generate news article headlines.