knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "README-" )
The constants package provides the CODATA internationally recommended values of the fundamental physical constants, provided as symbols for direct use within the R language. Optionally, the values with uncertainties and/or units are also provided if the 'errors', 'units' and/or 'quantities' packages are installed. The Committee on Data for Science and Technology (CODATA) is an interdisciplinary committee of the International Council for Science which periodically provides the internationally accepted set of values of the fundamental physical constants. This package contains the "2018 CODATA" version, published on May 2019.
Eite Tiesinga, Peter J. Mohr, David B. Newell, and Barry N. Taylor (2020). The 2018 CODATA Recommended Values of the Fundamental Physical Constants (Web Version 8.1). Database developed by J. Baker, M. Douma, and S. Kotochigova. Available at https://physics.nist.gov/cuu/Constants/, National Institute of Standards and Technology, Gaithersburg, MD 20899.
Install the release version from CRAN:
install.packages("constants")
The installation from GitHub requires the remotes package.
# install.packages("remotes") remotes::install_github("r-quantities/constants")
library(constants) # the speed of light syms$c0 # use the constants in a local environment with(syms, c0) # explore which constants are available (lkp <- lookup("planck", ignore.case=TRUE)) idx <- as.integer(rownames(lkp)) # attach the symbols to the search path and use them explicitly attach(syms[idx]) h plkl # the same with uncertainty detach(syms[idx]) attach(syms_with_errors[idx]) h plkl # the same with units detach(syms_with_errors[idx]) attach(syms_with_units[idx]) h plkl # the same with everything detach(syms_with_units[idx]) attach(syms_with_quantities[idx]) h plkl # the whole dataset head(codata) # number of constants per type library(magrittr) codata %>% tidyr::separate_rows(type, sep=", ") %>% dplyr::count(type, sort=TRUE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.