Description Usage Arguments Value See Also Examples

This method provides an easy and natural way to subset a functional dataset
stored in a `fData`

object, without having to deal with the inner
representation of `fData`

class.

1 2 | ```
## S3 method for class 'fData'
fD[i, j, as_fData = TRUE]
``` |

`fD` |
the univariate functional dataset in form of |

`i` |
a valid expression to subset rows ( observations ) of the univariate functional dataset |

`j` |
a valid expression to subset columns ( measurements over the grid ) of the univariate functional dataset. |

`as_fData` |
logical flag to specify whether the output should be returned
as an |

The method returns either an `fData`

object ( if ```
as_fData
= TRUE
```

) or a `matrix`

( if `as_fData = FALSE `

) containing the
required subset ( both in terms of observations and measurement points ) of
the univariate functional dataset.

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 | ```
N = 20
P = 1e2
# One dimensional grid
grid = seq( 0, 1, length.out = P )
# Generating an exponential covariance function (see related help for more
# information )
C = exp_cov_function( grid, alpha = 0.3, beta = 0.4 )
# Generating a synthetic dataset with a gaussian distribution and
# required mean and covariance function:
fD = fData( grid,
generate_gauss_fdata( N,
centerline = sin( 2 * pi * grid ),
Cov = C ) )
dev.new()
par( mfrow = c( 2, 2 ) )
# Original data
plot( fD )
# Subsetting observations
plot( fD[ c(1,2,3), , as_fData = TRUE ] )
# Subsetting measurements
plot( fD[ , 1 : 30 ] )
# Subsetting both observations and measurements
plot( fD[ 1 : 10, 50 : P ] )
# Subsetting both observations and measurements but returning a matrix
fD[ 1 : 10, 50 : P, as_fData = FALSE ]
``` |

roahd documentation built on May 30, 2017, 6:09 a.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.