Description Usage Arguments Details Value Examples
Trapezoid integral calculation
1 2 3 |
wv |
wavelength |
x |
data.frame that need to be trapzed with ncol equal to length of |
In 2020-11-02, I created an improved version of trapz
, say trapz
.
So better to use trapz
as it calculates much faster than before.
A vector presenting the area result.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | library(FCMm)
library(magrittr)
library(stringr)
data("Nechad2015")
w <- Nechad2015 %>% names %>%
str_extract(.,pattern="\\d") %>%
is.na %>% {!.}
wv <- w %>% names(Nechad2015)[.] %>%
gsub('X','',.) %>% as.numeric
x <- w %>% Nechad2015[,.]
names(x) <- wv
rm(w)
Area <- trapz(wv, x)
Area2 <- trapz2(x) # the results are indentical to that from trapz
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.