rxylib (version 0.2.12)

read_xyData: Import xy-Data for Supported Formats into R

Description

The function provides access to the underlying xylib to import data for supported file formats into R. In most cases, only the file path is needed with further arguments to import the data. The function automatically recognises allowed formats. See rxylib-package for supported formats.

Usage

read_xyData(file, options = "", verbose = TRUE, metaData = TRUE)

Value

The functions returns a list of matrices.

Arguments

file

character (required): path and file to be imported. The argument accepts an URL. Can be character vector or a list of characters.

options

character (with default): set format options (see rxylib-package)

verbose

logical (with default): enables/disables verbose mode

metaData

logical (with default): enables/disables the export of metadata

Function version

0.3.0

Author

Sebastian Kreutzer, Institute of Geography, Ruprecht-Karl-University of Heidelberg (Germany), Johannes Friedrich, University of Bayreuth (Germany)

How to cite

Kreutzer, S., Friedrich, J., 2023. read_xyData(): Import xy-Data for Supported Formats into R. Function version 0.3.0. In: Kreutzer, S., Friedrich, J., 2023. rxylib: Import XY-Data into R . R package version 0.2.12. https://github.com/R-Lum/rxylib

Examples

Run this code

##load example dataset
file <- system.file("extdata/ExampleSpectrum.CNF", package = "rxylib")
results <- read_xyData(file)
results

##plot xy-spectrum
plot(results,
 type = "l",
 xlab = "Energy [keV]",
 ylab = "Counts",
 main = "Thorite - 1800 s")

mtext(side = 3, "Canberra Inspector 1000, 3 x 3 NaI probe")

##plot contour for TL-spectrum
##imported from an XSYG-file
spectrum <- read_xyData(system.file("extdata/TLSpectrum.xsyg", package = "rxylib"))
contour(
 x = spectrum$dataset[[1]]$data_block[,1],
 y = 1:ncol(spectrum$dataset[[1]]$data_block[,-1]),
 z = spectrum$dataset[[1]]$data_block[,-1],
 xlab = "Wavelength [nm]",
 ylab = "#Channel",
 main = "TL Spectrum")

Run the code above in your browser using DataLab