Skip to content

Commit

Permalink
updated loop slides
Browse files Browse the repository at this point in the history
  • Loading branch information
RedondoMA committed Oct 29, 2024
1 parent e17ab33 commit 22ef018
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions slide_r_elements_4.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -444,8 +444,8 @@ Let's see a simple example of a function to add one to a number:

```{r functions1, echo=T,error=T}
add.one <- function(arg1) {
arg1 <- arg1 + 1
return(arg1)
result <- arg1 + 1
return(result)
}
add.one(1)
```
Expand All @@ -460,8 +460,8 @@ Sometimes, it is good to use default values for some arguments:

```{r functions2, echo=T, error=T}
add.a.num <- function(arg, num=1) {
arg <- arg + num
return(arg)
result <- arg + num
return(result)
}
add.a.num(1) # skip the num argument
Expand Down

0 comments on commit 22ef018

Please sign in to comment.