Description Usage Arguments Value Examples
View source: R/stream_provenance.R
Streams processed provenance log into writable connection .
1 2 3 | stream_provenance(con, process_func = function(x, version_id,
line_number_offset) { x }, version_iter = version_history_iter(),
n = -1L, line_batch_size = 1)
|
con |
the connection (e.g., file) to write into after being processed by process_func |
process_func |
a function that processes provenance lines |
version_iter |
an provenance version iterator @seealso version_history_iter() |
n |
maximum number of (processed) lines to write, -1 means unlimited |
line_batch_size |
number of lines to be processed at once |
number of written (processed) lines
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # open an temporary read/write connection
con <- fifo("", open = "w+b")
stream_provenance(con, n = 1)
first_line_first_provenance_log <- readLines(con)
close(con)
# open file
con <- file("somefile.txt", open = "w+b")
versions_only = function(lines) {
lines[grepl("hasVersion", lines)]
}
# save only provenance lines with "hasVersion" in it
stream_provenance(con, process_func = versions_only, n = 1)
first_version_in_provenance_log <- readLines(con)
close(con)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.