Skip to content

Commit

Permalink
Merge pull request #1668 from rstudio/add-nuclides-dataset
Browse files Browse the repository at this point in the history
Add the `nuclides` dataset
  • Loading branch information
rich-iannone authored May 18, 2024
2 parents 5ccf14d + 81343e6 commit c2ad313
Show file tree
Hide file tree
Showing 29 changed files with 3,668 additions and 12 deletions.
65 changes: 63 additions & 2 deletions R/datasets.R
Original file line number Diff line number Diff line change
Expand Up @@ -928,6 +928,67 @@
#'
"photolysis"

#' Nuclide data
#'
#' @description
#'
#' The `nuclides` dataset contains information on all known nuclides, providing
#' data on nuclear structure and decay modes across 118 elements. There is data
#' here on natural abundances, atomic mass, spin, half-life, and more. The
#' typical users for such a dataset include researchers in fields such as
#' nuclear physics, radiochemistry, and nuclear medicine.
#'
#' @format A tibble with 3,383 rows and 29 variables:
#' \describe{
#' \item{nuclide}{The symbol for the nuclide.}
#' \item{z, n}{The number of protons and neutrons.}
#' \item{element}{The element symbol.}
#' \item{radius, radius_uncert}{The charge radius and its associated
#' uncertainty. In units of fm.}
#' \item{abundance, abundance_uncert}{The abundance of the stable isotope as
#' a mole fraction (in relation to other stable isotopes of the same element).
#' Values are provided for the nuclide only if `is_stable` is `TRUE`.}
#' \item{is_stable}{Is the nuclide a stable isotope?}
#' \item{half_life, half_life_uncert}{The nuclide's half life represented as
#' seconds.}
#' \item{isospin}{The isospin, or the quantum number related to the up and down
#' quark content of the particle.}
#' \item{decay_1, decay_2, decay_3}{The 1st, 2nd, and 3rd decay modes.}
#' \item{decay_1_pct, decay_1_pct_uncert, decay_2_pct, decay_2_pct_uncert,
#' decay_3_pct, decay_3_pct_uncert}{The branching proportions for the 1st, 2nd,
#' and 3rd decays (along with uncertainty values).}
#' \item{magnetic_dipole, magnetic_dipole_uncert}{The magnetic dipole and its
#' associated uncertainty. Expressed in units of micro N, or nuclear
#' magneton values.}
#' \item{electric_quadrupole, electric_quadrupole_uncert}{The electric
#' quadrupole and its associated uncertainty. In units of barn (b).}
#' \item{atomic_mass, atomic_mass_uncert}{The atomic mass and its associated
#' uncertainty. In units of micro AMU.}
#' \item{mass_excess, mass_excess_uncert}{The mass excess and its associated
#' uncertainty. In units of keV.}
#' }
#'
#' @section Examples:
#'
#' Here is a glimpse at the data available in `nuclides`.
#'
#' ```{r}
#' dplyr::glimpse(nuclides)
#' ```
#'
#' @family datasets
#' @section Dataset ID and Badge:
#' DATA-14
#'
#' \if{html}{\out{
#' `r data_get_image_tag(file = "dataset_nuclides.png")`
#' }}
#'
#' @section Dataset Introduced:ı
#' *In Development*
#'
"nuclides"

#' An ADSL-flavored clinical trial toy dataset
#'
#' @description
Expand Down Expand Up @@ -987,7 +1048,7 @@
#'
#' @family datasets
#' @section Dataset ID and Badge:
#' DATA-14
#' DATA-15
#'
#' \if{html}{\out{
#' `r data_get_image_tag(file = "dataset_rx_adsl.png")`
Expand Down Expand Up @@ -1060,7 +1121,7 @@
#'
#' @family datasets
#' @section Dataset ID and Badge:
#' DATA-15
#' DATA-16
#'
#' \if{html}{\out{
#' `r data_get_image_tag(file = "dataset_rx_addv.png")`
Expand Down
2 changes: 1 addition & 1 deletion R/format_data.R
Original file line number Diff line number Diff line change
Expand Up @@ -9487,7 +9487,7 @@ fmt_units <- function(
#' 3-20
#'
#' @section Function Introduced:
#' **In Development**
#' *In Development*
#'
#' @import rlang
#' @export
Expand Down
1 change: 1 addition & 0 deletions R/utils_examples.R
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,7 @@ write_gt_examples_qmd_files <- function(
"illness",
"reactions",
"photolysis",
"nuclides",
"rx_adsl",
"rx_addv",
"render_gt",
Expand Down
40 changes: 40 additions & 0 deletions data-raw/14-nuclides.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
library(tidyverse)

nuclides <-
readr::read_csv(
file = "data-raw/nuclides.csv",
col_types =
cols(
z = col_integer(),
n = col_integer(),
element = col_character(),
radius = col_double(),
radius_uncert = col_double(),
abundance = col_double(),
abundance_uncert = col_double(),
is_stable = col_logical(),
half_life = col_double(),
half_life_uncert = col_double(),
isospin = col_character(),
decay_1 = col_character(),
decay_1_pct = col_double(),
decay_1_pct_uncert = col_double(),
decay_2 = col_character(),
decay_2_pct = col_double(),
decay_2_pct_uncert = col_double(),
decay_3 = col_character(),
decay_3_pct = col_double(),
decay_3_pct_uncert = col_double(),
magnetic_dipole = col_double(),
magnetic_dipole_uncert = col_double(),
electric_quadrupole = col_double(),
electric_quadrupole_uncert = col_double(),
atomic_mass = col_double(),
atomic_mass_uncert = col_double(),
mass_excess = col_double(),
mass_excess_uncert = col_double()
)
) %>%
dplyr::mutate(dplyr::across(dplyr::contains("pct"), ~ . / 100)) %>%
dplyr::mutate(nuclide = paste0("^{", z + n, "}_{", z, "}", element, n)) %>%
dplyr::relocate(nuclide, .before = z)
File renamed without changes.
Loading

0 comments on commit c2ad313

Please sign in to comment.