diff --git a/03-programming.Rmd b/03-programming.Rmd index a008aec..bc54aa9 100644 --- a/03-programming.Rmd +++ b/03-programming.Rmd @@ -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