Operator * and / for fData objects

Description

These methods provide operators * and / to perform products or divisions between an fData object and either a number or a compliant 1D data structure, like numeric vector, array or matrix. The operation is computed by performing the element-wise product or division between fD's observations and the provided value(s).

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 a single number or a 1D data structure (such as numeric raw vector, matrix or array) specifying the factor(s) to use in the multiplication/division of fD elements' values. In the latter case, each factor is used with the corresponding element in fD, hence a must have length N, number of observations in fD.

Details

If the second argument is a 1D data structure, it must have length N equal to the number of observations in fD.

Value

The function returns an fData object, whose function values have undergone the product/division.

Examples

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

fD * seq( 1, N )


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

fD / rep( 10, N )

Want to suggest features or report bugs for rdrr.io? Use the GitHub issue tracker.