This is a convenience function that simplifies the task of appending univariate functional observations of two datasets to a unique univariate functional dataset.

append_fData(fD1, fD2)

Arguments

fD1

is the first functional dataset, stored into an fData object.

fD2

is the second functional dataset, stored into an fData object.

Value

The function returns an fData object containing the union of fD1 and fD2

Details

The two original datasets must be compatible, i.e. must be defined on the same grid. If we denote with \(X_1, \ldots, X_n\) the first dataset, defined over the grid \(I = t_1, \ldots, t_P\), and with \(Y_1, \ldots, Y_m\) the second functional dataset, defined on the same grid, the method returns the union dataset obtained by taking all the \(n + m\) observations together.

See also

Examples

# Creating two simple univariate datasets

grid = seq(0, 2 * pi, length.out = 100)

values1 = matrix( c(sin(grid),
                    sin(2 * grid)), nrow = 2, ncol = length(grid),
                   byrow=TRUE)

values2 = matrix( c(cos(grid),
                    cos(2 * grid)), nrow = 2, ncol = length(grid),
                   byrow=TRUE)

fD1 = fData( grid, values1 )
fD2 = fData( grid, values2 )

# Appending them to a unique dataset
append_fData(fD1, fD2)
#> $t0
#> [1] 0
#> 
#> $tP
#> [1] 6.283185
#> 
#> $h
#> [1] 0.06346652
#> 
#> $P
#> [1] 100
#> 
#> $N
#> [1] 4
#> 
#> $values
#>      [,1]       [,2]      [,3]      [,4]      [,5]      [,6]      [,7]
#> [1,]    0 0.06342392 0.1265925 0.1892512 0.2511480 0.3120334 0.3716625
#> [2,]    0 0.12659245 0.2511480 0.3716625 0.4861967 0.5929079 0.6900790
#> [3,]    1 0.99798668 0.9919548 0.9819287 0.9679487 0.9500711 0.9283679
#> [4,]    1 0.99195481 0.9679487 0.9283679 0.8738494 0.8052703 0.7237340
#>           [,8]      [,9]     [,10]     [,11]     [,12]      [,13]       [,14]
#> [1,] 0.4297949 0.4861967 0.5406408 0.5929079 0.6427876 0.69007901  0.73459171
#> [2,] 0.7761465 0.8497254 0.9096320 0.9549022 0.9848078 0.99886734  0.99685478
#> [3,] 0.9029265 0.8738494 0.8412535 0.8052703 0.7660444 0.72373404  0.67850941
#> [4,] 0.6305527 0.5272255 0.4154150 0.2969204 0.1736482 0.04758192 -0.07924996
#>           [,15]      [,16]      [,17]      [,18]      [,19]      [,20]
#> [1,]  0.7761465  0.8145760  0.8497254  0.8814534  0.9096320  0.9341479
#> [2,]  0.9788024  0.9450008  0.8959938  0.8325699  0.7557496  0.6667690
#> [3,]  0.6305527  0.5800569  0.5272255  0.4722711  0.4154150  0.3568862
#> [4,] -0.2048067 -0.3270680 -0.4440666 -0.5539201 -0.6548607 -0.7452644
#>           [,21]      [,22]      [,23]      [,24]       [,25]       [,26]
#> [1,]  0.9549022  0.9718116  0.9848078  0.9938385  0.99886734  0.99987413
#> [2,]  0.5670599  0.4582265  0.3420201  0.2203105  0.09505604 -0.03172793
#> [3,]  0.2969204  0.2357589  0.1736482  0.1108382  0.04758192 -0.01586596
#> [4,] -0.8236766 -0.8888354 -0.9396926 -0.9754298 -0.99547192 -0.99949654
#>            [,27]      [,28]      [,29]      [,30]      [,31]      [,32]
#> [1,]  0.99685478  0.9898214  0.9788024  0.9638422  0.9450008  0.9223543
#> [2,] -0.15800140 -0.2817326 -0.4009305 -0.5136774 -0.6181590 -0.7126942
#> [3,] -0.07924996 -0.1423148 -0.2048067 -0.2664738 -0.3270680 -0.3863451
#> [4,] -0.98743889 -0.9594930 -0.9161085 -0.8579834 -0.7860531 -0.7014749
#>           [,33]      [,34]      [,35]      [,36]      [,37]       [,38]
#> [1,]  0.8959938  0.8660254  0.8325699  0.7957618  0.7557496  0.71269417
#> [2,] -0.7957618 -0.8660254 -0.9223543 -0.9638422 -0.9898214 -0.99987413
#> [3,] -0.4440666 -0.5000000 -0.5539201 -0.6056097 -0.6548607 -0.70147489
#> [4,] -0.6056097 -0.5000000 -0.3863451 -0.2664738 -0.1423148 -0.01586596
#>           [,39]      [,40]      [,41]      [,42]      [,43]      [,44]
#> [1,]  0.6667690  0.6181590  0.5670599  0.5136774  0.4582265  0.4009305
#> [2,] -0.9938385 -0.9718116 -0.9341479 -0.8814534 -0.8145760 -0.7345917
#> [3,] -0.7452644 -0.7860531 -0.8236766 -0.8579834 -0.8888354 -0.9161085
#> [4,]  0.1108382  0.2357589  0.3568862  0.4722711  0.5800569  0.6785094
#>           [,45]      [,46]      [,47]      [,48]       [,49]       [,50]
#> [1,]  0.3420201  0.2817326  0.2203105  0.1580014  0.09505604  0.03172793
#> [2,] -0.6427876 -0.5406408 -0.4297949 -0.3120334 -0.18925124 -0.06342392
#> [3,] -0.9396926 -0.9594930 -0.9754298 -0.9874389 -0.99547192 -0.99949654
#> [4,]  0.7660444  0.8412535  0.9029265  0.9500711  0.98192870  0.99798668
#>            [,51]       [,52]      [,53]      [,54]      [,55]      [,56]
#> [1,] -0.03172793 -0.09505604 -0.1580014 -0.2203105 -0.2817326 -0.3420201
#> [2,]  0.06342392  0.18925124  0.3120334  0.4297949  0.5406408  0.6427876
#> [3,] -0.99949654 -0.99547192 -0.9874389 -0.9754298 -0.9594930 -0.9396926
#> [4,]  0.99798668  0.98192870  0.9500711  0.9029265  0.8412535  0.7660444
#>           [,57]      [,58]      [,59]      [,60]      [,61]      [,62]
#> [1,] -0.4009305 -0.4582265 -0.5136774 -0.5670599 -0.6181590 -0.6667690
#> [2,]  0.7345917  0.8145760  0.8814534  0.9341479  0.9718116  0.9938385
#> [3,] -0.9161085 -0.8888354 -0.8579834 -0.8236766 -0.7860531 -0.7452644
#> [4,]  0.6785094  0.5800569  0.4722711  0.3568862  0.2357589  0.1108382
#>            [,63]      [,64]      [,65]      [,66]      [,67]      [,68]
#> [1,] -0.71269417 -0.7557496 -0.7957618 -0.8325699 -0.8660254 -0.8959938
#> [2,]  0.99987413  0.9898214  0.9638422  0.9223543  0.8660254  0.7957618
#> [3,] -0.70147489 -0.6548607 -0.6056097 -0.5539201 -0.5000000 -0.4440666
#> [4,] -0.01586596 -0.1423148 -0.2664738 -0.3863451 -0.5000000 -0.6056097
#>           [,69]      [,70]      [,71]      [,72]      [,73]       [,74]
#> [1,] -0.9223543 -0.9450008 -0.9638422 -0.9788024 -0.9898214 -0.99685478
#> [2,]  0.7126942  0.6181590  0.5136774  0.4009305  0.2817326  0.15800140
#> [3,] -0.3863451 -0.3270680 -0.2664738 -0.2048067 -0.1423148 -0.07924996
#> [4,] -0.7014749 -0.7860531 -0.8579834 -0.9161085 -0.9594930 -0.98743889
#>            [,75]       [,76]      [,77]      [,78]      [,79]      [,80]
#> [1,] -0.99987413 -0.99886734 -0.9938385 -0.9848078 -0.9718116 -0.9549022
#> [2,]  0.03172793 -0.09505604 -0.2203105 -0.3420201 -0.4582265 -0.5670599
#> [3,] -0.01586596  0.04758192  0.1108382  0.1736482  0.2357589  0.2969204
#> [4,] -0.99949654 -0.99547192 -0.9754298 -0.9396926 -0.8888354 -0.8236766
#>           [,81]      [,82]      [,83]      [,84]      [,85]      [,86]
#> [1,] -0.9341479 -0.9096320 -0.8814534 -0.8497254 -0.8145760 -0.7761465
#> [2,] -0.6667690 -0.7557496 -0.8325699 -0.8959938 -0.9450008 -0.9788024
#> [3,]  0.3568862  0.4154150  0.4722711  0.5272255  0.5800569  0.6305527
#> [4,] -0.7452644 -0.6548607 -0.5539201 -0.4440666 -0.3270680 -0.2048067
#>            [,87]       [,88]      [,89]      [,90]      [,91]      [,92]
#> [1,] -0.73459171 -0.69007901 -0.6427876 -0.5929079 -0.5406408 -0.4861967
#> [2,] -0.99685478 -0.99886734 -0.9848078 -0.9549022 -0.9096320 -0.8497254
#> [3,]  0.67850941  0.72373404  0.7660444  0.8052703  0.8412535  0.8738494
#> [4,] -0.07924996  0.04758192  0.1736482  0.2969204  0.4154150  0.5272255
#>           [,93]      [,94]      [,95]      [,96]      [,97]      [,98]
#> [1,] -0.4297949 -0.3716625 -0.3120334 -0.2511480 -0.1892512 -0.1265925
#> [2,] -0.7761465 -0.6900790 -0.5929079 -0.4861967 -0.3716625 -0.2511480
#> [3,]  0.9029265  0.9283679  0.9500711  0.9679487  0.9819287  0.9919548
#> [4,]  0.6305527  0.7237340  0.8052703  0.8738494  0.9283679  0.9679487
#>            [,99]        [,100]
#> [1,] -0.06342392 -2.449294e-16
#> [2,] -0.12659245 -4.898587e-16
#> [3,]  0.99798668  1.000000e+00
#> [4,]  0.99195481  1.000000e+00
#> 
#> attr(,"class")
#> [1] "fData"