| GammaSpectra-class {gamma} | R Documentation |
An S4 Class to Represent a Collection of Gamma Sectra
Description
Represents a collection of spectra of gamma ray spectrometry measurements.
Details
This class extends the base list and can only contains
GammaSpectrum objects.
Access
In the code snippets below, x is a GammaSpectra object.
length(x)Get the number of elements in
x.lengths(x)Get the number of channels in each element of
x.get_names(x),set_names(x) <- valueRetrieves or sets the names of
xaccording tovalue.get_hash(x)Get the MD5 hash of the raw data files.
get_channels(x)Get the number of channels in each element of
x.get_counts(x)Get the counts of each element of
x.get_energy(x)Get the energy range of each element of
x.get_rates(x)Get the count rates of each element of
x.
Subset
In the code snippets below, x is a GammaSpectra object.
x[i]Extracts the elements selected by subscript
i.ican bemissingorNULL,numericorcharactervector or afactor. Returns a newGammaSpectraobject.x[i, j]Like the above but allows to select a slot thru
j(see examples).jis acharactervector of length one. Returns alist.x[[i]]Extracts the elements selected by subscript
i.ican be anumericorcharactervector of length one. Returns the corresponding GammaSpectrum object.
Author(s)
N. Frerebeau
See Also
Other class:
Baseline-class,
CalibrationCurve-class,
GammaSpectrum-class,
PeakPosition-class,
coerce()
Examples
## Import all CNF files in a given directory
spc_dir <- system.file("extdata/BDX_LaBr_1/calibration", package = "gamma")
(spc <- read(spc_dir))
## Access
get_hash(spc)
get_names(spc)
get_livetime(spc)
get_realtime(spc)
lengths(spc)
range_energy(spc)
## Subset
spc[] # All spectra
spc[NULL] # All spectra
spc[1] # The first spectrum
spc[-6] # Delete the sixth spectrum
spc[1:3] # The first three spectra
spc[c(1, 3)] # The first and third spectra
spc["BRIQUE"] # The spectrum named 'BRIQUE'
spc[c("BRIQUE", "C347")] # The spectra named 'BRIQUE' and 'C347'
spc[1:3, "energy"] # The slot 'energy' of the first three spectra
spc[[1]]
spc[["BRIQUE"]]