- Home
- Training Library
- Big Data
- Courses
- 3. Beginner Data Structures in R

# Infinity in R

## Contents

###### Fundamentals of R

## The course is part of this learning path

**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, and 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**

We welcome all feedback and suggestions - please contact us at qa.elearningadmin@qa.com to let us know what you think.

Infinity arises in undefined situations in mathematical calculations such as one divided by zero, or for a very large number, 10 raised to the power of a million, for example. Can I take my infinity and return back to a small number like zero? One divided by infinity. I can do this if it was negative infinity or positive infinity. How does R handle mathematical calculations involving infinity? Infinity plus infinity returns infinity. Plus infinity divided by infinity returns, not a number. Now this is because there are different scales of infinity, mathematically speaking, and thus R will turn around and return NAN, for Not A Number, to inform us that this calculation doesn't make sense.

What about calculations involving finite numbers and infinity? So, infinity plus two, for example. That will just return infinity again. I could repeat that for, instead of addition, I could change it to multiplication, and for arguments sake, I could change this to negative infinity instead of plus infinity. So where we have arithmetic with simple infinite numbers and finite numbers, we return infinite numbers.

Is there a way to check if a number is finite or not in advance of pushing it to the output device? We can ask using the Is Infinite function whether or not infinity, or any input, is finite or not. Say for example, I chuck in infinite plus two, it will still be infinity. If I ask for, Is Finite On the number two, I receive back as a return, False.

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.