RcppCNPy

RcppCNPy: Read-Write Support for NumPy Files in R - Published in JOSS (2016)

https://github.com/eddelbuettel/rcppcnpy

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

c-plus-plus cran numpy r r-package
Last synced: 6 months ago · JSON representation

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
c-plus-plus cran numpy r r-package
Created about 12 years ago · Last pushed 11 months ago
Metadata Files
Readme Changelog License

README.md

RcppCNPy: Rcpp bindings for NumPy files

CI License CRAN Dependencies Downloads Last Commit
status DOI

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

JOSS Publication

RcppCNPy: Read-Write Support for NumPy Files in R
Published
September 25, 2016
Volume 1, Issue 5, Page 55
Authors
Dirk Eddelbuettel ORCID
Debian and R Projects
Wush Wu ORCID
Institute of Electrical Engineering, National Taiwan University
Editor
Christopher R. Madan ORCID
Tags
NumPy data transfer

GitHub Events

Total
  • Watch event: 3
  • Push event: 2
Last Year
  • Watch event: 3
  • Push event: 2

Committers

Last synced: 7 months ago

All Time
  • Total Commits: 170
  • Total Committers: 5
  • Avg Commits per committer: 34.0
  • Development Distribution Score (DDS): 0.082
Past Year
  • Commits: 4
  • Committers: 1
  • Avg Commits per committer: 4.0
  • Development Distribution Score (DDS): 0.0
Top Committers
Name Email 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'

  • Versions: 16
  • Dependent Packages: 1
  • Dependent Repositories: 1
  • Downloads: 660 Last month
  • Docker Downloads: 205
Rankings
Forks count: 4.6%
Stargazers count: 10.2%
Dependent packages count: 18.1%
Average: 18.4%
Dependent repos count: 23.9%
Docker downloads count: 25.7%
Downloads: 27.9%
Maintainers (1)
Last synced: 6 months ago

Dependencies

DESCRIPTION cran
  • R >= 3.1.0 depends
  • Rcpp * imports
  • methods * imports
  • pinp * suggests
  • reticulate * suggests
.github/workflows/ci.yaml actions
  • actions/checkout v3 composite