Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/r-quantities/constants
Reference on Constants, Units and Uncertainty
https://github.com/r-quantities/constants
constants cran physics r r-package
Last synced: 19 days ago
JSON representation
Reference on Constants, Units and Uncertainty
- Host: GitHub
- URL: https://github.com/r-quantities/constants
- Owner: r-quantities
- License: other
- Created: 2017-07-09T23:07:39.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2022-12-23T16:44:25.000Z (about 2 years ago)
- Last Synced: 2024-11-30T22:39:51.323Z (about 1 month ago)
- Topics: constants, cran, physics, r, r-package
- Language: R
- Homepage: https://r-quantities.github.io/constants
- Size: 478 KB
- Stars: 15
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.Rmd
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
---```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "README-"
)
```# Reference on Constants, Units and Uncertainty
[![Build Status](https://github.com/r-quantities/constants/workflows/build/badge.svg)](https://github.com/r-quantities/constants/actions)
[![Coverage Status](https://codecov.io/gh/r-quantities/constants/branch/master/graph/badge.svg)](https://codecov.io/gh/r-quantities/constants)
[![CRAN\_Status\_Badge](https://www.r-pkg.org/badges/version/constants)](https://cran.r-project.org/package=constants)
[![Downloads](https://cranlogs.r-pkg.org/badges/constants)](https://cran.r-project.org/package=constants)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.
## Installation
Install the release version from CRAN:
```{r, eval=FALSE}
install.packages("constants")
```The installation from GitHub requires the [remotes](https://cran.r-project.org/package=remotes) package.
```{r, eval=FALSE}
# install.packages("remotes")
remotes::install_github("r-quantities/constants")
```## Example
```{r}
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)
```