Description Usage Arguments Value Author(s) Examples
Parses a collection of elements into (almost) equal sized groups. Useful for splitting up an R job that operates over a large dataframe or list into multiple jobs.
1 2 |
n |
The number elements to be parsed |
njobs |
The number of groups |
collate |
|
random.seed |
An integer setting the random seed,
which will result in randomizing the elements among the
jobs. If |
text.to.eval |
If |
When text.to.eval = FALSE
, a list with njobs
elements is returned, each element containing a numeric
vector of the element numbers which correspond to that
group. When text.to.eval = TRUE
, a list with
njobs
elements is returned, each element containing
text (let's call it val
), that when evaluated using
eval(parse(text = val))
, will produce the sequence
of numbers corresponding to the group.
Landon Sego
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | x <- parseJob(29, 6)
print(x)
# To see the range of each group
lapply(x, range)
# To see the length of each group
lapply(x, length)
# Randomize the outcome
parseJob(32, 5, random.seed = 231)
# Example of text.to.eval
parseJob(11, 3, text.to.eval = TRUE)
lapply(parseJob(11, 3, text.to.eval = TRUE), function(x) eval(parse(text = x)))
# Example of collated and text.to.eval
parseJob(11, 3, collate = TRUE)
parseJob(11, 3, collate = TRUE, text.to.eval = TRUE)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.