plus-.fData: Operator '+' and '-' for 'fData' objects

Description Usage Arguments Details Value Examples

Description

These methods provide operators + and - to perform sums or differences between an fData object and either another fData object or other compliant data structures, like matrices or vectors or arrays, representing the pointwise measurements of the second term of the sum.

Usage

1
2
3
4
5
## S3 method for class 'fData'
fD + A

## S3 method for class 'fData'
fD - A

Arguments

fD

the univariate functional dataset in form of fData object.

A

either an fData object, defined on the very same grid of fD, or a 1D data structure (such as 1D array or raw numeric vector), or a 2D data structure (such as 2D array or raw numeric matrix ), that specifies the second term of the sum. In case of a 1D data structure, the sum is performed element-wise between each element of fD and A, and A must have length P, size of fD's grid. In case of a 2D data structure, the sum is performed element-wise between corresponding elements of fD and A's rows. In this case, A must have P columns, as the size of fD's grid.

Details

If the second term of the operation is an fData object, it must be defined over the same grid as the first.

Value

The function returns an fData object, whose function values have undergone the sum/difference.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
fD = fData( seq( 0, 1, length.out = 10 ),
            values = matrix( seq( 1, 10 ),
                             nrow = 21, ncol = 10, byrow = TRUE ) )
fD + 1 : 10

fD + array( 1, dim = c( 1, 10 ) )

fD + fD

fD = fData( seq( 0, 1, length.out = 10 ),
            values = matrix( seq( 1, 10 ),
                             nrow = 21, ncol = 10, byrow = TRUE ) )
fD - 2 : 11

fD - array( 1, dim = c( 1, 10 ) )

fD - fD

roahd documentation built on Nov. 4, 2021, 1:07 a.m.