-
Notifications
You must be signed in to change notification settings - Fork 0
/
README.Rmd
67 lines (46 loc) · 1.36 KB
/
README.Rmd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
---
output: github_document
---
<!-- README.md is generated from README.Rmd. Please edit that file -->
```{r, echo = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-"
)
```
# rindex
All user-provided wavelengths must be given in meters.
## Installation
You can install rindex from github with:
```{r gh-installation, eval = FALSE}
# install.packages("devtools")
devtools::install_github("tjconstant/rindex")
```
## Example
### Searching for a refractive index dataset
```{r search}
library(rindex)
rindex.search("silver")
```
### Retreiving a dataset
Retrieving a dataset is done using the `rindex.get()` function. You must specify the unique `pageid` as found in the search table.
```{r get, R.options=list(max.print = 10)}
rindex.get(pageid = 1)
```
### Interpolation Functions
You can generate a spline-fit for any dataset using `rindex.function()`. For example, to get the interpolated refractive index of silver at 633 nm,
```{r}
Ag <- rindex.function(1)
Ag(633e-9)
```
A comparison of dataset to spline-function is shown below.
```{r}
Ag_data <- rindex.get(1)
wavelengths <- seq(200,1900,, 100) * 1e-9
plot(Ag_data$wavelength, Ag_data$n,
xlab = "wavelength (m) - log scale",
ylab = "n",
main = "Refractive Index of Silver (Real part)")
lines(wavelengths, Re(Ag(wavelengths)), col = 2, lwd = 2)
```