Skip to content

Commit

Permalink
Update 03-programming.Rmd (#288)
Browse files Browse the repository at this point in the history
Change variable name to be more consistent.
  • Loading branch information
tuberculo authored Aug 18, 2020
1 parent 490e35c commit 963d82a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion 03-programming.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,7 @@ row_sd = apply(ex_mat, 1, sd)
The first argument of `apply()` is the object of interest. The second argument is the `MARGIN`. This is a vector giving the subscripts which the function (the third argument) will be applied over. When the object is a matrix, a margin of `1` indicates rows and `2` indicates columns. So to calculate the column standard deviations, the second argument is changed to `2`

```{r, results="hide"}
col_med = apply(ex_mat, 2, sd)
col_sd = apply(ex_mat, 2, sd)
```

Additional arguments can be passed to the function that is to be applied to the data. For example, to pass the `na.rm` argument to the `sd` function, we have
Expand Down

0 comments on commit 963d82a

Please sign in to comment.