1. Home
2. Training Library
3. Big Data
4. Courses
5. 3. Beginner Data Structures in R

# Operations in R

Developed with

1
Vectors in R
PREVIEW2m 53s

## The course is part of this learning path

Fundamentals of R
11
3
1
1
Start course
Overview
Difficulty
Intermediate
Duration
38m
Students
104
Ratings
5/5
Description

Course Description

This module introduces you to the some of the basic data structures that can be used in R

Learning Objectives

The objectives of this module are to provide you with an understanding of:

• What a vector is in R
• How to create a sequence
• How to create a vector using a repetition
• How to pull elements out of vectors
• Vectorised operations
• Logical comparisons
• Strings in R
• Undefined situations in mathematics
• 0, NA, NaN, & Null

Intended Audience

Aimed at all who wish to learn the R programming language.

Pre-requisites

No prior knowledge of R is assumed

Delegates should already be familiar with basic programming concepts such as variables, scope and functions

Experience of another scripting language such as Python or Perl would be an advantage

Having an understanding of mathematical concepts will be beneficial

Feedback

Transcript

- [Instructor] In R, many operations are vectorized, meaning that they run naturally across the entire vector as implied by mathematics. Now let's say for example you had created two vectors, prices and output, and amount, and you were to take the product of these two. Intuitively, this has made sense. We are multiplying the first entry by the first entry of each of our vectors one by one so the third item's price multiplied by the quantity of the third item returns the product of the price of the third item and the amount of the third item. Behind the scenes, as would be the case in any other programming language, and what we might consider to do without knowledge of this principle of vectorization, we'd have to use a for loop and run over a very complicated process of saying, what is my length of my prices or amount? And I'd have to say that for each item in the length of that process, I would like to step or a sequence along each of them and I'd have to take the product of each entry one by one and then add them up and that would then give me returning the same item. So this is what's happening behind the scenes. But obviously, with the benefit of vectorization, we're seeing this element wise multiplication occurring implicitly or division or any operator. For comparison, in mathematics, what you might see is regular matrix multiplication where the dimensions are critical and that the dimensions must be the same length and we must have consistent arguments. And here we have the product of the first vector with the product of the second vector and then we add them all together.

Kunal Haria
Data Science Trainer
Students
627
Labs
1
Courses
11
Learning Paths
1

Kunal has worked with data for most of his career, ranging from diffusion markov chain processes to migrating reporting platforms.

Kunal has helped clients with early stage engagement and formed multi week training programme curriculum.

Kunal has a passion for statistics and data; he has delivered training relating to Hypothesis Testing, Exploring Data, Machine Learning Algorithms, and the Theory of Visualisation.

Data Scientist at a credit management company; applied statistical analysis to distressed portfolios.

Business Data Analyst at an investment bank; project to overhaul the legacy reporting and analytics platform.

Statistician within the Government Statistical Service; quantitative analysis and publishing statistical findings of emerging levels of council tax data.

Structured Credit Product Control at an investment bank; developing, maintaining, and deploying a PnL platform for the CVA Hedging trading desk.