Skip to contents

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)

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

Value

The functions returns a list of matrices.

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., 2024. read_xyData(): Import xy-Data for Supported Formats into R. Function version 0.3.0. In: Kreutzer, S., Friedrich, J., 2024. rxylib: Import XY-Data into R . R package version 0.2.14.9000-2. https://r-lum.github.io/rxylib/

Examples


##load example dataset
file <- system.file("extdata/ExampleSpectrum.CNF", package = "rxylib")
results <- read_xyData(file)
#> [read_xyData()] File of type Canberra CNF detected ...
results
#> 
#> [rxylib-object]
#>   Imported format:	 Canberra CNF
#>   Imported blocks: 	 1
#>   Dataset has metadata:	 FALSE
#> 
#>   << block 1 : Thorit Kalibrierung >>
#>   .. $data_block 	 matrix : 2048 x 2
#>   .. $metadata_block 	 TRUE

##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"))
#> [read_xyData()] File of type Freiberg Instruments XSYG detected ...
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")