## Introduction

##### Monday, Aug 26

#### Learning objectives

- Understand statistical programming
- Why R?
- How this course will benefit you

#### Materials

## Fundamentals of R

##### Tuesday, Aug 27

#### Learning objectives

- Vectors as building blocks
- Vectorization and recycling
- Logical and comparison operators
- Conditional control flow
- Iteration with
`for`

,`while`

, and`repeat`

#### Materials

- Slides: HTML, Rmd, CSS
- Supplementary
- Sections 3.1 – 3.2 Advanced R
- Chapter 5 Advanced R

## Data types and functions

##### Thursday, Aug 29

#### Learning objectives

- Atomic vector manipulation
- Creating generic vectors
- Function writing best practices
- Four function forms
- Function scope and lazy evaluation
- Handling reserved words:
`Inf`

,`NaN`

,`NA`

#### Materials

- Slides: HTML, Rmd, CSS
- Supplementary
- Section 3.5 Advanced R
- Section 3.7 Advanced R
- Chapter 6 Advanced R

## Exercise of the week

Write a function called `seq_fib()`

. Function `seq_fib()`

should take one
argument, `n`

- an atomic numeric vector of length 1, and return the first `n`

Fibonacci numbers
as an atomic vector. Some examples of the function in
action are given below.

#### Valid inputs

```
seq_fib(n = 1)
seq_fib(n = 2)
seq_fib(n = 7)
seq_fib(n = 10)
```

```
## [1] 0
## [1] 0 1
## [1] 0 1 1 2 3 5 8
## [1] 0 1 1 2 3 5 8 13 21 34
```

#### Invalid inputs

```
seq_fib(n = -2)
```

```
## Error in seq_fib(n = -2): n >= 1 is not TRUE
```

```
seq_fib(n = c(2, 3, 10))
```

```
## Error in seq_fib(n = c(2, 3, 10)): length(n) == 1 is not TRUE
```

Did you remember to handle situations such as `seq_fib(n = 4.9)`

?