Description Usage Arguments Examples

Extract with `[`

on a specified dimension

1 2 3 4 5 | ```
extract_dim(X, which_dim, idx, drop = NULL, depth = Inf)
extract_rows(X, idx, drop = NULL, depth = Inf)
extract_cols(X, idx, drop = NULL, depth = Inf)
``` |

`X` |
Typically, an array, but any object with a |

`which_dim` |
A scalar integer or character, specifying the dimension to extract from |

`idx` |
A numeric, boolean, or character vector to perform subsetting with. |

`drop` |
Passed on to |

`depth` |
Scalar number, how many levels to recurse down if |

1 2 3 4 5 6 7 8 9 10 11 12 13 14 | ```
# extract_rows is useful to keep the same code path for arrays of various sizes
X <- array(1:8, c(4, 3, 2))
y <- c("a", "b", "c", "d")
(Y <- onehot(y))
extract_rows(X, 2)
extract_rows(Y, 2)
extract_rows(y, 2)
library(zeallot)
c(X2, Y2, y2) %<-% extract_rows(list(X, Y, y), 2)
X2
Y2
y2
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.