{"id":15735300,"url":"https://github.com/eddelbuettel/rcppcnpy","last_synced_at":"2025-04-07T17:11:37.860Z","repository":{"id":12181149,"uuid":"14781707","full_name":"eddelbuettel/rcppcnpy","owner":"eddelbuettel","description":"Rcpp bindings for NumPy files","archived":false,"fork":false,"pushed_at":"2025-03-14T23:39:57.000Z","size":3401,"stargazers_count":27,"open_issues_count":3,"forks_count":15,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-31T12:09:24.181Z","etag":null,"topics":["c-plus-plus","cran","numpy","r","r-package"],"latest_commit_sha":null,"homepage":null,"language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/eddelbuettel.png","metadata":{"files":{"readme":"README.md","changelog":"ChangeLog","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-11-28T16:28:26.000Z","updated_at":"2025-03-14T23:40:00.000Z","dependencies_parsed_at":"2024-06-11T17:04:11.830Z","dependency_job_id":"5bf65268-98c1-4dc6-8827-70aab090a3ae","html_url":"https://github.com/eddelbuettel/rcppcnpy","commit_stats":{"total_commits":168,"total_committers":5,"mean_commits":33.6,"dds":0.08333333333333337,"last_synced_commit":"7ffaefd0ecf724d59dbd39e6f0886f81bbab0cd0"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppcnpy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppcnpy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppcnpy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eddelbuettel%2Frcppcnpy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eddelbuettel","download_url":"https://codeload.github.com/eddelbuettel/rcppcnpy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247694877,"owners_count":20980733,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["c-plus-plus","cran","numpy","r","r-package"],"created_at":"2024-10-04T01:12:06.935Z","updated_at":"2025-04-07T17:11:37.822Z","avatar_url":"https://github.com/eddelbuettel.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"## RcppCNPy: Rcpp bindings for NumPy files\n\n[![CI](https://github.com/eddelbuettel/rcppcnpy/workflows/ci/badge.svg)](https://github.com/eddelbuettel/rcppcnpy/actions?query=workflow%3Aci)\n[![License](http://img.shields.io/badge/license-GPL%20%28%3E=%202%29-brightgreen.svg?style=flat)](http://www.gnu.org/licenses/gpl-2.0.html) \n[![CRAN](https://www.r-pkg.org/badges/version/RcppCNPy)](https://cran.r-project.org/package=RcppCNPy) \n[![Dependencies](https://tinyverse.netlify.app/badge/RcppCNPy)](https://cran.r-project.org/package=RcppCNPy) \n[![Downloads](https://cranlogs.r-pkg.org/badges/RcppCNPy?color=brightgreen)](https://www.r-pkg.org:443/pkg/RcppCNPy) \n[![Last Commit](https://img.shields.io/github/last-commit/eddelbuettel/rcppcnpy)](https://github.com/eddelbuettel/rcppcnpy)  \n[![status](https://joss.theoj.org/papers/10.21105/joss.00055/status.svg)](https://joss.theoj.org/papers/10.21105/joss.00055) \n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.155066.svg)](https://doi.org/10.5281/zenodo.155066)\n\n### About\n\nThis package uses the [cnpy](https://github.com/rogersce/cnpy) library\nwritten by Carl Rogers to provide read and write facilities for files created\nwith (or for) the NumPy extension for Python.  Vectors and matrices of\nnumeric types can be read or written to and from files as well as compressed\nfiles. Support for integer files is available if the package has been built\nwith `-std=c++11` which is the default starting with release 0.2.3 following\nthe release of R 3.1.0, and available on all platforms following the release\nof R 3.3.0 with the updated 'Rtools'.\n\n### Example\n\nThe following Python code\n\n```{.python}\n\u003e\u003e\u003e import numpy as np\n\u003e\u003e\u003e fm = np.arange(12).reshape(3,4) * 1.1\n\u003e\u003e\u003e fm\narray([[  0. ,   1.1,   2.2,   3.3],\n       [  4.4,   5.5,   6.6,   7.7],\n       [  8.8,   9.9,  11. ,  12.1]])\n\u003e\u003e\u003e np.save(\"fmat.npy\", fm)\n\u003e\u003e\u003e \n\u003e\u003e\u003e im = np.arange(12).reshape(3,4)\n\u003e\u003e\u003e im\narray([[ 0,  1,  2,  3],\n       [ 4,  5,  6,  7],\n       [ 8,  9, 10, 11]])\n\u003e\u003e\u003e np.save(\"imat.npy\", im)\n\u003e\u003e\u003e \n```\n\nsaves two matrices in floating-point and integer representation.\n\nWith this R code we can read and assign the files:\n\n```{.r}\nR\u003e library(RcppCNPy)\nR\u003e fmat \u003c- npyLoad(\"fmat.npy\")\nR\u003e fmat\n     [,1] [,2] [,3] [,4]\n[1,]  0.0  1.1  2.2  3.3\n[2,]  4.4  5.5  6.6  7.7\n[3,]  8.8  9.9 11.0 12.1\nR\u003e \nR\u003e imat \u003c- npyLoad(\"imat.npy\", \"integer\")\nR\u003e imat\n     [,1] [,2] [,3] [,4]\n[1,]    0    1    2    3\n[2,]    4    5    6    7\n[3,]    8    9   10   11\nR\u003e \n```\n\nGoing the opposite way by saving in R and reading in Python works equally\nwell. An extension not present in [CNPy](https://github.com/rogersce/cnpy)\nallows reading and writing of gzip-compressed files.\n\nThe package has been tested and used on several architecture, and copes\ncorrectly with little-vs-big endian switches.\n\nMore details are available in the [package vignette](https://cran.r-project.org/package=RcppCNPy/vignettes/RcppCNPy-intro.pdf).\n\n### Installation\n\nThe package is on [CRAN](https://cran.r-project.org) and can be installed per:\n\n```{r}\nR\u003e install.packages(\"RcppCNPy\")\n```\n\n### Status\n\nOn [CRAN](https://cran.r-project.org/package=RcppCNPy), stable and mostly\nfeature-complete.\n\n### Alternative: [reticulate](https://github.com/rstudio/reticulate)\n\nThe [reticulate](https://github.com/rstudio/reticulate) package can also provide easy and comprehensive access\nto NumPy data; see the \n[additional vignette in RcppCNPy](https://cran.r-project.org/package=RcppCNPy/vignettes/UsingReticulate.pdf) \nfor examples and more details.\n\n### Feedback\n\nContributions are welcome, please use the GitHub\n[issue tracker](https://github.com/eddelbuettel/rcppcnpy/issues) for\nbug reports, feature requests or general discussions before sending\n[pull requests](https://github.com/eddelbuettel/rcppcnpy/pulls).\n\n### Author\n\nDirk Eddelbuettel and Wush Wu\n\n### License\n\nGPL (\u003e= 2)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddelbuettel%2Frcppcnpy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feddelbuettel%2Frcppcnpy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feddelbuettel%2Frcppcnpy/lists"}