High-powered framework for cross-validation. Fold your data like it’s paper!

Authors: Jeremy Coyle and Nima Hejazi


origami is an R package that provides a general framework for the application of cross-validation schemes to particular functions. By allowing arbitrary lists of results, origami accommodates a range of cross-validation applications.


For standard use, we recommend installing the package from CRAN via

You can install a stable release of origami from GitHub via devtools with:



For details on how best to use origami, please consult the package documentation and introductory vignette online, or do so from within R.


This minimal example shows how to use origami to apply cross-validation to the computation of a simple descriptive statistic using a sample data set. In particular, we obtain a cross-validated estimate of the mean:

For details on how to write wrappers (cv_funs) for use with origami::cross_validate, please consult the documentation and vignettes that accompany the package.


If you encounter any bugs or have any specific feature requests, please file an issue.


It is our hope that origami will grow to be adopted as a backend for most any procedure requiring cross-validation, including its integration into larger machine learning frameworks. To that end, contributions are very welcome, though we ask that interested contributors consult our contribution guidelines prior to submitting a pull request.


After using the origami R package, please cite it:

      author = {Coyle, Jeremy R and Hejazi, Nima S},
      title = {origami: A Generalized Framework for Cross-Validation in R},
      journal = {The Journal of Open Source Software},
      volume = {3},
      number = {21},
      month = {January},
      year  = {2018},
      publisher = {The Open Journal},
      doi = {10.21105/joss.00512},
      url = {https://doi.org/10.21105/joss.00512}


© 2017-2018 Jeremy R. Coyle

The contents of this repository are distributed under the GPL-3 license. See file LICENSE for details.