fromto | R Documentation |
This comes in handy to cut lines from a file read by readLines
.
fromto(
x,
from,
to,
from_i = 1,
to_i = 1,
shift_from = 0,
shift_to = 0,
remove_empty_item = TRUE
)
x |
A vector. |
from |
A pattern, use NA to start with the first item. |
to |
Another pattern, use NA to stop with the last item. |
from_i |
If the from pattern matches multiple times, which one is to be used. |
to_i |
Analogously to to_i. |
shift_from |
The number of items to shift from the item selected via from and from_i. |
shift_to |
Analogously to shift_from. |
remove_empty_item |
Remove empty items? |
The extracted vector.
Other searching functions:
compare_vectors()
,
file_modified_last()
,
find_files()
,
grep_file()
,
missing_docs
,
search_files()
,
search_rows()
,
summary.filesearch()
foo <- c("First", "f1", "A", "f2", rep("B", 4), "t1", "f3", "C", "t2",
rep("D", 4), "t3", "Last")
fromto(foo, "^f", "^t")
fromto(foo, NA, "^t")
fromto(foo, "^f", NA)
fromto(foo, "^f", "^t", from_i = 2)
fromto(foo, "^f", "^t", from_i = 2, to_i = 2)
fromto(foo, "^f", "^t", from_i = 2, to_i = 2, shift_from = 1, shift_to = -1)
fromto(foo, "^f", "^t", from_i = 2, to_i = 2, shift_from = -1, shift_to = 2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.