Description Usage Arguments Value Author(s) References Examples
Extracts (possibly overlapping) rows provided both a pattern or index position to match and a range specifying how many rows before and after the matched row.
1 |
data |
The input |
pattern |
Either the pattern to match in the |
range |
A vector indicating the range of rows you want to extract (in
the form of |
isNumeric |
Logical. Is |
A list
of data.frame
s with the relevant rows
extracted.
Ananda Mahto
http://stackoverflow.com/a/13155669/1270695
1 2 3 4 5 6 7 8 9 | set.seed(1)
dat1 <- data.frame(ID = 1:25, V1 = sample(100, 25, replace = TRUE))
rownames(dat1) <- paste("rowname", sample(apply(combn(LETTERS[1:4], 2),
2, paste, collapse = ""),
25, replace = TRUE),
sprintf("%02d", 1:25), sep = ".")
getMyRows(dat1, c(2, 10), -3:2)
getMyRows(dat1, c("AB", "AC"), -1:1, FALSE)
getMyRows(dat1, c("AB", "AC"), c(-1, 1), FALSE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.