Skip to Main Content
R Programming for Actuarial Science
book

R Programming for Actuarial Science

by Peter McQuire, Alfred Kume
October 2023
Intermediate to advanced content levelIntermediate to advanced
640 pages
16h 23m
English
Wiley
Content preview from R Programming for Actuarial Science

2 Functions in R

Peter McQuire

2.1 Introduction

2.1.1 Objectives

The objective of this chapter is to introduce the reader to using functions in R. We will, briefly, look at using some of the most important basic R functions, then proceed to write our own functions. It is expected that this chapter, together with Chapter 1, will be one of the first read by most users of this book. It provides a simple introduction to using R for the first-time user and provides material which is likely to be fundamental in future R programming.

There are generally three types of functions we encounter in R:

  • Core functions,
  • Package functions, and
  • User Defined functions

This chapter is split into two main sections: the first introduces pre-defined functions (Core functions and Package functions), and the second part introduces user-defined functions. We complete the chapter with a section which covers two commonly used functions: for and integrate - used to write loops and perform integration in R.

Please note that it is assumed throughout this chapter that the reader is new to programming. There may also be a small amount of repetition of some material from Chapter 1.

2.1.2 Core and Package Functions

Core functions in R are immediately available to use when the R programming language is first downloaded onto your computer. In addition there is a huge number of functions written by other R users which exist in packages. To use these functions we must first install and load the relevant package ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Computational Actuarial Science with R

Computational Actuarial Science with R

Arthur Charpentier

Publisher Resources

ISBN: 9781119754978Purchase Link