RcppCNPy
RcppCNPy: Read-Write Support for NumPy Files in R - Published in JOSS (2016)
Science Score: 93.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
✓DOI references
Found 6 DOI reference(s) in README and JOSS metadata -
✓Academic publication links
Links to: joss.theoj.org, zenodo.org -
○Committers with academic emails
-
○Institutional organization owner
-
✓JOSS paper metadata
Published in Journal of Open Source Software
Keywords
Repository
Rcpp bindings for NumPy files
Basic Info
- Host: GitHub
- Owner: eddelbuettel
- License: gpl-2.0
- Language: C++
- Default Branch: master
- Size: 3.25 MB
Statistics
- Stars: 30
- Watchers: 3
- Forks: 15
- Open Issues: 3
- Releases: 0
Topics
Metadata Files
README.md
RcppCNPy: Rcpp bindings for NumPy files
About
This package uses the cnpy library
written by Carl Rogers to provide read and write facilities for files created
with (or for) the NumPy extension for Python. Vectors and matrices of
numeric types can be read or written to and from files as well as compressed
files. Support for integer files is available if the package has been built
with -std=c++11 which is the default starting with release 0.2.3 following
the release of R 3.1.0, and available on all platforms following the release
of R 3.3.0 with the updated 'Rtools'.
Example
The following Python code
```{.python}
import numpy as np fm = np.arange(12).reshape(3,4) * 1.1 fm array([[ 0. , 1.1, 2.2, 3.3], [ 4.4, 5.5, 6.6, 7.7], [ 8.8, 9.9, 11. , 12.1]]) np.save("fmat.npy", fm)
im = np.arange(12).reshape(3,4) im array([[ 0, 1, 2, 3], [ 4, 5, 6, 7], [ 8, 9, 10, 11]]) np.save("imat.npy", im)
```
saves two matrices in floating-point and integer representation.
With this R code we can read and assign the files:
{.r}
R> library(RcppCNPy)
R> fmat <- npyLoad("fmat.npy")
R> fmat
[,1] [,2] [,3] [,4]
[1,] 0.0 1.1 2.2 3.3
[2,] 4.4 5.5 6.6 7.7
[3,] 8.8 9.9 11.0 12.1
R>
R> imat <- npyLoad("imat.npy", "integer")
R> imat
[,1] [,2] [,3] [,4]
[1,] 0 1 2 3
[2,] 4 5 6 7
[3,] 8 9 10 11
R>
Going the opposite way by saving in R and reading in Python works equally well. An extension not present in CNPy allows reading and writing of gzip-compressed files.
The package has been tested and used on several architecture, and copes correctly with little-vs-big endian switches.
More details are available in the package vignette.
Installation
The package is on CRAN and can be installed per:
{r}
R> install.packages("RcppCNPy")
Status
On CRAN, stable and mostly feature-complete.
Alternative: reticulate
The reticulate package can also provide easy and comprehensive access to NumPy data; see the additional vignette in RcppCNPy for examples and more details.
Feedback
Contributions are welcome, please use the GitHub issue tracker for bug reports, feature requests or general discussions before sending pull requests.
Author
Dirk Eddelbuettel and Wush Wu
License
GPL (>= 2)
Owner
- Name: Dirk Eddelbuettel
- Login: eddelbuettel
- Kind: user
- Location: Chicago, IL, USA
- Website: https://dirk.eddelbuettel.com
- Twitter: eddelbuettel
- Repositories: 512
- Profile: https://github.com/eddelbuettel
JOSS Publication
RcppCNPy: Read-Write Support for NumPy Files in R
Authors
Tags
NumPy data transferGitHub Events
Total
- Watch event: 3
- Push event: 2
Last Year
- Watch event: 3
- Push event: 2
Committers
Last synced: 7 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Dirk Eddelbuettel | e****d@d****g | 156 |
| Wush Wu | w****8@g****m | 9 |
| Romain François | r****n@r****m | 2 |
| Chris Kennedy | c****n@g****m | 2 |
| Garrett Mooney | g****y@g****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 16
- Total pull requests: 16
- Average time to close issues: 2 months
- Average time to close pull requests: 14 days
- Total issue authors: 15
- Total pull request authors: 7
- Average comments per issue: 5.19
- Average comments per pull request: 0.69
- Merged pull requests: 14
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 0
- Average time to close issues: N/A
- Average time to close pull requests: N/A
- Issue authors: 0
- Pull request authors: 0
- Average comments per issue: 0
- Average comments per pull request: 0
- Merged pull requests: 0
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
- JaySLee (2)
- eddelbuettel (1)
- andreasmeid (1)
- wush978 (1)
- cranedroesch (1)
- pierremac (1)
- bbogart (1)
- kwythers (1)
- mike-lawrence (1)
- mdnunez (1)
- jokedurnez (1)
- ryananeff (1)
- HomereAMK (1)
- aloboa (1)
- muellerflorian01 (1)
Pull Request Authors
- eddelbuettel (9)
- wush978 (2)
- arfon (1)
- jmarshallnz (1)
- romainfrancois (1)
- GarrettMooney (1)
- ck37 (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- cran 660 last-month
- Total docker downloads: 205
- Total dependent packages: 1
- Total dependent repositories: 1
- Total versions: 16
- Total maintainers: 1
cran.r-project.org: RcppCNPy
Read-Write Support for 'NumPy' Files via 'Rcpp'
- Homepage: https://github.com/eddelbuettel/rcppcnpy
- Documentation: http://cran.r-project.org/web/packages/RcppCNPy/RcppCNPy.pdf
- License: GPL-2 | GPL-3 [expanded from: GPL (≥ 2)]
-
Latest release: 0.2.13
published over 1 year ago
Rankings
Maintainers (1)
Dependencies
- R >= 3.1.0 depends
- Rcpp * imports
- methods * imports
- pinp * suggests
- reticulate * suggests
- actions/checkout v3 composite
