Description Usage Arguments Value Examples
Inspired by python's operator.itemgetter
. Mostly useful for use with *apply functions.
1 |
... |
arbitrary indices passed to '[[' or '[' |
A function.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | List <- list(1, 2:3)
Df <- data.frame(x=1, y=2:3)
Mat <- data.matrix(Df)
ix <- Itemgetter(2)
ix(List)
ix(Df)
ix(Mat)
ix <- Itemgetter(1:2)
ix(List)
ix(Df)
ix(Mat)
ix <- Itemgetter(2, 2)
ix(Df)
ix(Mat)
ix <- Itemgetter(2, 1:2)
ix(Df)
ix(Mat)
ix <- Itemgetter(2, "y")
ix(Df)
ix(Mat)
ix <- Itemgetter(2, TRUE)
ix(Df)
ix(Mat)
ix <- Itemgetter(2, 2, drop=FALSE)
ix(Df)
ix(Mat)
ix <- Itemgetter("y")
ix(Df)
Map(Itemgetter(2), list(List, Df, Mat))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.