- Home
- Training Library
- Big Data
- Courses
- 6. Functions in R

# Named arguments of functions in R

## Contents

###### Fundamentals of R

## The course is part of this learning path

**Difficulty**Intermediate

**Duration**27m

**Students**21

**Ratings**

### Description

**Course Description**

This module looks at functions, how to create functions, and how they can be used in R.

**Learning Objectives**

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

- How to define a function in R
- How to use built in functions in R
- What a return value is
- That functions can be stacked, and that they do not require an input
- That arguments can be named or

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

Understanding 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.

### Transcript

- [Instructor] Functions have arguments. What arguments does say for example, the factor function take? We can use the args function on the factor function. This tells us that this function has one input called X, second input called levels, a third called labels, and so. We can pass arguments by tag which means that we call or pass them by their names. So, this has a downside and upside the negative being that we need to know all of the arguments the upside being that we can call the names in any order. Say for example, I had defined a factor of the I knew the names and I call them as being X, levels, labels, ordered, true, And that returns the factor to the screen. I could have used partial calling whereby I am matching up to the number of letters given. So let's say I had inputted in this factor again, but instead chose to drop off a couple of letters from each of my different factors, inputs, I can still see that are smart enough to pick up what I have entered and recognizes that the labels are defined by this B dollar and S. There is the potential for error in the instance where tags are not differentiated by partial names. Let's say I continue this journey of removing that is to help simplify my piece of code, I would see that there is a issue where the L for labels and levels overlaps and such that the tags are not differentiated sufficiently. So an error has arrived on the screen. We can pass arguments by position. It's useful when the arguments have an obvious interpretation. Say for example, in the instance that I had my whole labels and I could remove the names because we know their positions. However having seen the factor function you've now come to get used to what the T represents but if you had not seen the build up of this function, how would you know what this T represented?

**Students**356

**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.