Description Usage Arguments Value Note Examples

View source: R/insert.hinges.R

Inserting wavelengths values immediately before and after a discontinuity in the SWF, greatly reduces the errors caused by interpolating the weighted irradiance during integration of the effective spectral irradiance. This is specially true when data have a large wavelength step size.

1 | ```
insert_hinges(x, y, h)
``` |

`x` |
numeric array (sorted in increasing order) |

`y` |
numeric array |

`h` |
a numeric array giving the wavelengths at which the y values should be inserted by interpolation, no interpolation is indicated by an empty array (numeric(0)) |

a data.frame with variables `x`

and `y`

Insertion is a costly operation but I have tried to optimize this function as much as possible by avoiding loops. Earlier this function was implemented in C++, but a bug was discovered and I have now rewritten it using R.

1 2 3 4 5 6 | ```
with(sun.data,
insert_hinges(w.length, s.e.irrad,
c(399.99, 400.00, 699.99, 700.00)))
with(sun.data,
insert_hinges(w.length, s.e.irrad,
c(100, 399.50, 399.99, 400.00, 699.99, 700.00, 799.99, 1000)))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.