-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathOps.ir.Rd
55 lines (50 loc) · 1.66 KB
/
Ops.ir.Rd
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
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/Ops.R
\name{Ops.ir}
\alias{Ops.ir}
\title{Arithmetic operations for \code{ir} objects}
\usage{
\method{Ops}{ir}(e1, e2)
}
\arguments{
\item{e1}{An object of class \code{ir}.}
\item{e2}{An object of class \code{ir} or a numeric value.}
}
\value{
\code{e1} with intensity values of the spectra added to/subtracted
with/multiplied with/divided by those in \code{e2}:
\itemize{
\item If \code{e2} is a numeric value, all intensity values in the spectra of \code{e1} are
added/subtracted/multiplied/divided by \code{e2}.
\item If \code{e2} is an \code{ir} object with one row, it is replicated (see \link{rep.ir}) so
that the row numbers match to those of \code{e1} and intensity values are
added/subtracted/multiplied/divided row-wise.
\item If \code{e2} is an \code{ir} object with the same number of rows as \code{e1}, intensity
values are added/subtracted/multiplied/divided row-wise.
}
}
\description{
Arithmetic operations for \code{ir} objects
}
\examples{
## addition
ir::ir_sample_data + ir::ir_sample_data
ir::ir_sample_data + 2
ir::ir_sample_data +
seq(from = 0, to = 2, length.out = nrow(ir::ir_sample_data))
## subtraction
ir::ir_sample_data - ir::ir_sample_data
ir::ir_sample_data - 2
ir::ir_sample_data -
seq(from = 0, to = 2, length.out = nrow(ir::ir_sample_data))
## multiplication
ir::ir_sample_data * ir::ir_sample_data
ir::ir_sample_data * 2
ir::ir_sample_data *
seq(from = 0, to = 2, length.out = nrow(ir::ir_sample_data))
## division
ir::ir_sample_data / ir::ir_sample_data
ir::ir_sample_data / 2
ir::ir_sample_data /
seq(from = 0.1, to = 2, length.out = nrow(ir::ir_sample_data))
}