Just curious - is there a package or dataset somewhere containing values for physical constants? I only ask because I've now typed in 273.15
(Celsius to Kelvin conversion) wrong several times. =)
相关问题
- Why does const allow implicit conversion of refere
- R - Quantstart: Testing Strategy on Multiple Equit
- Using predict with svyglm
- Reshape matrix by rows
- Extract P-Values from Dunnett Test into a Table by
相关文章
- How to convert summary output to a data frame?
- How to plot smoother curves in R
- Paste all possible diagonals of an n*n matrix or d
- ess-rdired: I get this error “no ESS process is as
- How to use doMC under Windows or alternative paral
- dyLimit for limited time in Dygraphs
- Saving state of Shiny app to be restored later
- How to insert pictures into each individual bar in
The packages
marelac
anddielectric
both have some physical constants, but not that one in particular.marelac::convert_T
will do the temperature conversions.May I recommend 2 options:
1) If you need these constants all the time you could make use of the .First library in the form of
C2K<-273.15
. You can assign constants and store them there. For more on this see http://cran.r-project.org/doc/contrib/Lemon-kickstart/kr_first.html2) If you want to use the files only sometimes save the constants in a text file in the same format as above
x<-273.15
and then source the path to this file using the source function in the following format:source(C:\Users\PAth to save file text\formulas.txt)
This gives you more control over the constants than relying on a package that may or may not contain what you want.
It's a fairly large task to assemble this information but some of the thermodynamic constants are available in marelac:
In addition to the R resources in my answer to the question that that @joran cited these are further resources at NIST:
http://www.nist.gov/pml/wmd/metric/si-units.cfm
http://www.nist.gov/pml/wmd/pubs/upload/AppC-11-hb44-final.pdf
http://www.nist.gov/pml/wmd/pubs/upload/AppC-11-hb44-final.pdf
I took on the task of reading the NIST Constants Table, editing it so the conversion to numeric would be reasonable, and this was the input code:
.... and here is the dput version:
Here is another parsing of the NIST CODATA table of physical constants. It is similar to BondedDust's answer above but with (what I think is) slightly easier readability due to use of
stringr
.And that's it. Now it's easy to search — in R — the data to find the constants you want, and assign constants that you will use to variable names, without having to manually type them.
Should be fairly easy to download and parse this:
http://physics.nist.gov/cuu/Constants/Table/allascii.txt
[actually scratch that, that file is not nicely formatted, and a couple of the constants break even the approximate fixed-width formatting. Needs cleverer processing to be useful]