https://github.com/vst/callfest
An R Package for calling functions over a combination of arguments
https://github.com/vst/callfest
Last synced: about 1 year ago
JSON representation
An R Package for calling functions over a combination of arguments
- Host: GitHub
- URL: https://github.com/vst/callfest
- Owner: vst
- Created: 2014-12-13T05:50:11.000Z (over 11 years ago)
- Default Branch: master
- Last Pushed: 2014-12-13T10:04:18.000Z (over 11 years ago)
- Last Synced: 2023-03-11T09:27:34.406Z (over 3 years ago)
- Language: R
- Homepage:
- Size: 125 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: changelog.sh
Awesome Lists containing this project
README
# callfest: An R Package for calling functions over a combination of arguments
`callfest` is a simple wrapper over your functions which consumes a
set of arguments, computes all combinations of these arguments and
invokes your function on each of the combinations.
It allows parallel invocations and computes the total elapsed time,
too.
Simply:
callfest(list, a=1:2, b=3:4)
will give you the list of all combinations:
[[1]]
[[1]]$a
[1] 1
[[1]]$b
[1] 3
[[2]]
[[2]]$a
[1] 2
[[2]]$b
[1] 3
[[3]]
[[3]]$a
[1] 1
[[3]]$b
[1] 4
[[4]]
[[4]]$a
[1] 2
[[4]]$b
[1] 4
You can see the elapsed time:
R> res <- callfest(list, a=1:2, b=3:4)
R> attr(res, "time")
user system elapsed
0 0 0
You can call the function more than once:
R> control <- callfestControl(list, N=2)
R> res <- callfest(control, a=1:2, b="a")
[[1]]
[[1]][[1]]
[[1]][[1]]$a
[1] 1
[[1]][[1]]$b
[1] a
Levels: a
[[1]][[2]]
[[1]][[2]]$a
[1] 1
[[1]][[2]]$b
[1] a
Levels: a
[[2]]
[[2]][[1]]
[[2]][[1]]$a
[1] 2
[[2]][[1]]$b
[1] a
Levels: a
[[2]][[2]]
[[2]][[2]]$a
[1] 2
[[2]][[2]]$b
[1] a
Levels: a
Elapsed 0.000000 seconds
Parallel computing is possible by passing `parallel=TRUE` to the
control object.