times-.fData {roahd}R Documentation

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

## 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


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 )


[Package roahd version 1.4.3 Index]