What are vectors in R?

This recipe explains what are vectors in R

Recipe Objective

Vectors are nothing but data structures in R used for storing and retrieving various datatypes. Vectors are of two types: 1. Atomic vectors which consists of — Logical, integer, numeric, double and character datatype. Atomic vectors take a single value as an input. 2. Recursive vectors i.e lists, multiple values can be passed using a list.[] are used for indexing list vectors. The class () function is used for finding out the data type of a given vector. This recipe demonstrates different types of vectors that a user can use.

Getting Started with Image Segmentation using Mask R-CNN

Step 1 -Atomic Vector type numeric

a <- print(123) class(a)

"Output of the code is" :  123 
type : numeric 

Step 2 - Atomic Vector type integer

b <- print(2L) class(b)

"Output of the code is" : 2
type : integer 

Step 3 - Atomic Vector type character

c <- print("hello there") class(c)

"Output of the code is" : "hello there"
type- character "

Step 4 - Vector type -list()

x <- c(list("hello",123,2.5,"good")) class(x)

"Output of the code is " : 

"hello"
123
2.5
"good"

type - 'list'

What Users are saying..

profile image

Savvy Sahai

Data Science Intern, Capgemini
linkedin profile url

As a student looking to break into the field of data engineering and data science, one can get really confused as to which path to take. Very few ways to do it are Google, YouTube, etc. I was one of... Read More

Relevant Projects

Model Deployment on GCP using Streamlit for Resume Parsing
Perform model deployment on GCP for resume parsing model using Streamlit App.

Build CNN for Image Colorization using Deep Transfer Learning
Image Processing Project -Train a model for colorization to make grayscale images colorful using convolutional autoencoders.

Build Multi Class Text Classification Models with RNN and LSTM
In this Deep Learning Project, you will use the customer complaints data about consumer financial products to build multi-class text classification models using RNN and LSTM.

Deep Learning Project- Real-Time Fruit Detection using YOLOv4
In this deep learning project, you will learn to build an accurate, fast, and reliable real-time fruit detection system using the YOLOv4 object detection model for robotic harvesting platforms.

Loan Eligibility Prediction Project using Machine learning on GCP
Loan Eligibility Prediction Project - Use SQL and Python to build a predictive model on GCP to determine whether an application requesting loan is eligible or not.

AWS MLOps Project for ARCH and GARCH Time Series Models
Build and deploy ARCH and GARCH time series forecasting models in Python on AWS .

Detectron2 Object Detection and Segmentation Example Python
Object Detection using Detectron2 - Build a Dectectron2 model to detect the zones and inhibitions in antibiogram images.

BERT Text Classification using DistilBERT and ALBERT Models
This Project Explains how to perform Text Classification using ALBERT and DistilBERT

OpenCV Project for Beginners to Learn Computer Vision Basics
In this OpenCV project, you will learn computer vision basics and the fundamentals of OpenCV library using Python.

Time Series Python Project using Greykite and Neural Prophet
In this time series project, you will forecast Walmart sales over time using the powerful, fast, and flexible time series forecasting library Greykite that helps automate time series problems.