Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/r-lum/rxylib

R package: wrapper for the C++ library `xylib`
https://github.com/r-lum/rxylib

data-import diffraction-analysis gamma-ray-spectrometry powder-diffraction r rpackage

Last synced: 9 days ago
JSON representation

R package: wrapper for the C++ library `xylib`

Awesome Lists containing this project

README

        

---
output: github_document
header-includes:
- \usepackage{amsmath}
- \usepackage{amssymb}
---

```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
library(rxylib)
```

# rxylib

The **R** package `rxylib` provides and access to the C++ library [xylib](https://xylib.sourceforge.net)
by wrapping the library using Rcpp. For supported data formats see https://github.com/wojdyr/xylib.

[![CRAN](https://www.r-pkg.org/badges/version/rxylib)](https://CRAN.R-project.org/package=rxylib)
[![Downloads](https://cranlogs.r-pkg.org/badges/grand-total/rxylib)](https://www.r-pkg.org/pkg/rxylib)
[![R-CMD-check](https://github.com/R-Lum/rxylib/workflows/GitHub Actions CI/badge.svg)](https://github.com/R-Lum/rxylib/actions)
[![DOI](https://zenodo.org/badge/95584252.svg)](https://zenodo.org/badge/latestdoi/95584252)
[![CRAN DOI](https://img.shields.io/badge/DOI-10.32614/CRAN.package.rxylib-1f57b6?style=flat&link=https://doi.org/10.32614/CRAN.package.rxylib)](https://doi.org/10.32614/CRAN.package.rxylib)
[![codecov](https://codecov.io/gh/R-Lum/rxylib/branch/master/graph/badge.svg?token=is1ADF98pO)](https://app.codecov.io/gh/R-Lum/rxylib)

## Installation

#### i. Requirements

* *Windows (32/64bit)*: [Rtools](https://cran.r-project.org/bin/windows/Rtools/) (provided by CRAN)
* *macOS*: [Xcode](https://developer.apple.com/xcode/)
* *Linux*: [gcc](https://gcc.gnu.org) often comes pre-installed in most distributions.

#### ii. Install the package (development version)

To install the stable version from CRAN, simply run the following from an R console:

```r
install.packages("rxylib")
```

To install the latest development builds directly from GitHub, run

```r
if(!require("devtools"))
install.packages("devtools")
devtools::install_github("R-Lum/rxylib@master")
```
To install a developer build other than `'master'`, replace the term `'master'` in the code line by the name of the wanted developer build.

## Related projects

* [rxylibShiny](https://github.com/JohannesFriedrich/rxylibShiny)

# Licenses

Please note that the package uses two different licences

## Package `rxylib` license

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
[GNU General Public License](https://github.com/R-Lum/rxylib/blob/master/LICENSE) for more details.

## Library `xylib` license

The library itself is **NOT** part of the GPL-3 license conditions of the package
and available under [LGPL](https://github.com/wojdyr/xylib/blob/master/COPYING)
license conditions only cf. https://github.com/wojdyr/xylib

## Funding

* Between 2017-2019, the work of Sebastian Kreutzer as maintainer of the package was supported
by LabEx LaScArBx (ANR - n. ANR-10-LABX-52).

* From 01/2020-04/2022, Sebastian Kreutzer received funding from the European Union’s Horizon 2020
research and innovation programme under the Marie Skłodowska-Curie grant
agreement No [844457 (project: CREDit)](https://cordis.europa.eu/project/id/844457).

* Since 03/2023, Sebastian Kreutzer as maintainer of the package receives funding from the DFG
Heisenberg programme No [505822867](https://gepris.dfg.de/gepris/projekt/505822867).

```{r, echo=FALSE}
### ==========================================================================================
### Write supported formats into the manual page
### [email protected]
### 2019-05-08
### ==========================================================================================

##run only if not already there (otherwise we create it two time)
if(!any(
grepl(
pattern = "library version:",
x = readLines("man/rxylib-package.Rd", warn = FALSE), fixed = TRUE, useBytes = TRUE))){

## this script adds all allowed formats to the produced package manual
##get format list
formats <- rxylib:::get_supportedFormats()

##create data frame
preheader <- paste0("\\cr library version: ", rxylib:::get_version(), "\\cr\\cr")
header <- "\\tabular{lllllll}{\\bold{ID} \\tab \\bold{NAME} \\tab \\bold{DESCRIPTION} \\tab \\bold{FILE EXTENSION} \\tab \\bold{VALID_OPTIONS} \\tab \\bold{DATATYPE} \\tab \\bold{BLOCK_TYPE}\\cr"
footer <- " \\tab \\tab }"
main <- vapply(1:length(formats$name), function(x){
paste0(
"[",x,",]"," \\tab ",
formats$name[x],
" \\tab ",
formats$desc[x],
" \\tab ",
formats$exts[x],
" \\tab ",
formats$valid_options[x],
" \\tab ",
formats$binary[x],
" \\tab ",
formats$multiblock[x],
"\\cr"

)

}, vector(mode = "character", length = 1))

##table
table <- c(preheader, header, main, footer)

##read RD file
file <- readLines("man/rxylib-package.Rd")
insert_id <- grep(pattern = "Supported data formats", file, fixed = TRUE)

##output
writeLines(
text = c(file[1:insert_id], table, file[(insert_id + 1):length(file)]),
con = "man/rxylib-package.Rd")
}
```