Skip to content

Commit afefa54

Browse files
committed
Minor code styling changes
1 parent 5abb88a commit afefa54

File tree

4 files changed

+11
-4
lines changed

4 files changed

+11
-4
lines changed

_freeze/posts/16-functions/index/execute-results/html.json

Lines changed: 2 additions & 2 deletions
Large diffs are not rendered by default.

_freeze/posts/17-loop-functions/index/execute-results/html.json

Lines changed: 3 additions & 2 deletions
Large diffs are not rendered by default.

posts/16-functions/index.qmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,10 @@ This may be confusing at first, but it's really handy when doing interactive wor
269269
So, in the following call to `rnorm()`
270270

271271
```{r}
272+
## structure of the object
272273
str(rnorm)
274+
## or arguments of the function
275+
args(rnorm)
273276
mydata <- rnorm(100, 2, 1) ## Generate some data
274277
```
275278

posts/17-loop-functions/index.qmd

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,13 +107,16 @@ That is, we don't write a `for` loop that takes each element of `x` and each ele
107107
```{r}
108108
## Check that x and y have the same length
109109
stopifnot(length(x) == length(y))
110+
110111
## Create our result object
111112
result <- vector(mode = "integer", length = length(x))
113+
112114
## Loop through each element of x and y, calculate the sum,
113115
## then store it on 'result'
114116
for (i in seq_along(x)) {
115117
result[i] <- x[i] + y[i]
116118
}
119+
117120
## Check that we got the same answer
118121
identical(result, x + y)
119122
```

0 commit comments

Comments
 (0)