knitr::opts_chunk$set( collapse = TRUE, comment = NA )
Our objective is to compute the maximum intensity from selected elements from a penepma simulation of C-coated EagleXG glass. We have two functions: one reports the maximum primary intensity and the second reports the maximum total intensity.
First we get our example file stored in the package.
spcPath <- system.file("extdata", "pe-intens-01.dat", package = "rpenepma") spcPath
We create a tibble using the penepma_get_intensities
function.
library(rpenepma) tib <- penepma_get_intensities(spcPath)
print(nrow(tib))
print(names(tib))
Now we can make some useful computations...
C.p <- penepma_get_max_primary_intensity_z(tib, 6) Si.p <- penepma_get_max_primary_intensity_z(tib, 14) O.p <- penepma_get_max_primary_intensity_z(tib, 8) Ca.p <- penepma_get_max_primary_intensity_z(tib, 20)
C.t <- penepma_get_max_total_intensity_z(tib, 6) Si.t <- penepma_get_max_total_intensity_z(tib, 14) O.t <- penepma_get_max_total_intensity_z(tib, 8) Ca.t <- penepma_get_max_total_intensity_z(tib, 20)
First, the primary intensity. Note that penepma
does not report
the SNR
for the transitions, but we can easily compute and append
the value. The *_intensity_z
functions do this.
primInt <- dplyr::bind_rows(C.t, Si.t, O.t, Ca.t) print(primInt)
Prepend a sample ID
primInt <- prepend_sample_id_max_int_tib(primInt, "Eagle-XG") print(primInt)
Followed by the total intensity
totInt <- dplyr::bind_rows(C.t, Si.t, O.t, Ca.t) print(totInt)
Prepend a sample ID
totInt <- prepend_sample_id_max_int_tib(totInt, "Eagle-XG") print(totInt)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.