6. Functions in R

Developed with
QA

The course is part of this learning path

Fundamentals of R
course-steps
11
certification
3
lab-steps
1
description
1
play-arrow
Introduction to functions in R
Overview
DifficultyIntermediate
Duration27m
Students24
Ratings
3/5
starstarstarstar-borderstar-border

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] Let us start, by answering what a function is in mathematics. A function in mathematics is a relationship or a mapping, from a set of inputs to a set of possible outputs. Each input is related to each output. For example, If i was to create a function of adding by 10, with an input of the numbers one to 10. I could have say for example, an output of 11 to 20. Whilst functions in computer science, are more like a procedure or a recipe of actions, that produce some output. For example, converting from Fahrenheit to Centigrade. And if i was to run this function. So why would we use functions? We might use them to avoid repetition. We might use them to make code, easier to understand. Perhaps using evocative names. Names that are helpful and meaningful, for example f2c. It's fairly well named, if, we knew the environment with which that function We'll be used, converting Fahrenheit to centigrade. Functions allow us to, update code in one function and affects multiple use cases. Functions help mitigate, issues such as copying code or replicating code errors or mistakes. By having just one function, we can update that code, will fix an error and affect all uses of a function.

About the Author
Students400
Labs1
Courses11
Learning paths1

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.